misc: use isort (#52224)

This commit is contained in:
Lauréline Guérin 2021-03-19 11:34:18 +01:00
parent 7e28b71836
commit 3095510966
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
4 changed files with 13 additions and 4 deletions

View File

@ -6,3 +6,8 @@ repos:
hooks:
- id: black
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
- repo: https://github.com/PyCQA/isort
rev: 5.7.0
hooks:
- id: isort
args: ['--force-single-line-imports', '--line-length', '110']

4
Jenkinsfile vendored
View File

@ -9,11 +9,11 @@ pipeline {
stage('Unit tests django 1.11') {
agent any
steps {
sh 'tox -rv -e py3-django111-black-pylint-coverage'
sh 'tox -rv -e py3-django111-codestyle-pylint-coverage'
}
post {
always {
stash includes:'junit-py3-django111-black-pylint-coverage.xml', name: 'django111'
stash includes:'junit-py3-django111-codestyle-pylint-coverage.xml', name: 'django111'
script {
utils = new Utils()
utils.publish_coverage('coverage.xml')

4
README
View File

@ -39,6 +39,10 @@ black is used to format the code, using thoses parameters:
black --target-version py37 --skip-string-normalization --line-length 110
isort is used to format the imports, using those parameters:
isort --force-single-line-imports --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.)

View File

@ -1,6 +1,6 @@
[tox]
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/wcs/{env:BRANCH_NAME:main}/{env:EXECUTOR_NUMBER:}
envlist = py3-django111-black-pylint-coverage, py3-django22
envlist = py3-django111-codestyle-pylint-coverage, py3-django22
[testenv]
sitepackages = true
@ -46,4 +46,4 @@ deps =
commands =
py.test -v {env:COVERAGE:} --junitxml=junit-{envname}.xml {posargs:tests/}
pylint: ./pylint.sh wcs/
black: pre-commit run black --all-files --show-diff-on-failure
codestyle: pre-commit run --all-files --show-diff-on-failure