misc: add isort (#52797)

This commit is contained in:
Lauréline Guérin 2021-04-06 21:28:51 +02:00
parent 1cfd7e90c4
commit 6c6d7bac40
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
3 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: ['--profile', 'black', '--line-length', '110']

6
README
View File

@ -96,7 +96,11 @@ 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
isort is used to format the imports, using those parameters:
isort --profile black --line-length 110
There is .pre-commit-config.yaml to use pre-commit to automatically run black and isort
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}/combo/{env:BRANCH_NAME:}
envlist = coverage-py3-django111-black-pylint-{sqlite,pg},py3-django22-pg
envlist = coverage-py3-django111-codestyle-pylint-{sqlite,pg},py3-django22-pg
[testenv]
usedevelop = True
@ -32,11 +32,11 @@ deps =
vobject
django-ratelimit<3
git+https://git.entrouvert.org/debian/django-ckeditor.git
black: pre-commit
pre-commit
uwsgidecorators
commands =
./getlasso3.sh
python manage.py compilemessages
py.test {env:COVERAGE:} {posargs: --junitxml=junit-{envname}.xml tests/}
pylint: ./pylint.sh combo/
black: pre-commit run black --all-files --show-diff-on-failure
codestyle: pre-commit run --all-files --show-diff-on-failure