Support local and dynamic class- and static-method decorators #8592
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.
Summary
This brings ruff's behavior in line with what
pep8-naming
already does and thus closes #8397.I had initially implemented this to look at the last segment of a dotted path only when the entry in the
*-decorators
setting started with a.
, but in the end I thought it's better to remain consistent w/pep8-naming
and doing a match against the last segment of the decorator name in any case.If you prefer to diverge from this in favor of less ambiguity in the configuration let me know and I'll change it so you would need to put e.g.
.expression
in theclassmethod-decorators
list.Test Plan
Tested against the file in the issue linked below, plus the new testcase added in this PR.