0002-add-black-configuration-52457.patch
.git-blame-ignore-revs | ||
---|---|---|
1 |
# misc: apply black |
|
2 |
4bb33d3d3c62516cfdb1ff5bba9216936a07d368 |
.pre-commit-config.yaml | ||
---|---|---|
1 |
# See https://pre-commit.com for more information |
|
2 |
# See https://pre-commit.com/hooks.html for more hooks |
|
3 |
repos: |
|
4 |
- repo: https://github.com/psf/black |
|
5 |
rev: 20.8b1 |
|
6 |
hooks: |
|
7 |
- id: black |
|
8 |
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110'] |
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,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,authentic-py3-dj22-drf39,pylint"""
|
|
18 | 18 |
} |
19 | 19 |
post { |
20 | 20 |
always { |
README | ||
---|---|---|
68 | 68 |
using a previous one you must first upgrade to 2.1.12 before tempting |
69 | 69 |
upgrade to a release later than 2.2.0. |
70 | 70 | |
71 |
Code Style |
|
72 |
========== |
|
73 | ||
74 |
black is used to format the code, using thoses parameters: |
|
75 | ||
76 |
black --target-version py37 --skip-string-normalization --line-length 110 |
|
77 | ||
78 |
There is .pre-commit-config.yaml to use pre-commit to automatically run black |
|
79 |
before commits. (execute `pre-commit install` to install the git hook.) |
|
80 | ||
71 | 81 |
Support |
72 | 82 |
======= |
73 | 83 |
tox.ini | ||
---|---|---|
6 | 6 |
[tox] |
7 | 7 |
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic/ |
8 | 8 |
envlist = |
9 |
authentic-py3-dj111-drf39 |
|
9 |
authentic-py3-dj111-drf39-black
|
|
10 | 10 |
authentic-py3-dj22-drf39 |
11 | 11 | |
12 | 12 |
[tox:jenkins] |
... | ... | |
16 | 16 |
rbac-py3-dj111 |
17 | 17 |
rbac-py3-dj22 |
18 | 18 |
authentic-py3-dj111-drf34 |
19 |
authentic-py3-dj111-drf39 |
|
19 |
authentic-py3-dj111-drf39-black
|
|
20 | 20 |
authentic-py3-dj22-drf39 |
21 | 21 | |
22 | 22 |
[testenv] |
... | ... | |
77 | 77 |
py3: django-filter<2.3 |
78 | 78 |
drf34: djangorestframework>=3.4,<3.4.1 |
79 | 79 |
drf39: djangorestframework>=3.9.2,<3.10 |
80 |
pre-commit |
|
80 | 81 |
usedevelop = True |
81 | 82 |
commands = |
82 | 83 |
py2: ./getlasso.sh |
83 | 84 |
py3: ./getlasso3.sh |
84 | 85 |
authentic: ./check-migrations.sh |
85 | 86 |
rbac,authentic: py.test {env:PYTESTOPTIONS:} {env:FAST:} {env:REUSEDB:} {env:COVERAGE:} {env:JUNIT:} {env:SW:} {posargs:{env:TESTS} --random-group} |
87 |
black: pre-commit run black --all-files --show-diff-on-failure |
|
86 | 88 | |
87 | 89 |
[testenv:pylint] |
88 | 90 |
basepython = python2.7 |
89 |
- |