Browse Source

style(python): ajoute isort pour ordonner les imports

pull/3/head
Jérôme Lebleu 8 months ago
parent
commit
5492c079fe
3 changed files with 18 additions and 1 deletions
  1. +7
    -1
      Makefile
  2. +1
    -0
      requirements/development.txt
  3. +10
    -0
      setup.cfg

+ 7
- 1
Makefile View File

@@ -141,4 +141,10 @@ cov: test ### vérifie la couverture de code
@echo open htmlcov/index.html

lint: ### vérifie la syntaxe et le code python
$(PYTHON) -m flake8 benevalibre
@$(PYTHON) -m flake8 benevalibre \
|| echo "\033[31m[flake8]\033[0m Veuillez corriger les erreurs ci-dessus."
@$(PYTHON) -m isort --check --recursive benevalibre \
|| echo "\033[31m[isort]\033[0m Veuillez corriger l'ordre des imports avec : make isort"

fix-lint: ### corrige la syntaxe et ordonne les imports python
$(PYTHON) -m isort --recursive benevalibre

+ 1
- 0
requirements/development.txt View File

@@ -8,6 +8,7 @@ pytest-sugar # https://github.com/Frozenball/pytest-sugar
# Code quality
# ------------------------------------------------------------------------------
flake8 >=3.5.0 # https://github.com/pycqa/flake8
isort # https://github.com/timothycrosley/isort
pytest-cov # https://github.com/pytest-dev/pytest-cov

# Django


+ 10
- 0
setup.cfg View File

@@ -33,3 +33,13 @@ exclude =
docs,
node_modules
max-line-length = 80

[isort]
line_length = 80
known_first_party = benevalibre
multi_line_output = 3
default_section = THIRDPARTY
known_django = django
sections = FUTURE,STDLIB,DJANGO,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
skip_glob = **/migrations/*.py
include_trailing_comma = True

Loading…
Cancel
Save