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

Implement the config options for flake8-unused-arguments #1254

Closed
lovetox opened this issue Dec 15, 2022 · 8 comments · Fixed by #1261
Closed

Implement the config options for flake8-unused-arguments #1254

lovetox opened this issue Dec 15, 2022 · 8 comments · Fixed by #1261
Assignees
Labels
configuration Related to settings and configuration

Comments

@lovetox
Copy link

lovetox commented Dec 15, 2022

Hi, this is very useful check but we cant use it because it detects **kwargs / *args as unused.
I believe its not necessary to mark this unsued vars, as bei convention **kwargs / *args is in most cases expected to not be used as it acts as a catch all.
I have to say i never seen a codebase that prefixes that with underscore.

i was not able to use any of the config options

i tried

[tool.ruff.flake8-unused-arguments]
unused-arguments-ignore-variadic-names = "true"

but no luck

@charliermarsh
Copy link
Member

Yeah I can add that option. Are there others that are important to you right now?

@lovetox
Copy link
Author

lovetox commented Dec 15, 2022

I would say unused-arguments-ignore-variadic-names is the most important

Did you implement everything from that package?

Because i see no errors on overload-functions, or empty stub functions currently, which i find ok, because it makes no sense to check those, i mean both have no implementation obviously no arg will be used.

Im not sure if you implement the checks on abstract methods and dunder, but if,i probably would like to disable them.

These 2 are probably less important:

unused-arguments-ignore-lambdas
unused-arguments-ignore-nested-functions

@charliermarsh charliermarsh added the configuration Related to settings and configuration label Dec 15, 2022
@charliermarsh
Copy link
Member

Yes, we ignore overloaded and stub functions, and I think we ignore abstract methods when we can detect them (not always possible because we aren't doing deep static analysis, e.g., when extending a parent class). I'd have to review the code though.

@g-as
Copy link
Contributor

g-as commented Dec 25, 2022

@charliermarsh

Are you sure that overloaded functions are ignored?

With

import typing


@typing.overload
def concat(a: str, b: str) -> str:
    ...

@typing.overload
def concat(a: int, b: int) -> str:
    ...


def concat(a, b):
    return f"{a}{b}"

on latest ruff i'm getting

site_register/toto.py:5:12: ARG001 Unused function argument: `a`
site_register/toto.py:5:20: ARG001 Unused function argument: `b`
site_register/toto.py:9:12: ARG001 Unused function argument: `a`
site_register/toto.py:9:20: ARG001 Unused function argument: `b`

@charliermarsh
Copy link
Member

Lemme check.

@charliermarsh
Copy link
Member

I think I was mixing up unused arguments with missing type annotations.

@charliermarsh
Copy link
Member

Tracking here: #1372.

@charliermarsh
Copy link
Member

@g-as - Fixed in #1373. Will cut a new release tonight, want to fix a few more things.

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

Successfully merging a pull request may close this issue.

3 participants