pyproject(ruff): Add ICN, PT, N + exception Error-suffix rename#420
Open
tony wants to merge 5 commits into
Open
pyproject(ruff): Add ICN, PT, N + exception Error-suffix rename#420tony wants to merge 5 commits into
tony wants to merge 5 commits into
Conversation
206715e to
0f25cdd
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #420 +/- ##
==========================================
+ Coverage 83.30% 83.33% +0.02%
==========================================
Files 32 32
Lines 4492 4488 -4
Branches 903 903
==========================================
- Hits 3742 3740 -2
+ Misses 499 497 -2
Partials 251 251 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
why: The codebase already follows conventional import aliasing; enabling ICN locks that convention in and flags any future drift at lint time. what: - Add "ICN" to [tool.ruff.lint].select (zero existing violations)
why: PT catches pytest anti-patterns that make fixtures leak and failures hard to localize -- finalizer-based teardown that skips on setup error, compound assertions that hide which half failed, and wide raises() blocks that can mask where the exception actually came from. what: - Add "PT" to [tool.ruff.lint].select - conftest: convert config_path/repos_path finalizers to yield teardown - Split compound assertions in test_sync_sigint/test_sync_watchdog - Narrow pytest.raises() blocks to the raising call in test_config_file, test_worktree; hoist setup/casts out of the block - Use @pytest.mark.usefixtures for the value-less _fake_sigint_escalation
why: Two public exceptions did not follow the Error-suffix naming convention (pep8-naming N818): the base VCSPullException, and MultipleConfigWarning -- which despite its name is always raised as a hard error, never a warning. Aligning both lets the N rule be enabled without per-symbol suppressions. BREAKING: `except vcspull.exc.VCSPullException` and `except vcspull.exc.MultipleConfigWarning` no longer match; catch VCSPullError / MultipleConfigError instead. No aliases are kept. what: - Rename VCSPullException -> VCSPullError and MultipleConfigWarning -> MultipleConfigError in exc.py - Update all internal references (config, cli/sync, cli/import_cmd, tests) and the exc API doc reference
why: The exception renames are breaking changes for downstream callers catching them; the changelog must flag both with a migration path before the next release. what: - Add a Breaking changes entry covering VCSPullError and MultipleConfigError with before/after except-clause guidance
why: N surfaces identifiers that drift from Python naming norms -- camelCase locals and exception classes without an Error suffix -- which hurt grep-ability and readability. Enabling it after the exception renames keeps the rule clean with no suppressions. what: - Add "N" to [tool.ruff.lint].select - Lowercase the module_funcName local in log.py (N806) - Suffix the test-local _Boom sentinel as _BoomError (N818)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adopts three additional ruff rule sets, regenerated fresh against current
master.What changed
yieldteardown, compound assertions split,pytest.raises()blocks narrowed, value-less fixture switched tousefixtures.module_funcNamelowercased, test sentinel suffixed.Breaking change
Two public exceptions were renamed with an
Errorsuffix (N818), no aliases kept:VCSPullException→VCSPullErrorMultipleConfigWarning→MultipleConfigError(it was always raised as a hard error)Update
exceptclauses accordingly. See the Breaking changes entry inCHANGES.Note
D(pydocstyle) is already enabled onmaster, so it is not part of this PR; the original branch'sDaddition and itstests/* = ["D"]ignore were dropped (the ignore would have regressed test docstring coverage).