From a52d2b661e0bfe4b92f844e6fe0a8da97b6926e0 Mon Sep 17 00:00:00 2001 From: Sasha Romijn Date: Mon, 6 Mar 2023 14:57:27 +0100 Subject: [PATCH] Add poethepoet tasks for linting --- docs/development/development-setup.rst | 9 +++---- docs/spelling_wordlist.txt | 1 + poetry.lock | 35 ++++++++++++++++++++++++-- pyproject.toml | 10 ++++++++ 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/docs/development/development-setup.rst b/docs/development/development-setup.rst index a6233039b..523a8f3dc 100644 --- a/docs/development/development-setup.rst +++ b/docs/development/development-setup.rst @@ -89,13 +89,12 @@ Linting and formatting ---------------------- In addition to the tests, this project uses `mypy`, `ruff`, `isort` and `black` -for style checking. To run these, run:: +for style checking. Some are in a poe task for convenience. To run these, run:: mypy irrd - ruff irrd - isort irrd - black irrd - + poe lint + # To run ruff with auto fix: + poe ruff-fix Exclusions from checks ---------------------- diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt index 2ee5c11c6..ded4ea03b 100644 --- a/docs/spelling_wordlist.txt +++ b/docs/spelling_wordlist.txt @@ -64,6 +64,7 @@ preloaded preloader preloading preloads +poe pubsub py rc diff --git a/poetry.lock b/poetry.lock index 3e84aeea6..cfae216d4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.0 and should not be changed by hand. [[package]] name = "aiohttp" @@ -1512,6 +1512,18 @@ bcrypt = ["bcrypt (>=3.1.0)"] build-docs = ["cloud-sptheme (>=1.10.1)", "sphinx (>=1.6)", "sphinxcontrib-fulltoc (>=1.2.0)"] totp = ["cryptography"] +[[package]] +name = "pastel" +version = "0.2.1" +description = "Bring colors to your terminal." +category = "dev" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +files = [ + {file = "pastel-0.2.1-py2.py3-none-any.whl", hash = "sha256:4349225fcdf6c2bb34d483e523475de5bb04a5c10ef711263452cb37d7dd4364"}, + {file = "pastel-0.2.1.tar.gz", hash = "sha256:e6581ac04e973cac858828c6202c1e1e81fee1dc7de7683f3e1ffe0bfd8a573d"}, +] + [[package]] name = "pathspec" version = "0.11.0" @@ -1571,6 +1583,25 @@ files = [ dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] +[[package]] +name = "poethepoet" +version = "0.18.1" +description = "A task runner that works well with poetry." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "poethepoet-0.18.1-py3-none-any.whl", hash = "sha256:e85727bf6f4a10bf6c1a43026bdeb40df689bea3c4682d03cbe531cabc8f2ba6"}, + {file = "poethepoet-0.18.1.tar.gz", hash = "sha256:5f3566b14c2f5dccdfbc3bb26f0096006b38dc0b9c74bd4f8dd1eba7b0e29f6a"}, +] + +[package.dependencies] +pastel = ">=0.2.1,<0.3.0" +tomli = ">=1.2.2" + +[package.extras] +poetry-plugin = ["poetry (>=1.0,<2.0)"] + [[package]] name = "psutil" version = "5.9.4" @@ -3122,4 +3153,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "d2fd1e2fd7ffc57ae37f9c96a9b5db7a172a707b15b3362173b2d0ef956ba212" +content-hash = "2269a01256f83e590194609f6f3bc4aad40ea1242664d0ec03b936e0f7992924" diff --git a/pyproject.toml b/pyproject.toml index dca2bf2ed..9d724cf0f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,7 @@ ruff = "^0.0.252" isort = "^5.12.0" black = "^23.1.0" setuptools-scm = "^7.1.0" +poethepoet = "^0.18.1" [tool.poetry.group.docs.dependencies] sphinx = "^6.1.3" @@ -111,6 +112,15 @@ install_types = true non_interactive = true exclude = "irrd/storage/alembic/*" +[tool.poe.tasks] +black = "black irrd" +ruff = "ruff irrd" +ruff-fix = "ruff irrd --fix" +isort = "isort irrd" +mypy = "mypy irrd" +lint = ["black", "ruff", "isort"] +test = "pytest --cov-report term-missing:skip-covered --cov=irrd --basetemp=.tmpdirs/ irrd" + [tool.coverage.report] exclude_lines = [ "pragma: no cover",