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

ARG002: false negative case with locals() #6576

Closed
Olegt0rr opened this issue Aug 14, 2023 · 3 comments · Fixed by #6578
Closed

ARG002: false negative case with locals() #6576

Olegt0rr opened this issue Aug 14, 2023 · 3 comments · Fixed by #6578
Assignees
Labels
bug Something isn't working

Comments

@Olegt0rr
Copy link

ARG002 Unused method argument: bar

def foo(bar: str):
    print(locals())
@charliermarsh charliermarsh self-assigned this Aug 14, 2023
@charliermarsh
Copy link
Member

I guess PyCharm doesn't consider these unused either, so we'll remove.

@Olegt0rr
Copy link
Author

Olegt0rr commented Aug 15, 2023

pyCharm works correct with this case:
Screenshot 2023-08-15 at 10 14 33

1st bar is black, cause used by locals()
2nd bar is gray, cause unused

@dycw
Copy link

dycw commented Jul 31, 2024

Hi @charliermarsh

Is it possible to make this an option in that

  • locals() considers bar as used (the current), or
  • locals() does not consider bar as used

I am running into this as I often have an idiom

def foo(a, b, c):
    print_or_logging(locals())
    return a + b

But now I've missed the fact that c is in fact, unused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants