Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pylint] Detect nested methods correctly (PLW1641) #15032

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

InSyncWithFoo
Copy link
Contributor

Summary

Resolves #14882.

Test Plan

cargo nextest run and cargo insta test.

Copy link
Contributor

github-actions bot commented Dec 17, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

ℹ️ ecosystem check detected linter changes. (+3 -0 violations, +0 -0 fixes in 1 projects; 54 projects unchanged)

astropy/astropy (+3 -0 violations, +0 -0 fixes)

ruff check --no-cache --exit-zero --ignore RUF9 --output-format concise --preview

+ astropy/modeling/parameters.py:113:7: PLW1641 Object does not implement `__hash__` method
+ astropy/table/bst.py:90:7: PLW1641 Object does not implement `__hash__` method
+ astropy/table/column.py:1164:7: PLW1641 Object does not implement `__hash__` method

Changes by rule (1 rules affected)

code total + violation - violation + fix - fix
PLW1641 3 3 0 0 0

@MichaReiser
Copy link
Member

MichaReiser commented Dec 18, 2024

I'm a bit concerned about special casing this behavior only for PLW1641. Other rules that need to inspect a class's methods, like #14688, will now have inconsistent behavior.

I wonder if we could make this more reusable so that all class method rules could profit from it. Although I'm not quiet sure how to do that.

For example, we could create a any_method function in semantic/analyze/class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(🐞) PLW1641 not reported if method defined within if
2 participants