From 41025d302401449f3666d3884ae543c8018db58c Mon Sep 17 00:00:00 2001 From: Krishna Chittur Date: Fri, 3 Nov 2023 19:17:15 -0400 Subject: [PATCH] Add support for running as git pre-commit hook (#5) --- .pre-commit-hooks.yaml | 5 +++++ README.md | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-hooks.yaml diff --git a/.pre-commit-hooks.yaml b/.pre-commit-hooks.yaml new file mode 100644 index 0000000..f20ce4a --- /dev/null +++ b/.pre-commit-hooks.yaml @@ -0,0 +1,5 @@ +- id: splinter + name: Splinter + entry: ./splinter + language: script + description: Simple pattern-based linter diff --git a/README.md b/README.md index c95adb2..7d52dc0 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ on any Unix. Define your rules in
-a file as a list of +a text file as a list of
message/regex pairs. @@ -53,4 +53,18 @@ message/regex pairs. src/foobar.test.js:130:Use `assert.strictEqual()` instead of `assert.equal()` ``` +### Running with pre-commit + +You can also set up this repo as a [pre-commit hook](https://pre-commit.com/). For example: + +```yaml + - repo: https://github.com/duolingo/splinter.git + rev: 1.3.1 + hooks: + - id: splinter + args: + - config/splinter-rules-py.txt + files: \.py$ +``` + _Duolingo is hiring! Apply at https://www.duolingo.com/careers_