Use darker

This commit is contained in:
JensDiemer 2022-04-15 16:45:12 +02:00
parent bebd34681b
commit 75c36c9b51
4 changed files with 30 additions and 39 deletions

View file

@ -37,8 +37,3 @@ jobs:
- name: 'Upload coverage report'
run: bash <(curl -s https://codecov.io/bash)
- name: 'Run linters'
if: matrix.python-version == '3.8'
run: |
make lint

View file

@ -28,16 +28,6 @@ update: install-poetry ## update the sources and installation and generate "con
poetry update
poetry export -f requirements.txt --output conf/requirements.txt
lint: ## Run code formatters and linter
poetry run flynt --fail-on-change --line-length=${MAX_LINE_LENGTH} .
poetry run isort --check-only .
poetry run flake8 .
fix-code-style: ## Fix code formatting
poetry run flynt --line-length=${MAX_LINE_LENGTH} .
poetry run black --verbose --safe --line-length=${MAX_LINE_LENGTH} --skip-string-normalization .
poetry run isort .
tox-listenvs: check-poetry ## List all tox test environments
poetry run tox --listenvs

View file

@ -23,11 +23,14 @@ tox = "*"
pytest = "*"
pytest-cov = "*"
pytest-django = "*"
pytest-darker = "*" # https://github.com/akaihola/pytest-darker
pytest-flake8 = "*"
pytest-isort = "*"
coveralls = "*"
isort = "*"
flake8 = "*"
flynt = "*"
black = "*"
darker = "*" # https://github.com/akaihola/darker
pyupgrade = "*"
[build-system]
@ -35,18 +38,32 @@ requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.darker]
src = ['.']
revision = "origin/master..."
line_length = 100
verbose = true
skip_string_normalization = true
diff = false
check = false
stdout = false
isort = true
lint = [
"flake8",
]
log_level = "INFO"
[tool.flynt]
line_length = 100
[tool.isort]
# https://pycqa.github.io/isort/docs/configuration/config_files/#pyprojecttoml-preferred-format
atomic=true
line_length=120
case_sensitive=false
profile='black'
line_length=100
skip_glob=["*/htmlcov/*","*/migrations/*"]
multi_line_output=3
include_trailing_comma=true
known_first_party=["for_runners"]
no_lines_before="LOCALFOLDER"
default_section="THIRDPARTY"
sections=["FUTURE","STDLIB","THIRDPARTY","FIRSTPARTY","LOCALFOLDER"]
lines_after_imports=2
@ -62,7 +79,6 @@ norecursedirs = ".* .git __pycache__ conf coverage* dist htmlcov"
# --full-trace
# -p no:warnings
addopts = """
--import-mode=importlib
--reuse-db
--nomigrations
--cov=.
@ -71,12 +87,15 @@ addopts = """
--cov-report xml
--no-cov-on-fail
--showlocals
--darker
--flake8
--isort
--doctest-modules
--failed-first
--last-failed-no-failures all
--new-first
"""
# TODO: --mypy
[tool.tox]
# https://tox.readthedocs.io/en/latest/example/basic.html#pyproject-toml-tox-legacy-ini

View file

@ -1,13 +0,0 @@
import shutil
import subprocess
from pathlib import Path
BASE_PATH = Path(__file__).parent.parent
def test_lint():
assert Path(BASE_PATH, 'Makefile').is_file()
make_bin = shutil.which('make')
assert make_bin is not None
subprocess.check_call([make_bin, 'lint'], cwd=BASE_PATH)