]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
Enable black in pep8 tox job, pre-commit
authorStephen Finucane <stephen@that.guru>
Fri, 6 May 2022 19:01:43 +0000 (20:01 +0100)
committerStephen Finucane <stephen@that.guru>
Fri, 6 May 2022 19:05:29 +0000 (20:05 +0100)
Signed-off-by: Stephen Finucane <stephen@that.guru>
.pre-commit-config.yaml
pyproject.toml [new file with mode: 0644]
tox.ini

index 9198b7d6553c87b69c2767b960328201d565d5e9..581c1f1c8a69425a89f58a72cbe9b469f6a209f7 100644 (file)
@@ -3,24 +3,28 @@ default_language_version:
   # force all unspecified python hooks to run python3
   python: python3
 repos:
-- repo: https://github.com/pre-commit/pre-commit-hooks
-  rev: v4.2.0
-  hooks:
-  - id: check-executables-have-shebangs
-  - id: check-merge-conflict
-  - id: check-yaml
-  - id: end-of-file-fixer
-    exclude: (.*\.mbox)|(.*\.css)|(.*\.json)|(.*\.js)|(.*\.svg)|(.*/mails/.*-subject\.txt)
-  - id: trailing-whitespace
-    exclude: (.*\.mbox)|(.*\.svg)
-- repo: https://gitlab.com/pycqa/flake8
-  rev: 3.9.2
-  hooks:
-  - id: flake8
-- repo: https://github.com/Lucas-C/pre-commit-hooks
-  rev: v1.1.13
-  hooks:
-  - id: remove-tabs
-    exclude: (.*\.mbox)|(.*\.svg)|(.*\.sql)|(.*\.conf)
-  - id: remove-crlf
-    exclude: (.*\.mbox)|(.*\.svg)
+  - repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.2.0
+    hooks:
+      - id: check-executables-have-shebangs
+      - id: check-merge-conflict
+      - id: check-yaml
+      - id: end-of-file-fixer
+        exclude: (.*\.mbox)|(.*\.css)|(.*\.json)|(.*\.js)|(.*\.svg)|(.*/mails/.*-subject\.txt)
+      - id: trailing-whitespace
+        exclude: (.*\.mbox)|(.*\.svg)
+  - repo: https://gitlab.com/pycqa/flake8
+    rev: 3.9.2
+    hooks:
+      - id: flake8
+  - repo: https://github.com/psf/black
+    rev: 22.3.0
+    hooks:
+      - id: black
+  - repo: https://github.com/Lucas-C/pre-commit-hooks
+    rev: v1.1.13
+    hooks:
+      - id: remove-tabs
+        exclude: (.*\.mbox)|(.*\.svg)|(.*\.sql)|(.*\.conf)
+      - id: remove-crlf
+        exclude: (.*\.mbox)|(.*\.svg)
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644 (file)
index 0000000..d3728ba
--- /dev/null
@@ -0,0 +1,3 @@
+[tool.black]
+line-length = 79
+skip-string-normalization = true
diff --git a/tox.ini b/tox.ini
index f687df7337c4cf85d1250e78a966c1fd512279ab..d6615835c67254b27b1f157ff8002710d62dceac 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -36,8 +36,12 @@ commands =
     -name \*.sh -print | xargs bashate -i E006"
 
 [testenv:pep8]
-deps = flake8
-commands = flake8 {posargs:patchwork manage.py}
+deps =
+  black
+  flake8
+commands =
+  black --check --quiet {posargs:patchwork manage.py}
+  flake8 {posargs:patchwork manage.py}
 
 [flake8]
 # Some rules are ignored as their use makes the code more difficult to read: