-
Notifications
You must be signed in to change notification settings - Fork 879
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
Support select/ignore list of argument names for ARG
rules
#11359
Comments
You could use |
In my case we have a dispatcher which inspects a function's signature to determine whether it should construct and send a context object. The construction of that object while not awfully slow, also isn't free. Sometimes we're able to refactor a handler function to remove the need for that context object, in which case the signature should be updated such that it never gets built or sent, Using the ARG rules to check if this consistently named argument is ever unused is very appealing. At the same time, the code base is littered with various overridden methods (but being only py3.10, we don't yet have access to Unfortunately I understand this is very edge-case-y and so I appreciate your taking the time to dig a little deeper. 🙂 |
I got to this issue after encountering it as well. While I wasn't aware of @charliermarsh suggestion to use dummy-variable-rgx which i'll definitely try, I recommend taking a look at the source of the ARG rule as they use some configuration in that flake8 project: https://github.com/nhoad/flake8-unused-arguments?tab=readme-ov-file#flake8-unused-arguments Perhaps some of that configuration could be ported for Ruff as well? Thanks in advance by the way, Ruff is amazing! |
Thanks! We do support |
Keywords:
ARG
,ARG001
,unused arguments
In cases where I have wanted to turn the ARG rules on it's typically only been certain arguments I care about policing (especially where meta-programming is involved), so it would be nice to be able to select/ignore certain argument names on which for ARG to report.
This is achievable with minor local modifications to the original flake8 plug-in, but so far as I am aware there's no low-cast way to do the same in
ruff
.The text was updated successfully, but these errors were encountered: