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 test for bad assignments (to self/cls) #17

Closed
skirpichev opened this issue Dec 31, 2014 · 3 comments
Closed

Add test for bad assignments (to self/cls) #17

skirpichev opened this issue Dec 31, 2014 · 3 comments

Comments

@skirpichev
Copy link

See this as an example of implementation. This will catch code like

class A:
    def foo(self, arg):
        self = arg

or

class A(object):
    @classmethod
    def foo(cls, arg):
        cls = arg

Yes, this is not a PEP 8 requirement, but there is some wrong if I should introduce new extension for naming tests just for that.

@sigmavirus24
Copy link
Member

This plugin is simply for names of functions, methods, and classes. It does not check the bodies for assignments and neither should it. Those are valid assignments in practice although they may introduce unexpected behaviour there is no reason for this plugin to squawk about them.

@skirpichev
Copy link
Author

This plugin is simply for names of functions, methods, and classes.

VariablesInFunctionCheck checks also variable names in function body, just like this test.

@sigmavirus24
Copy link
Member

I misspoke. Regardless the point stands that this is not a issue of naming but rather something better suggested for a linter not a style checker

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

No branches or pull requests

2 participants