style(python): ajoute isort pour ordonner les imports

pull/3/head
Jérôme Lebleu 2019-06-01 16:30:48 +02:00
Parent 8b38cf78bd
révision 5492c079fe
3 fichiers modifiés avec 18 ajouts et 1 suppressions

Voir le fichier

@ -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

Voir le fichier

@ -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

Voir le fichier

@ -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