forked from HumanCompatibleAI/imitation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.pre-commit-config.yaml
91 lines (91 loc) · 2.65 KB
/
.pre-commit-config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
# Linting
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast
- id: trailing-whitespace
- id: end-of-file-fixer
exclude_types: [jupyter]
- id: check-toml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
- id: black-jupyter
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
# Python static analysis
- repo: https://github.com/pycqa/flake8
rev: '6.1.0'
hooks:
- id: flake8
additional_dependencies:
- darglint~=1.8.1
- flake8-blind-except==0.2.1
- flake8-builtins~=1.5.3
- flake8-commas~=2.1.0
- flake8-debugger~=4.1.2
- flake8-docstrings~=1.6.0
# Shell static analysis
- repo: https://github.com/koalaman/shellcheck-precommit
rev: v0.9.0
hooks:
- id: shellcheck
# precommit invokes shellcheck once per file. shellcheck complains if file
# includes another file not given on the command line. Ignore this, since
# they'll just get checked in a separate shellcheck invocation.
args: ["-e", "SC1091"]
# Misc
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
- id: codespell
args: ["--skip=*.pyc,tests/testdata/*,*.ipynb,*.csv","--ignore-words-list=reacher,ith,iff"]
- repo: https://github.com/syntaqx/git-hooks
rev: v0.0.18
hooks:
- id: circleci-config-validate
# Hooks that run in local environment (not isolated venv) as they need
# same dependencies as our package.
- repo: local
hooks:
- id: check-notebooks
name: check-notebooks
entry: ./ci/clean_notebooks.py --check ./docs/tutorials/
language: script
types: [jupyter]
pass_filenames: false
# Run mypy directly from local repo rather than using mirror-mypy
# so that it uses installed dependencies. Adapted from:
# https://jaredkhan.com/blog/mypy-pre-commit
- id: mypy
name: mypy
language: system
types: [python]
entry: mypy --follow-imports=silent --show-error-codes
# use require_serial so that script
# is only called once per commit
require_serial: true
# Print the number of files as a sanity-check
verbose: true
- id: pytype
name: pytype
language: system
types: [python]
entry: "bash -c 'pytype --keep-going -j ${NUM_CPUS:-auto}'"
require_serial: true
verbose: true
- id: docs
name: docs
language: system
types_or: [python, rst]
entry: bash -c "cd docs/ && make clean && SKIP_DOCTEST=True NB_EXECUTION_MODE=off make html"
require_serial: true
verbose: true
pass_filenames: false