Migrate write-good hook to pre-commit
[releng/global-jjb.git] / .pre-commit-config.yaml
1 ---
2 repos:
3   - repo: https://github.com/pre-commit/pre-commit-hooks
4     rev: v3.1.0
5     hooks:
6       - id: trailing-whitespace
7
8   - repo: https://github.com/prettier/prettier
9     rev: 2.0.5
10     hooks:
11       - id: prettier
12
13   - repo: https://github.com/jorisroovers/gitlint
14     rev: v0.13.1
15     hooks:
16       - id: gitlint
17
18   - repo: https://github.com/jumanjihouse/pre-commit-hooks
19     rev: 2.1.1
20     hooks:
21       - id: shellcheck
22
23   - repo: local
24     hooks:
25       # TODO: Switch to upstream hook when https://github.com/btford/write-good/pull/119 is merged.
26       - id: write-good
27         name: write-good
28         description: Check docs for English prose with write-good
29         entry: write-good
30         language: node
31         files: "\\.(rst|md|markdown|mdown|mkdn)$"
32         additional_dependencies: ["write-good"]
33         exclude: >
34           (?x)^(
35             docs/jjb/lf-c-cpp-jobs.rst|
36             docs/jjb/lf-ci-jobs.rst|
37             docs/jjb/lf-macros.rst|
38             docs/jjb/lf-python-jobs.rst
39           )$
40
41       # TODO: Switch to upstream hook when https://github.com/btford/write-good/pull/119 is merged.
42       # Files listed below break the following write-good rules:
43       #   - adverb weakens meaning
44       #   - is wordy or unneeded
45       #
46       # This allows us to place an exception need to pass the check without disabling all checks for
47       # the whole file.
48       # In an ideal world write-good would give us an override for each individual instance of a
49       # violation but until then this gives us a close enough approach.
50       - id: write-good
51         name: write-good --no-adverb --no-tooWordy
52         description: Check docs for English prose with write-good
53         entry: write-good --no-adverb --no-tooWordy
54         language: node
55         files: docs/jjb/lf-ci-jobs.rst
56         additional_dependencies: ["write-good"]
57
58       # TODO: Switch to upstream hook when https://github.com/btford/write-good/pull/119 is merged.
59       # Files listed below break the following write-good rules:
60       #   - is wordy or unneeded
61       #
62       # This allows us to place an exception need to pass the check without disabling all checks for
63       # the whole file.
64       # In an ideal world write-good would give us an override for each individual instance of a
65       # violation but until then this gives us a close enough approach.
66       - id: write-good
67         name: write-good --no-tooWordy
68         description: Check docs for English prose with write-good
69         entry: write-good --no-tooWordy
70         language: node
71         files: >
72           (?x)^(
73             docs/jjb/lf-c-cpp-jobs.rst|
74             docs/jjb/lf-macros.rst|
75             docs/jjb/lf-python-jobs.rst
76           )$
77         additional_dependencies: ["write-good"]