From 84313210dcb6d447cccbf368f3cb9b3832fdc79c Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Sun, 18 Sep 2022 17:35:54 +0200 Subject: [PATCH] fix code style/fix tools/setup --- .editorconfig | 3 +-- Makefile | 12 +++++++++++- pyproject.toml | 21 +++++++++------------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/.editorconfig b/.editorconfig index 0f4b35f..341d20b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,7 +10,7 @@ trim_trailing_whitespace = true insert_final_newline = true [*.py] -line_length = 119 +max_line_length = 100 [{Makefile,**.mk}] indent_style = tab @@ -18,4 +18,3 @@ insert_final_newline = false [*.yml] indent_style = tab -indent_size = 4 diff --git a/Makefile b/Makefile index e390dc1..7e8b78f 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ SHELL := /bin/bash -MAX_LINE_LENGTH := 119 +MAX_LINE_LENGTH := 100 all: help @@ -28,6 +28,16 @@ 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 diff --git a/pyproject.toml b/pyproject.toml index 94d9b4c..2bd9134 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,21 +17,17 @@ django_yunohost_integration = {version = ">=v0.2.0", extras = ["ynh"]} psycopg2 = "<2.9" # https://www.psycopg.org/docs/install.html#build-prerequisites [tool.poetry.dev-dependencies] -bx_py_utils = "*" -bx_django_utils = "*" +bx_py_utils = "*" # https://github.com/boxine/bx_py_utils +bx_django_utils = "*" # https://github.com/boxine/bx_django_utils tox = "*" pytest = "*" pytest-cov = "*" pytest-django = "*" pytest-darker = "*" # https://github.com/akaihola/pytest-darker -pytest-flake8 = "*" -pytest-isort = "*" coveralls = "*" isort = "*" flake8 = "*" -flynt = "*" -darker = "*" # https://github.com/akaihola/darker -pyupgrade = "*" +EditorConfig = "*" # https://github.com/editorconfig/editorconfig-core-py [build-system] requires = ["poetry-core>=1.0.0"] @@ -89,21 +85,22 @@ addopts = """ --no-cov-on-fail --showlocals --darker - --flake8 - --isort --doctest-modules --failed-first - --last-failed-no-failures all --new-first """ -# TODO: --mypy + + +[tool.coverage.run] +omit = [".*"] + [tool.tox] # https://tox.readthedocs.io/en/latest/example/basic.html#pyproject-toml-tox-legacy-ini legacy_tox_ini = """ [tox] isolated_build = True -envlist = px310,py39,py38,py37 +envlist = py{37,38,39,310} skip_missing_interpreters = True [testenv]