From 3b5c247f05f0529f63a18b45bf0685f9a7e5553c Mon Sep 17 00:00:00 2001 From: Krzysztof kuhy Rudnicki Date: Sat, 12 Sep 2026 19:08:23 +0200 Subject: [PATCH] music_theory: pylint --fail-under=10, scoped to source, on pylint 4.0.8 All ten import-error findings were pylint failing to find the package from the monorepo root; the init-hook puts the package dir on the path the way pytest already does, and the tests-scope ignore-paths leaves pylint grading source only (ruff keeps the tests). That alone is 10.00, so the gate can say so. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01HHCbkJWXHjtTUaqvnHRAqA --- music_theory/.pre-commit-config.yaml | 4 ++-- music_theory/pyproject.toml | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/music_theory/.pre-commit-config.yaml b/music_theory/.pre-commit-config.yaml index b33ba8c..12208c8 100644 --- a/music_theory/.pre-commit-config.yaml +++ b/music_theory/.pre-commit-config.yaml @@ -105,12 +105,12 @@ repos: - --disable-error-code=list-item - repo: https://github.com/pylint-dev/pylint - rev: v3.3.2 + rev: v4.0.8 hooks: - id: pylint args: - --rcfile=music_theory/pyproject.toml - - --fail-under=8.0 + - --fail-under=10 - --jobs=4 additional_dependencies: - pytest diff --git a/music_theory/pyproject.toml b/music_theory/pyproject.toml index aa5c0d7..e404343 100644 --- a/music_theory/pyproject.toml +++ b/music_theory/pyproject.toml @@ -81,11 +81,22 @@ color_output = true exclude = [".venv/"] [tool.pylint.main] +# The repo root on the path, so pylint resolves the package's own imports the +# same way pytest does instead of reporting import-error for them. +init-hook = "import sys; sys.path.insert(0, 'music_theory')" analyse-fallback-blocks = true persistent = true jobs = 0 py-version = "3.14" ignore = [".venv", "__pycache__"] +# Test suites intentionally use patterns (protected-access, fixture-arg +# shadowing) that don't apply to source code; ruff's per-file-ignores carry +# the equivalent exemptions, so tests stay linted -- by ruff. This is the same +# source-only pylint scope wake-alarm / diet-guard / testsAndMisc use. It has +# to be `ignore-paths`, not `ignore = ["tests"]`: `ignore` only matches the +# basename of what pylint is *given*, and pre-commit hands it explicit file +# paths, so a directory name in `ignore` never fires under the hook. +ignore-paths = ["^(.*/)?tests/.*$"] ignore-patterns = [".*\\.pyi$"] [tool.pylint.messages_control]