From 9eeeb39eeef60613299370f832614c93b5a41d89 Mon Sep 17 00:00:00 2001 From: Kieran Ryan Date: Mon, 22 Dec 2025 16:43:17 +0000 Subject: [PATCH 1/2] debt: Ruff Python linting Replace flake8 with ruff and monorepo configuration. --- .flake8 | 10 ---------- .gitignore | 1 + allure-behave/pyproject.toml | 2 +- allure-behave/src/listener.py | 2 +- allure-nose2/pyproject.toml | 2 +- allure-pytest-bdd/pyproject.toml | 2 +- allure-pytest/pyproject.toml | 2 +- allure-pytest/setup.py | 3 ++- allure-python-commons-test/pyproject.toml | 2 +- allure-python-commons/pyproject.toml | 2 +- .../src/allure_commons/__init__.py | 8 ++++---- .../src/allure_commons/_allure.py | 2 +- .../src/allure_commons/model2.py | 7 +++---- allure-robotframework/pyproject.toml | 2 +- pyproject.toml | 17 ++++++++++++++++- requirements/linting.txt | 3 +-- 16 files changed, 36 insertions(+), 31 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index af25e839..00000000 --- a/.flake8 +++ /dev/null @@ -1,10 +0,0 @@ -[flake8] -max-line-length = 120 -import-order-style = google -inline-quotes = " -exclude = - ./tests/allure_behave/acceptance/**/test-data/** - ./tests/allure_behave/acceptance/behave_support/background/background_steps.py -per-file-ignores = - ./allure-python-commons/src/allure_commons/types.py:A005 - ./allure-robotframework/src/listener/types.py:A005 diff --git a/.gitignore b/.gitignore index 25e4deb0..7b7033cb 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .tox .pytest_cache .python-version +.ruff_cache .venv *.pyc diff --git a/allure-behave/pyproject.toml b/allure-behave/pyproject.toml index 388f9913..442ac2d8 100644 --- a/allure-behave/pyproject.toml +++ b/allure-behave/pyproject.toml @@ -1,5 +1,5 @@ [tool.poe.tasks] -linter = "flake8 --extend-ignore=A003 ./src" +linter = "ruff check" [tool.poe.tasks.tests] cmd = "pytest ../tests/allure_behave" diff --git a/allure-behave/src/listener.py b/allure-behave/src/listener.py index e7f9be8a..fa362852 100644 --- a/allure-behave/src/listener.py +++ b/allure-behave/src/listener.py @@ -230,7 +230,7 @@ def enter(self): self._logger.start_group(group.uuid, group) self._groups.append(group) - def exit(self): # noqa: A003 + def exit(self): group = self._groups.pop() if group.befores or group.afters: self._logger.stop_group(group.uuid) diff --git a/allure-nose2/pyproject.toml b/allure-nose2/pyproject.toml index 822f5d98..a411cd33 100644 --- a/allure-nose2/pyproject.toml +++ b/allure-nose2/pyproject.toml @@ -1,5 +1,5 @@ [tool.poe.tasks] -linter = "flake8 ./src" +linter = "ruff check" [tool.poe.tasks.tests] cmd = "pytest ../tests/allure_nose2" diff --git a/allure-pytest-bdd/pyproject.toml b/allure-pytest-bdd/pyproject.toml index 83277cf5..ec703429 100644 --- a/allure-pytest-bdd/pyproject.toml +++ b/allure-pytest-bdd/pyproject.toml @@ -1,5 +1,5 @@ [tool.poe.tasks] -linter = "flake8 ./src" +linter = "ruff check" [tool.poe.tasks.tests] cmd = "pytest ../tests/allure_pytest_bdd" diff --git a/allure-pytest/pyproject.toml b/allure-pytest/pyproject.toml index 22458017..98187503 100644 --- a/allure-pytest/pyproject.toml +++ b/allure-pytest/pyproject.toml @@ -1,5 +1,5 @@ [tool.poe.tasks] -linter = "flake8 ./src" +linter = "ruff check" [tool.poe.tasks.tests] cmd = "pytest ../tests/allure_pytest" diff --git a/allure-pytest/setup.py b/allure-pytest/setup.py index 6597abf5..2bf1591e 100644 --- a/allure-pytest/setup.py +++ b/allure-pytest/setup.py @@ -1,4 +1,5 @@ -import os,sys +import os +import sys from setuptools import setup from pkg_resources import require, DistributionNotFound, VersionConflict diff --git a/allure-python-commons-test/pyproject.toml b/allure-python-commons-test/pyproject.toml index cc2b9ab5..a817d869 100644 --- a/allure-python-commons-test/pyproject.toml +++ b/allure-python-commons-test/pyproject.toml @@ -1,3 +1,3 @@ [tool.poe.tasks] -linter = "flake8 ./src" +linter = "ruff check" tests = "python -m doctest ./src/*.py" diff --git a/allure-python-commons/pyproject.toml b/allure-python-commons/pyproject.toml index 9fd4df26..3111b705 100644 --- a/allure-python-commons/pyproject.toml +++ b/allure-python-commons/pyproject.toml @@ -1,3 +1,3 @@ [tool.poe.tasks] -linter = "flake8 --extend-ignore=A001,A002,A003 ./src" +linter = "ruff check" tests = "python -m doctest ./src/allure_commons/*.py" diff --git a/allure-python-commons/src/allure_commons/__init__.py b/allure-python-commons/src/allure_commons/__init__.py index 111c2d06..1244988f 100644 --- a/allure-python-commons/src/allure_commons/__init__.py +++ b/allure-python-commons/src/allure_commons/__init__.py @@ -1,7 +1,7 @@ -from allure_commons._hooks import hookimpl # noqa: F401 -from allure_commons._core import plugin_manager # noqa: F401 -from allure_commons._allure import fixture # noqa: F401 -from allure_commons._allure import test # noqa: F401 +from allure_commons._hooks import hookimpl +from allure_commons._core import plugin_manager +from allure_commons._allure import fixture +from allure_commons._allure import test __all__ = [ diff --git a/allure-python-commons/src/allure_commons/_allure.py b/allure-python-commons/src/allure_commons/_allure.py index b7bbe2a5..08fb5a87 100644 --- a/allure-python-commons/src/allure_commons/_allure.py +++ b/allure-python-commons/src/allure_commons/_allure.py @@ -125,7 +125,7 @@ def tag(*tags): Dynamic.label(LabelType.TAG, *tags) @staticmethod - def id(id): # noqa: A003,A002 + def id(id): # noqa: A002 Dynamic.label(LabelType.ID, id) @staticmethod diff --git a/allure-python-commons/src/allure_commons/model2.py b/allure-python-commons/src/allure_commons/model2.py index d8591598..f0fd995b 100644 --- a/allure-python-commons/src/allure_commons/model2.py +++ b/allure-python-commons/src/allure_commons/model2.py @@ -54,7 +54,7 @@ class TestResult(ExecutableItem): @attrs class TestStepResult(ExecutableItem): - id = attrib(default=None) # noqa: A003 + id = attrib(default=None) @attrs @@ -83,7 +83,7 @@ class Label: @attrs class Link: - type = attrib(default=None) # noqa: A003 + type = attrib(default=None) url = attrib(default=None) name = attrib(default=None) @@ -95,12 +95,11 @@ class StatusDetails: message = attrib(default=None) trace = attrib(default=None) - @attrs class Attachment: name = attrib(default=None) source = attrib(default=None) - type = attrib(default=None) # noqa: A003 + type = attrib(default=None) class Status: diff --git a/allure-robotframework/pyproject.toml b/allure-robotframework/pyproject.toml index 0ee96703..2d6844e1 100644 --- a/allure-robotframework/pyproject.toml +++ b/allure-robotframework/pyproject.toml @@ -1,5 +1,5 @@ [tool.poe.tasks] -linter = "flake8 ./src" +linter = "ruff check" [tool.poe.tasks.tests] shell = "python -m doctest ./src/listener/utils.py && pytest ../tests/allure_robotframework" diff --git a/pyproject.toml b/pyproject.toml index f52572e9..562c1782 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poe.tasks] -linter = "flake8 ./allure-*/src ./tests" +linter = "ruff check" allure-generate = "allure generate --clean --output ./.allure-report ./.allure-results" allure-open = "allure open ./.allure-report" @@ -19,3 +19,18 @@ addopts = [ "-p", "no:allure_pytest", "-p", "no:allure_pytest_bdd" ] + +[tool.ruff] +extend-exclude = [ + "tests/allure_behave/acceptance/**/test-data/**", + "tests/allure_behave/acceptance/behave_support/background/background_steps.py", +] +line-length = 120 + +[tool.ruff.lint] +select = [ + "A", # flake8-builtins + "E", # pycodestyle errors + "F", # pyflakes + "W", # pycodestyle warnings +] diff --git a/requirements/linting.txt b/requirements/linting.txt index fc08386d..ebd9e468 100644 --- a/requirements/linting.txt +++ b/requirements/linting.txt @@ -1,3 +1,2 @@ -r ./core.txt -flake8 -flake8-builtins +ruff From 240dd86043a4e50071cb7672ee77f2437e5e6b09 Mon Sep 17 00:00:00 2001 From: Kieran Ryan Date: Mon, 22 Dec 2025 17:28:06 +0000 Subject: [PATCH 2/2] debt: Legacy jenkins linting configuration --- Jenkinsfile | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 7b6fd0ee..00000000 --- a/Jenkinsfile +++ /dev/null @@ -1,17 +0,0 @@ -pipeline { - agent { docker 'randomknowledge/docker-pyenv-tox' } - environment { - HOME = pwd() - } - stages { - stage("Build") { - steps { - sh 'tox -r --workdir=/tmp -c allure-python-commons-test/tox.ini' - sh 'tox -r --workdir=/tmp -c allure-python-commons/tox.ini' - sh 'tox -r --workdir=/tmp -c allure-pytest/tox.ini' - sh 'tox -r --workdir=/tmp -c allure-behave/tox.ini' - sh 'tox -r --workdir=/tmp -c allure-robotframework/tox.ini' - } - } - } -}