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

Add mismatched parameter name #340

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add mismatched parameter name #340

wants to merge 2 commits into from

Conversation

JelleZijlstra
Copy link
Contributor

Generates a lot of false positives in pyanalyze's own tests, but I want to try it out on our internal codebase before adjusting the heuristics.

@JelleZijlstra
Copy link
Contributor Author

Possible improved heuristics:

  • Don't complain if either the target or the callee uses the name self
  • Don't complain if param names are switched (we call def f(a, b) with f(b, a))
  • Remove the case where we complain if the varname comes from an attribute, because I see some cases where we do f(SomeEnum.b, b=...).
  • Don't complain if the same variable is also passed to the expected parameter (f(a, a)).
  • Don't complain if anything (besides **kwargs) is passed to the expected parameter; this will likely cover a lot.
  • Don't complain if the expected parameter is keyword-ony
  • Don't complain if the parameter we're looking at doesn't have a default

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.

1 participant