Skip to content

Commit 5e51e05

Browse files
committed
add pre-commit hooks
isort black-jupyter flake8 pyupgrade mypy check-case-conflict check-symlinks check-yaml destroyed-symlinks end-of-file-fixer mixed-line-ending trailing-whitespace pydocstyle codespell svg-assets autoflake nbqa-pyupgrade nbqa-isort nbqa-flake8
1 parent 3626ccb commit 5e51e05

File tree

2 files changed

+88
-3
lines changed

2 files changed

+88
-3
lines changed

.pre-commit-config.yaml

Lines changed: 80 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,83 @@
1+
ci:
2+
autoupdate_schedule: quarterly
3+
4+
default_stages: [commit]
5+
6+
default_install_hook_types: [pre-commit, commit-msg]
7+
8+
# ignore generated doc and dependency lock files
9+
exclude: ^(docs/.+|.*lock.*)$
10+
111
repos:
2-
- repo: https://github.com/ambv/black
12+
- repo: https://github.com/PyCQA/isort
13+
rev: 5.10.1
14+
hooks:
15+
- id: isort
16+
17+
- repo: https://github.com/psf/black
318
rev: 22.6.0
419
hooks:
5-
- id: black
20+
- id: black-jupyter
21+
22+
- repo: https://github.com/PyCQA/flake8
23+
rev: 4.0.1
24+
hooks:
25+
- id: flake8
26+
27+
- repo: https://github.com/asottile/pyupgrade
28+
rev: v2.34.0
29+
hooks:
30+
- id: pyupgrade
31+
args: [--py38-plus]
32+
33+
- repo: https://github.com/pre-commit/mirrors-mypy
34+
rev: v0.961
35+
hooks:
36+
- id: mypy
37+
38+
- repo: https://github.com/pre-commit/pre-commit-hooks
39+
rev: v4.3.0
40+
hooks:
41+
- id: check-case-conflict
42+
- id: check-symlinks
43+
- id: check-yaml
44+
- id: destroyed-symlinks
45+
- id: end-of-file-fixer
46+
exclude: ^assets/.+\.(svg|html)$
47+
- id: mixed-line-ending
48+
- id: trailing-whitespace
49+
50+
- repo: https://github.com/codespell-project/codespell
51+
rev: v2.1.0
52+
hooks:
53+
- id: codespell
54+
stages: [commit, commit-msg]
55+
exclude_types: [csv, svg, html, yaml, jupyter]
56+
57+
- repo: local
58+
hooks:
59+
- id: svg-assets
60+
name: SVG assets
61+
entry: Files under assets/* must end in .(svg|html)
62+
language: fail
63+
files: ^assets/.*(?<!\.svg)(?<!\.html)$
64+
65+
- repo: https://github.com/myint/autoflake
66+
rev: v1.4
67+
hooks:
68+
- id: autoflake
69+
args:
70+
- --in-place
71+
- --remove-unused-variables
72+
- --remove-all-unused-imports
73+
- --expand-star-imports
74+
- --ignore-init-module-imports
75+
76+
- repo: https://github.com/nbQA-dev/nbQA
77+
rev: 1.3.1
78+
hooks:
79+
- id: nbqa-pyupgrade
80+
args: [--py38-plus]
81+
- id: nbqa-isort
82+
- id: nbqa-flake8
83+
args: [--ignore=E402]

setup.cfg

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
[flake8]
2-
max-line-length = 88
2+
max-line-length = 120
3+
# E203: whitespace before ':'
4+
# W503 line break before binary operator
5+
# E731: do not assign a lambda expression, use a def
6+
ignore = E203,E731,W503
7+
per-file-ignores =
8+
# F401: imported but unused
9+
__init__.py: F401

0 commit comments

Comments
 (0)