Projet

Général

Profil

0002-misc-add-isort-52856.patch

Lauréline Guérin, 08 avril 2021 14:42

Télécharger (2,01 ko)

Voir les différences:

Subject: [PATCH 2/4] misc: add isort (#52856)

 .pre-commit-config.yaml | 5 +++++
 README                  | 6 +++++-
 tox.ini                 | 4 ++--
 3 files changed, 12 insertions(+), 3 deletions(-)
.pre-commit-config.yaml
6 6
    hooks:
7 7
    - id: black
8 8
      args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
9
-   repo: https://github.com/PyCQA/isort
10
    rev: 5.7.0
11
    hooks:
12
    - id: isort
13
      args: ['--profile', 'black', '--line-length', '110']
README
36 36

  
37 37
    black --target-version py35 --skip-string-normalization --line-length 110
38 38

  
39
There is .pre-commit-config.yaml to use pre-commit to automatically run black
39
isort is used to format the imports, using those parameters:
40

  
41
    isort --profile black --line-length 110
42

  
43
There is .pre-commit-config.yaml to use pre-commit to automatically run black and isort
40 44
before commits. (execute `pre-commit install` to install the git hook.)
41 45

  
42 46

  
tox.ini
1 1
[tox]
2
envlist = py3-django111-pg-black-coverage-pylint, py3-django22-pg
2
envlist = py3-django111-pg-codestyle-coverage-pylint, py3-django22-pg
3 3
toxworkdir = {env:TMPDIR:/tmp}/tox-{env:USER}/chrono/{env:BRANCH_NAME:}
4 4

  
5 5
[testenv]
......
38 38
  python3 setup.py compile_translations
39 39
  py.test {env:COVERAGE:} {posargs:tests/}
40 40
  pylint: ./pylint.sh chrono/
41
  black: pre-commit run black --all-files --show-diff-on-failure
41
  codestyle: pre-commit run --all-files --show-diff-on-failure
42
-