From e8e49a687b00efac37b21446dd93031d080da1d5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Jan 2026 15:41:46 +0000 Subject: [PATCH 1/4] Modernize ruff configuration to follow latest guidelines - Remove target-version (now inferred from requires-python) - Replace TCH with TC (renamed rule set) - Remove ASYNC1 (merged into ASYNC) - Remove deprecated/removed rules from ignore: ANN101, E111, E114, E117, W191 - Remove duplicate S603 and unused COM812/COM819 from ignore - Add new rule sets: DOC (pydoclint), PYI (flake8-pyi), PD (pandas-vet) - Move LOG rule to alphabetical order - Remove deprecated flake8-annotations options: mypy-init-return, suppress-none-returning - Add DOC to per-file-ignores for tests - Fix typo: "rulues" -> "rules" in comment --- pyproject.toml | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 833335d..ee6fcb3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,7 +65,6 @@ namespaces = false [tool.ruff] line-length = 120 -target-version = 'py310' [tool.ruff.lint] @@ -77,10 +76,9 @@ select = ['F', # pyflakes 'N', # pep8-naming 'D', # pydocstyle 'UP', # pyupgrade - 'YTT', # flake-2020 + 'YTT', # flake8-2020 'ANN', # flake8-annotations 'ASYNC', # flake8-async - 'ASYNC1', # flake8-trio 'S', # flake8-bandit 'BLE', # flake8-blind-except 'FBT', # flake8-boolean-trap @@ -94,8 +92,10 @@ select = ['F', # pyflakes 'FA', # flake8-future-annotations 'ISC', # flake8-implicit-str-concat 'ICN', # flake8-import-conventions + 'LOG', # flake8-logging 'G', # flake8-logging-format 'PIE', # flake8-pie + 'PYI', # flake8-pyi 'PT', # flake8-pytest-style 'Q', # flake8-quotes 'RSE', # flake8-raise @@ -104,43 +104,36 @@ select = ['F', # pyflakes 'SLOT', # flake8-slots 'SIM', # flake8-simplify 'TID', # flake8-tidy-imports - 'TCH', # flake8-type-checking + 'TC', # flake8-type-checking 'INT', # flake8-gettext 'ARG', # flake8-unused-arguments 'PTH', # flake8-use-pathlib 'TD', # flake8-todos 'FIX', # flake8-fixme 'ERA', # eradicate + 'PD', # pandas-vet 'PL', # pylint 'TRY', # tryceratops 'FLY', # flynt 'NPY', # numpy specific rules 'PERF', # perflint 'FURB', # refurb - 'LOG', # flake8-logging + 'DOC', # pydoclint 'RUF', # ruff-specific rules ] -ignore = ['ANN101', # missing-type-self - 'D203', # one-blank-line-before-class - 'D212', # multi-line-summary-first-line +ignore = ['D203', # one-blank-line-before-class + 'D212', # multi-line-summary-first-line 'S603', # subprocess-without-shell-equals-true - # Ignore rulues below are actually to prevent conflicts between formatting and linting (with fixing) + # Ignore rules below to prevent conflicts between formatting and linting (with fixing) # cf. https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules - 'COM812', # missing-trailing-comma - 'COM819', # prohibited-trailing-comma 'D206', # indent-with-spaces - 'E111', # indentation-with-invalid-multiple - 'E114', # indentation-with-invalid-multiple-comment - 'E117', # over-indented 'ISC001', # single-line-implicit-string-concatenation 'ISC002', # multi-line-implicit-string-concatenation 'Q000', # bad-quotes-inline-string 'Q001', # bad-quotes-multiline-string 'Q002', # bad-quotes-docstring 'Q003', # avoidable-escaped-quote - 'S603', # subprocess-without-shell-equals-true - 'W191', # tab-indentation ] [tool.ruff.format] @@ -151,14 +144,12 @@ skip-magic-trailing-comma = false [tool.ruff.lint.per-file-ignores] -'tests/python/*.py' = ['S101', 'SLF001', 'PLR0913', 'PLR2004', 'D'] +'tests/python/*.py' = ['S101', 'SLF001', 'PLR0913', 'PLR2004', 'D', 'DOC'] [tool.ruff.lint.flake8-annotations] allow-star-arg-any = true ignore-fully-untyped = true -mypy-init-return = true suppress-dummy-args = true -suppress-none-returning = true [tool.ruff.lint.flake8-quotes] docstring-quotes = 'double' From ce906ec0af2814511a852e7c784f0f18242c27b7 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Jan 2026 15:46:30 +0000 Subject: [PATCH 2/4] Add additional ruff ignores and remove unused blacken-docs - Add ANN204, DOC201, DOC501 to global ignore list (too strict for codebase) - Add PYI024 to test file ignores - Fix DOC102: remove documented param 'namespace' not in function signature - Remove blacken-docs hook (no Python code blocks in documentation) --- .pre-commit-config.yaml | 7 ------- cmake_pc_hooks/_argparse.py | 1 - pyproject.toml | 5 ++++- 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04bf9b2..4ecae01 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,13 +50,6 @@ repos: hooks: - id: yamllint - - repo: https://github.com/asottile/blacken-docs - rev: 1.20.0 - hooks: - - id: blacken-docs - args: [-S, -l, '120'] - additional_dependencies: [black==22.12.0] - - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.14.10 hooks: diff --git a/cmake_pc_hooks/_argparse.py b/cmake_pc_hooks/_argparse.py index 7cf2312..205940d 100644 --- a/cmake_pc_hooks/_argparse.py +++ b/cmake_pc_hooks/_argparse.py @@ -126,7 +126,6 @@ def _load_data_from_toml( elements (ie. no nested sections). Args: - namespace: Namespace to store results into path: Path to TOML file section: Name of section to load in TOML file path_must_exist: Whether a missing TOML file is considered an error or not diff --git a/pyproject.toml b/pyproject.toml index ee6fcb3..ffc948d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,6 +125,9 @@ select = ['F', # pyflakes ignore = ['D203', # one-blank-line-before-class 'D212', # multi-line-summary-first-line 'S603', # subprocess-without-shell-equals-true + 'ANN204', # missing-return-type-special-method (__init__, __new__, etc.) + 'DOC201', # return-not-documented (too strict for existing codebase) + 'DOC501', # raised-exception-not-documented (too strict for existing codebase) # Ignore rules below to prevent conflicts between formatting and linting (with fixing) # cf. https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules 'D206', # indent-with-spaces @@ -144,7 +147,7 @@ skip-magic-trailing-comma = false [tool.ruff.lint.per-file-ignores] -'tests/python/*.py' = ['S101', 'SLF001', 'PLR0913', 'PLR2004', 'D', 'DOC'] +'tests/python/*.py' = ['S101', 'SLF001', 'PLR0913', 'PLR2004', 'D', 'DOC', 'PYI024'] [tool.ruff.lint.flake8-annotations] allow-star-arg-any = true From 0f3629416e5d2a492cc4ba19e724d3c5243462ba Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Jan 2026 15:49:17 +0000 Subject: [PATCH 3/4] Add blacken-docs with ruff as formatter Configure blacken-docs to use ruff instead of black for formatting Python code blocks in documentation files. --- .pre-commit-config.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4ecae01..6e88938 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -50,6 +50,13 @@ repos: hooks: - id: yamllint + - repo: https://github.com/asottile/blacken-docs + rev: 1.19.1 + hooks: + - id: blacken-docs + args: [--line-length=120] + additional_dependencies: [ruff>=0.14.0] + - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.14.10 hooks: From 6d40b0233cbec260d5b5f4cd89ccd00659f9dc3f Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Jan 2026 15:52:04 +0000 Subject: [PATCH 4/4] Add changelog entry for ruff configuration modernization --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0bba04..0445305 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Repository - Fixed Windows CI by using pip to install cppcheck (Chocolatey package is broken) +- Modernize ruff configuration to follow latest guidelines + - Remove deprecated settings (`target-version`, `ANN101`, `ASYNC1`, etc.) + - Replace `TCH` with `TC` (renamed rule set) + - Add new rule sets: `DOC`, `PYI`, `PD` + - Configure `blacken-docs` to use ruff instead of black - Clarify where to put the settings in `pyproject.toml` - Update GitHub Action `actions/download-artifact` to v4 @@ -33,7 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Update `github.com/codespell-project/codespell` hook to v2.4.1 - Update `github.com/shellcheck-py/shellcheck-py` hook to v0.11.0.1 - Update `github.com/adrienverge/yamllint.git` hook to v1.37.1 -- Update `github.com/asottile/blacken-docs` hook to 1.20.0 +- Update `github.com/asottile/blacken-docs` hook to 1.19.1 - Update `github.com/astral-sh/ruff-pre-commit` hook to v0.14.10 ## [v1.9.6] - 2024-06-02