misc: use isort (#52224)
This commit is contained in:
parent
7e28b71836
commit
3095510966
|
@ -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']
|
||||
|
|
|
@ -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
4
README
|
@ -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.)
|
||||
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue