From 5fade419f7602b3effba1eef4f184391b2579a1b Mon Sep 17 00:00:00 2001 From: Nicolas ROCHE Date: Mon, 12 Apr 2021 09:23:11 +0200 Subject: [PATCH] misc: add isort (#52937) --- .pre-commit-config.yaml | 5 +++++ README | 9 +++++++++ tox.ini | 6 +++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a14705c7..c6a0c576 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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'] diff --git a/README b/README index 8efb5dd1..379958b9 100644 --- a/README +++ b/README @@ -62,9 +62,18 @@ 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 --profile black --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.) +The .git-blame-ignore-revs file could be used to hide the related +changes into the sources: + + git blame --ignore-revs-file .git-blame-ignore-revs + Tests ----- diff --git a/tox.ini b/tox.ini index 41f80944..4551c203 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/passerelle/{env:BRANCH_NAME:} -envlist = py3-django111-black-coverage,py3-django22 +envlist = py3-django111-codestyle-coverage,py3-django22 [testenv] usedevelop = True @@ -37,12 +37,12 @@ deps = django-ratelimit pyquery zeep<3.3 - black: pre-commit + codestyle: pre-commit commands = ./get_wcs.sh py.test {posargs: {env:FAST:} {env:COVERAGE:} {env:JUNIT:} tests/} coverage: ./pylint.sh passerelle/ - black: pre-commit run black --all-files --show-diff-on-failure + codestyle: pre-commit run --all-files --show-diff-on-failure [pytest] filterwarnings = default