Migrate write-good hook to pre-commit
[releng/global-jjb.git] / .pre-commit-config.yaml
index d0d5be7..984ea24 100644 (file)
@@ -19,3 +19,59 @@ repos:
     rev: 2.1.1
     hooks:
       - id: shellcheck
+
+  - repo: local
+    hooks:
+      # TODO: Switch to upstream hook when https://github.com/btford/write-good/pull/119 is merged.
+      - id: write-good
+        name: write-good
+        description: Check docs for English prose with write-good
+        entry: write-good
+        language: node
+        files: "\\.(rst|md|markdown|mdown|mkdn)$"
+        additional_dependencies: ["write-good"]
+        exclude: >
+          (?x)^(
+            docs/jjb/lf-c-cpp-jobs.rst|
+            docs/jjb/lf-ci-jobs.rst|
+            docs/jjb/lf-macros.rst|
+            docs/jjb/lf-python-jobs.rst
+          )$
+
+      # TODO: Switch to upstream hook when https://github.com/btford/write-good/pull/119 is merged.
+      # Files listed below break the following write-good rules:
+      #   - adverb weakens meaning
+      #   - is wordy or unneeded
+      #
+      # This allows us to place an exception need to pass the check without disabling all checks for
+      # the whole file.
+      # In an ideal world write-good would give us an override for each individual instance of a
+      # violation but until then this gives us a close enough approach.
+      - id: write-good
+        name: write-good --no-adverb --no-tooWordy
+        description: Check docs for English prose with write-good
+        entry: write-good --no-adverb --no-tooWordy
+        language: node
+        files: docs/jjb/lf-ci-jobs.rst
+        additional_dependencies: ["write-good"]
+
+      # TODO: Switch to upstream hook when https://github.com/btford/write-good/pull/119 is merged.
+      # Files listed below break the following write-good rules:
+      #   - is wordy or unneeded
+      #
+      # This allows us to place an exception need to pass the check without disabling all checks for
+      # the whole file.
+      # In an ideal world write-good would give us an override for each individual instance of a
+      # violation but until then this gives us a close enough approach.
+      - id: write-good
+        name: write-good --no-tooWordy
+        description: Check docs for English prose with write-good
+        entry: write-good --no-tooWordy
+        language: node
+        files: >
+          (?x)^(
+            docs/jjb/lf-c-cpp-jobs.rst|
+            docs/jjb/lf-macros.rst|
+            docs/jjb/lf-python-jobs.rst
+          )$
+        additional_dependencies: ["write-good"]