-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
N804 and N805 apply ignore-names
to function, rather than parameter names (self
, cls
)
#12465
Comments
Oh, I just understand that the default ignore-names contains |
Is the request that |
No, N804 should just rename @classmethod
def setUpClass(self): to @classmethod
def setUpClass(cls): |
Ok, I think I understand what you're saying: It'd be reasonable to change, but it also means that there's no way to ignore methods that do deviate from the pattern in that way. I'd be nice to get more opinions on this. Maybe @AlexWaygood? What behavior would you expect here? |
setUpClass
methodsignore-names
to function, rather than parameter names (self
, cls
)
This is an interesting question! I'd be curious to see the ecosystem results on an experimental PR that ignored It does feel a bit silly to me that we ignore N804 violations by default if the method is called Possibly we could start ignoring the setting for N804 in preview mode only, and see if anybody complains. If we do get any complaints, we could add a new dedicated setting that could be separately configured for determining the behaviour of rules like N804 that complain about parameter names rather than class or method names. |
Yeah the current behavior is strange. Though it's also strange to imagine putting |
Right, I don't think it makes sense to have N804 be disabled if N804 sees |
I want to use
N804
to correctdef setUpClass(self):
in my repository. However, I found that when the class method name issetUpClass
, no error is reported.ruff v0.5.4
https://play.ruff.rs/f96de0de-0667-4e6b-88c1-fe229ad7ca5a
I don't understand why N804 ignores
setUpClass
. There is no documentation for this behavior.The text was updated successfully, but these errors were encountered: