Adds COP017 — immutable variables by default#5
Open
mrkaaa wants to merge 5 commits into
Open
Conversation
As a replacement for auto-typing-final
Rewrite mapping_proxy helpers with early returns instead of mutable accumulators (also drops dead Python 3.8 ast.Index handling; the package requires Python >=3.10) and make COP017 check helper arguments keyword-only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
insani7y
reviewed
Jul 9, 2026
The COP017 escape hatch is the Mutable annotation again (runtime marker exported from the package). The package now has no runtime dependencies, so importing Mutable in production code does not pull in flake8; linting installs use the [flake8] extra. The violation message includes the import instruction so code agents can fix it without extra context. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…notations Convert all check classes to dataclasses (kw_only=True, slots=True, frozen=True per COP014) with a uniform syntax_tree field, switching plugin discovery to keyword instantiation. Type COP017 scope helpers by behavior (Iterable/Sequence instead of list) and replace object with a TypeVar in the Mutable marker. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The marker now lives in its own top-level package shipped in the same wheel (uv_build multi-module), so production code imports cop_extensions.Mutable without referencing the linter package. The violation message and docs point to the new import path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
As a replacement for auto-typing-final