0004-add-isort-configuration-52457.patch
.git-blame-ignore-revs | ||
---|---|---|
1 | 1 |
# misc: apply black |
2 | 2 |
4bb33d3d3c62516cfdb1ff5bba9216936a07d368 |
3 |
# misc: apply isort |
|
4 |
ffb4193255e99b9c84131e1d409cba12782c8602 |
.pre-commit-config.yaml | ||
---|---|---|
6 | 6 |
hooks: |
7 | 7 |
- id: black |
8 | 8 |
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110'] |
9 |
- repo: https://github.com/PyCQA/isort |
|
10 |
rev: 5.7.0 |
|
11 |
hooks: |
|
12 |
- id: isort |
|
13 |
args: ["--profile", "black"] |
Jenkinsfile | ||
---|---|---|
14 | 14 |
sh """ |
15 | 15 |
python3 -m venv ${env.TMPDIR}/venv/ |
16 | 16 |
${env.TMPDIR}/venv/bin/pip install tox |
17 |
PGPORT=`python -c 'import struct; import socket; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", 1, 0)); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` pg_virtualenv -o fsync=off ${env.TMPDIR}/venv/bin/tox -rv -e rbac-py3-dj111,authentic-py3-dj111-drf39-black,authentic-py3-dj22-drf39,pylint""" |
|
17 |
PGPORT=`python -c 'import struct; import socket; s=socket.socket(); s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack("ii", 1, 0)); s.bind(("", 0)); print(s.getsockname()[1]); s.close()'` pg_virtualenv -o fsync=off ${env.TMPDIR}/venv/bin/tox -rv -e rbac-py3-dj111,authentic-py3-dj111-drf39-black-isort,authentic-py3-dj22-drf39,pylint"""
|
|
18 | 18 |
} |
19 | 19 |
post { |
20 | 20 |
always { |
README | ||
---|---|---|
78 | 78 |
There is .pre-commit-config.yaml to use pre-commit to automatically run black |
79 | 79 |
before commits. (execute `pre-commit install` to install the git hook.) |
80 | 80 | |
81 |
isort is used to format the imports, using those parameter: |
|
82 | ||
83 |
isort --force-single-line-imports --line-length 110 |
|
84 | ||
81 | 85 |
Support |
82 | 86 |
======= |
83 | 87 |
tox.ini | ||
---|---|---|
6 | 6 |
[tox] |
7 | 7 |
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic/ |
8 | 8 |
envlist = |
9 |
authentic-py3-dj111-drf39-black |
|
9 |
authentic-py3-dj111-drf39-black-isort
|
|
10 | 10 |
authentic-py3-dj22-drf39 |
11 | 11 | |
12 | 12 |
[tox:jenkins] |
... | ... | |
85 | 85 |
authentic: ./check-migrations.sh |
86 | 86 |
rbac,authentic: py.test {env:PYTESTOPTIONS:} {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {env:JUNIT:} {env:SW:} {posargs:{env:TESTS} --random-group} |
87 | 87 |
black: pre-commit run black --all-files --show-diff-on-failure |
88 |
isort: pre-commit run isort --all-files --show-diff-on-failure |
|
88 | 89 | |
89 | 90 |
[testenv:pylint] |
90 | 91 |
basepython = python2.7 |
91 |
- |