mirror of
https://github.com/YunoHost-Apps/django-for-runners_ynh.git
synced 2024-09-03 18:26:16 +02:00
Use darker
This commit is contained in:
parent
bebd34681b
commit
75c36c9b51
4 changed files with 30 additions and 39 deletions
5
.github/workflows/pytest.yml
vendored
5
.github/workflows/pytest.yml
vendored
|
@ -37,8 +37,3 @@ jobs:
|
||||||
|
|
||||||
- name: 'Upload coverage report'
|
- name: 'Upload coverage report'
|
||||||
run: bash <(curl -s https://codecov.io/bash)
|
run: bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
- name: 'Run linters'
|
|
||||||
if: matrix.python-version == '3.8'
|
|
||||||
run: |
|
|
||||||
make lint
|
|
||||||
|
|
10
Makefile
10
Makefile
|
@ -28,16 +28,6 @@ update: install-poetry ## update the sources and installation and generate "con
|
||||||
poetry update
|
poetry update
|
||||||
poetry export -f requirements.txt --output conf/requirements.txt
|
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
|
tox-listenvs: check-poetry ## List all tox test environments
|
||||||
poetry run tox --listenvs
|
poetry run tox --listenvs
|
||||||
|
|
||||||
|
|
|
@ -23,11 +23,14 @@ tox = "*"
|
||||||
pytest = "*"
|
pytest = "*"
|
||||||
pytest-cov = "*"
|
pytest-cov = "*"
|
||||||
pytest-django = "*"
|
pytest-django = "*"
|
||||||
|
pytest-darker = "*" # https://github.com/akaihola/pytest-darker
|
||||||
|
pytest-flake8 = "*"
|
||||||
|
pytest-isort = "*"
|
||||||
coveralls = "*"
|
coveralls = "*"
|
||||||
isort = "*"
|
isort = "*"
|
||||||
flake8 = "*"
|
flake8 = "*"
|
||||||
flynt = "*"
|
flynt = "*"
|
||||||
black = "*"
|
darker = "*" # https://github.com/akaihola/darker
|
||||||
pyupgrade = "*"
|
pyupgrade = "*"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
|
@ -35,18 +38,32 @@ requires = ["poetry-core>=1.0.0"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
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]
|
[tool.isort]
|
||||||
# https://pycqa.github.io/isort/docs/configuration/config_files/#pyprojecttoml-preferred-format
|
# https://pycqa.github.io/isort/docs/configuration/config_files/#pyprojecttoml-preferred-format
|
||||||
atomic=true
|
atomic=true
|
||||||
line_length=120
|
profile='black'
|
||||||
case_sensitive=false
|
line_length=100
|
||||||
skip_glob=["*/htmlcov/*","*/migrations/*"]
|
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
|
lines_after_imports=2
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,7 +79,6 @@ norecursedirs = ".* .git __pycache__ conf coverage* dist htmlcov"
|
||||||
# --full-trace
|
# --full-trace
|
||||||
# -p no:warnings
|
# -p no:warnings
|
||||||
addopts = """
|
addopts = """
|
||||||
--import-mode=importlib
|
|
||||||
--reuse-db
|
--reuse-db
|
||||||
--nomigrations
|
--nomigrations
|
||||||
--cov=.
|
--cov=.
|
||||||
|
@ -71,12 +87,15 @@ addopts = """
|
||||||
--cov-report xml
|
--cov-report xml
|
||||||
--no-cov-on-fail
|
--no-cov-on-fail
|
||||||
--showlocals
|
--showlocals
|
||||||
|
--darker
|
||||||
|
--flake8
|
||||||
|
--isort
|
||||||
--doctest-modules
|
--doctest-modules
|
||||||
--failed-first
|
--failed-first
|
||||||
--last-failed-no-failures all
|
--last-failed-no-failures all
|
||||||
--new-first
|
--new-first
|
||||||
"""
|
"""
|
||||||
|
# TODO: --mypy
|
||||||
|
|
||||||
[tool.tox]
|
[tool.tox]
|
||||||
# https://tox.readthedocs.io/en/latest/example/basic.html#pyproject-toml-tox-legacy-ini
|
# https://tox.readthedocs.io/en/latest/example/basic.html#pyproject-toml-tox-legacy-ini
|
||||||
|
|
|
@ -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)
|
|
Loading…
Reference in a new issue