Skip to content

Commit 0a5cbe1

Browse files
committed
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`)
1 parent 65ac7d3 commit 0a5cbe1

File tree

2 files changed

+38
-9
lines changed

2 files changed

+38
-9
lines changed

.isort.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[settings]
2+
known_third_party = PIL,atomicwrites,holoviews,ipykernel,matplotlib,nbconvert,numpy,pytest,scipy,setuptools,skopt,sortedcollections,sortedcontainers,zmq

.pre-commit-config.yaml

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,43 @@
11
repos:
2-
- repo: https://github.com/ambv/black
3-
rev: 19.3b0
4-
hooks:
5-
- id: black
6-
language_version: python3.7
72
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v2.1.0
3+
rev: v2.4.0
94
hooks:
10-
- id: end-of-file-fixer
115
- 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
1211
- repo: https://gitlab.com/pycqa/flake8
13-
rev: 3.7.8
12+
rev: 3.7.9
1413
hooks:
1514
- 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

0 commit comments

Comments
 (0)