From 3084a790abadc4b7815feb73cfd8a2094c131f60 Mon Sep 17 00:00:00 2001 From: loonghao Date: Mon, 28 Sep 2026 01:53:51 +0800 Subject: [PATCH] chore(lint): retire Travis/Hound/pylint configs and move lint into pyproject.toml The flagship repository still carried 2019-era tooling that no longer runs: - .travis.yml - its only step beyond install was `poetry run codecov`, which uploaded nothing because no coverage was ever generated first. The Python 3.8/3.9/3.10 lint job is covered by pythonpackage.yml and tests through Python 3.12 by import-test.yml. - .hound.yml - Hound CI is no longer wired to this repository. - .pylintrc - pylint was never invoked by CI or by pre-commit, despite being in the dev dependency group. - .flake8 - superseded by [tool.ruff] in pyproject.toml. The ruff configuration is a behaviour-preserving port: pycodestyle and pyflakes rules at line-length 120 over the same exclude list, plus flake8-quotes (double quotes), which the codebase already satisfies. flake8 7.1.1 and ruff 0.16.9 both report zero findings on photoshop/, so CI behaviour is unchanged. Deliberately not ported: flake8-docstrings (google convention) reports 426 findings on photoshop/. Enabling it is a separate decision rather than a silent drop, and is tracked for review. `pylint` stays in the dev dependency group but is now unreferenced; removing it touches poetry.lock and is left for a follow-up. --- .flake8 | 30 ----------------------------- .github/workflows/pythonpackage.yml | 5 ++++- .hound.yml | 8 -------- .pylintrc | 7 ------- .travis.yml | 14 -------------- pyproject.toml | 30 +++++++++++++++++++++++++++++ 6 files changed, 34 insertions(+), 60 deletions(-) delete mode 100644 .flake8 delete mode 100644 .hound.yml delete mode 100644 .pylintrc delete mode 100644 .travis.yml diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 1548c564..00000000 --- a/.flake8 +++ /dev/null @@ -1,30 +0,0 @@ -[flake8] -ignore = BLK100 - -# flake8-quotes: -# Use double quotes as our default to comply with black, we like it and -# don't want to use single quotes anymore. -# We would love to configure this via our pyproject.toml but flake8-3.8 does -# not support it yet. -inline-quotes = double -multiline-quotes = double -docstring-quotes = double -avoid-escape = True - -# flake8-docstrings -# Use the Google Python Styleguide Docstring format. -docstring-convention = google - -exclude = - .git, - __pycache__, - docs/source/conf.py, - old, - build, - dist, - venv, - docs, - examples, - test - -max-line-length = 120 diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 6daaf15b..20d1bfc2 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -23,6 +23,9 @@ jobs: poetry --version poetry install + - name: Install ruff + run: python -m pip install ruff==0.16.9 + - name: Run tests and linters run: | #!/bin/sh -e @@ -35,4 +38,4 @@ jobs: ${PREFIX}black photoshop --check ${PREFIX}isort --check-only photoshop - ${PREFIX}flake8 photoshop --max-line-length 120 + ruff check photoshop diff --git a/.hound.yml b/.hound.yml deleted file mode 100644 index faeeeeb9..00000000 --- a/.hound.yml +++ /dev/null @@ -1,8 +0,0 @@ -python: - enabled: true - -flake8: - enabled: true - config_file: .flake8 - -fail_on_violations: true diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index c205a4ef..00000000 --- a/.pylintrc +++ /dev/null @@ -1,7 +0,0 @@ -# Generated Pylint configuration file that disables default output tables. - -[MESSAGES CONTROL] -disable=RP0001,RP0002,RP0003,RP0101,RP0401,RP0402,RP0701,RP0801,C0103,R0903 - -[REPORTS] -output-format=text diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1ccbd628..00000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: python -python: - - "3.8" - - "3.9" - - "3.10" -before_script: - - pip install poetry - - poetry install -script: - - poetry run codecov - -cache: pip -before_cache: - - rm -f $HOME/.cache/pip/log/debug.log diff --git a/pyproject.toml b/pyproject.toml index 6c29e7bc..c0f7419e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,3 +110,33 @@ force_single_line = true # All project unrelated unknown imports belong to third-party. default_section = "THIRDPARTY" skip_glob = "*/docs/conf.py" + +# Linting lives here and nowhere else. This replaces the deleted .flake8, which +# flake8 could not express in pyproject.toml (support landed in flake8 5). +[tool.ruff] +line-length = 120 +target-version = "py38" +extend-exclude = [ + "docs/source/conf.py", + "old", + "build", + "dist", + "venv", + "docs", + "examples", + "test", +] + +[tool.ruff.lint] +# Behaviour-preserving port of .flake8. The old file also configured +# flake8-docstrings (google) and flake8-quotes, but neither plugin was installed +# in CI, so only pycodestyle/pyflakes rules ever fired. Quote rules are enabled +# here because the codebase already satisfies them; the docstring rules are not, +# see the migration PR for the measured violation count. +select = ["E", "W", "F", "Q"] + +[tool.ruff.lint.flake8-quotes] +inline-quotes = "double" +multiline-quotes = "double" +docstring-quotes = "double" +avoid-escape = true