add black configuration (#52457)
This commit is contained in:
parent
4bb33d3d3c
commit
3dc618a571
|
@ -0,0 +1,2 @@
|
||||||
|
# misc: apply black
|
||||||
|
4bb33d3d3c62516cfdb1ff5bba9216936a07d368
|
|
@ -0,0 +1,8 @@
|
||||||
|
# See https://pre-commit.com for more information
|
||||||
|
# See https://pre-commit.com/hooks.html for more hooks
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/psf/black
|
||||||
|
rev: 20.8b1
|
||||||
|
hooks:
|
||||||
|
- id: black
|
||||||
|
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
|
|
@ -14,7 +14,7 @@ pipeline {
|
||||||
sh """
|
sh """
|
||||||
python3 -m venv ${env.TMPDIR}/venv/
|
python3 -m venv ${env.TMPDIR}/venv/
|
||||||
${env.TMPDIR}/venv/bin/pip install tox
|
${env.TMPDIR}/venv/bin/pip install tox
|
||||||
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"""
|
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 code-style,rbac-py3-dj111,authentic-py3-dj111-drf39,authentic-py3-dj22-drf39,pylint"""
|
||||||
}
|
}
|
||||||
post {
|
post {
|
||||||
always {
|
always {
|
||||||
|
|
10
README
10
README
|
@ -68,6 +68,16 @@ Upgrade
|
||||||
using a previous one you must first upgrade to 2.1.12 before tempting
|
using a previous one you must first upgrade to 2.1.12 before tempting
|
||||||
upgrade to a release later than 2.2.0.
|
upgrade to a release later than 2.2.0.
|
||||||
|
|
||||||
|
Code Style
|
||||||
|
==========
|
||||||
|
|
||||||
|
black is used to format the code, using thoses parameters:
|
||||||
|
|
||||||
|
black --target-version py37 --skip-string-normalization --line-length 110
|
||||||
|
|
||||||
|
There is .pre-commit-config.yaml to use pre-commit to automatically run black
|
||||||
|
before commits. (execute `pre-commit install` to install the git hook.)
|
||||||
|
|
||||||
Support
|
Support
|
||||||
=======
|
=======
|
||||||
|
|
||||||
|
|
8
tox.ini
8
tox.ini
|
@ -6,6 +6,7 @@
|
||||||
[tox]
|
[tox]
|
||||||
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic/
|
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/authentic/
|
||||||
envlist =
|
envlist =
|
||||||
|
code-style
|
||||||
authentic-py3-dj111-drf39
|
authentic-py3-dj111-drf39
|
||||||
authentic-py3-dj22-drf39
|
authentic-py3-dj22-drf39
|
||||||
|
|
||||||
|
@ -106,6 +107,13 @@ commands =
|
||||||
./getlasso3.sh
|
./getlasso3.sh
|
||||||
./authentic2-ctl {posargs:--help}
|
./authentic2-ctl {posargs:--help}
|
||||||
|
|
||||||
|
[testenv:code-style]
|
||||||
|
skip_install = true
|
||||||
|
deps =
|
||||||
|
pre-commit
|
||||||
|
commands =
|
||||||
|
pre-commit run black --all-files --show-diff-on-failure
|
||||||
|
|
||||||
[pytest]
|
[pytest]
|
||||||
filterwarnings =
|
filterwarnings =
|
||||||
ignore
|
ignore
|
||||||
|
|
Loading…
Reference in New Issue