Browse Source

style(python): ajoute black pour formatter le code

pull/3/head
Jérôme Lebleu 8 months ago
parent
commit
951ee64cb8
3 changed files with 18 additions and 0 deletions
  1. +2
    -0
      Makefile
  2. +15
    -0
      pyproject.toml
  3. +1
    -0
      requirements/development.txt

+ 2
- 0
Makefile View File

@@ -145,6 +145,8 @@ lint: ### vérifie la syntaxe et le code python
|| 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"
@$(PYTHON) -m black --check benevalibre

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

+ 15
- 0
pyproject.toml View File

@@ -0,0 +1,15 @@
[tool.black]
line-length = 79
skip-string-normalization = true
exclude = '''
/(
\.git
| assets
| local
| migrations
| node_modules
| var
| venv
)/
| urls(|_.+|/.+).py
'''

+ 1
- 0
requirements/development.txt View File

@@ -7,6 +7,7 @@ pytest-sugar # https://github.com/Frozenball/pytest-sugar

# Code quality
# ------------------------------------------------------------------------------
black # https://github.com/python/black
flake8 >=3.5.0 # https://github.com/pycqa/flake8
isort # https://github.com/timothycrosley/isort
pytest-cov # https://github.com/pytest-dev/pytest-cov


Loading…
Cancel
Save