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

member variable names are not checked #112

Open
jauerb opened this issue Feb 5, 2019 · 7 comments
Open

member variable names are not checked #112

jauerb opened this issue Feb 5, 2019 · 7 comments

Comments

@jauerb
Copy link

jauerb commented Feb 5, 2019

member variables are not checked for compliance with naming conventions
No warnings are created for improperly named member variables like self.someVariable

@jauerb
Copy link
Author

jauerb commented Feb 21, 2019

Is there a reason we would not want this?

A simple fix I found would be to add

elif target_type is ast.Attribute:
    yield assignment_target.attr

at the end of _extract_names

In which case these would get reported as N806, but not sure if this should be a different error code.

@5j9
Copy link
Contributor

5j9 commented Feb 22, 2019

The problem is that if the member is part of another library's API, e.g. self.maxDiff = None in unittest module, then it leads to errors that are out of the control of your code-base.

@julienr
Copy link

julienr commented Apr 12, 2019

I would like this as well.

@5j9 I understand your concern about this being possibly out of your control, but would it be possible to add this as an opt-in check ?

I tried the same solution as @jauerb on a relatively large codebase at my company and we have no out-of-our-control false positive, so adding this as an opt-in would be useful for us.

I started working on patch here, would be happy to make it opt-in if there is a way to do that.

@joseguerr
Copy link

We would also enjoy to this at our company.

@sigmavirus24
Copy link
Member

It's possible to have this such that it's disabled by default. A template to follow is in #157

@joseguerr
Copy link

Thanks for the help @sigmavirus24 , should I name it N819?

@sigmavirus24
Copy link
Member

I generally think that the error codes should be better grouped (I didn't check this for N818). I'd suggest N820.

  • N80* - is related to class, function, and function argument names
  • N81* - was mostly related to changes in casing (until N818)
  • N82* - would probably be best to start for method/property/attribute naming conventions on a class although this seems related to N815 and N816.

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

5 participants