Skip to content

Commit 8e4c459

Browse files
committed
add pre-commit with black, flake8, and whitespace fixers
1 parent 70f3b1b commit 8e4c459

4 files changed

Lines changed: 30 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/ambv/black
3+
rev: 19.3b0
4+
hooks:
5+
- id: black
6+
language_version: python3.7
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v2.1.0
9+
hooks:
10+
- id: end-of-file-fixer
11+
- id: trailing-whitespace
12+
- repo: https://gitlab.com/pycqa/flake8
13+
rev: 3.7.4
14+
hooks:
15+
- id: flake8
16+
args: ['--max-line-length=500', '--ignore=E203,E266,E501,W503', '--max-complexity=18', '--select=B,C,E,F,W,T4,B9']

README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,14 @@ please setup the git filter by executing
113113
114114
in the repository.
115115

116+
We implement several other checks in order to maintain a consistent code style. We do this using [pre-commit`](https://pre-commit.com), execute
117+
118+
.. code:: bash
119+
120+
pre-commit install
121+
122+
in the repository.
123+
116124
Credits
117125
-------
118126

azure-pipelines.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,8 @@ steps:
2424
- script: ./check_whitespace
2525
continueOnError: true
2626
displayName: 'Whitespace check'
27+
28+
- script: |
29+
source activate adaptive
30+
black . --check -t py36
31+
displayName: 'Run lint tests'

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ pytest
33
pytest-cov
44
pytest-randomly
55
pytest-timeout
6+
pre_commit

0 commit comments

Comments
 (0)