Browse code

add more pre-commit checks

A summary of what the hooks do:
* `pyupgrade` - A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
* `end-of-file-fixer` - Makes sure files end in a newline and only a newline.
* `check-docstring-first` - Checks for a common error of placing code before the docstring.
* `check-yaml` - Attempts to load all yaml files to verify syntax.
* `debug-statements` - Check for debugger imports and py37+ breakpoint() calls in python source.
* `check-ast` - Simply check whether files parse as valid python.
* `seed-isort-config` - Statically populate the `known_third_party` `isort` setting because `isort` sucks at figuring out which third party libs are used. (from author of `pre-commit`)

Bas Nijholt authored on 11/12/2019 13:55:31
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,2 @@
1
+[settings]
2
+known_third_party = PIL,atomicwrites,holoviews,ipykernel,matplotlib,nbconvert,numpy,pytest,scipy,setuptools,skopt,sortedcollections,sortedcontainers,zmq
... ...
@@ -1,16 +1,43 @@
1 1
 repos:
2
--   repo: https://github.com/ambv/black
3
-    rev: 19.3b0
4
-    hooks:
5
-    - id: black
6
-      language_version: python3.7
7 2
 -   repo: https://github.com/pre-commit/pre-commit-hooks
8
-    rev: v2.1.0
3
+    rev: v2.4.0
9 4
     hooks:
10
-    -   id: end-of-file-fixer
11 5
     -   id: trailing-whitespace
6
+    -   id: end-of-file-fixer
7
+    -   id: check-docstring-first
8
+    -   id: check-yaml
9
+    -   id: debug-statements
10
+    -   id: check-ast
12 11
 -   repo: https://gitlab.com/pycqa/flake8
13
-    rev: 3.7.8
12
+    rev: 3.7.9
14 13
     hooks:
15 14
     -   id: flake8
16
-        args: ['--max-line-length=500', '--ignore=E203,E266,E501,W503', '--max-complexity=18', '--select=B,C,E,F,W,T4,B9']
15
+        args:
16
+          - --max-line-length=500
17
+          - --ignore=E203,E266,E501,W503
18
+          - --max-complexity=18
19
+          - --select=B,C,E,F,W,T4,B9
20
+-   repo: https://github.com/ambv/black
21
+    rev: 19.10b0
22
+    hooks:
23
+    - id: black
24
+      language_version: python3.7
25
+-   repo: https://github.com/asottile/pyupgrade
26
+    rev: v1.25.2
27
+    hooks:
28
+    -   id: pyupgrade
29
+        args: ['--py36-plus']
30
+-   repo: https://github.com/pre-commit/mirrors-isort
31
+    rev: v4.3.21
32
+    hooks:
33
+    -   id: isort
34
+        args:
35
+          - --multi-line=3
36
+          - --trailing-comma
37
+          - --force-grid-wrap=0
38
+          - --use-parentheses
39
+          - --line-width=88
40
+-   repo: https://github.com/asottile/seed-isort-config
41
+    rev: v1.9.3
42
+    hooks:
43
+    -   id: seed-isort-config