Skip to content

ref: Introduce linter for proper naming conventions #636

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

Merged
merged 2 commits into from
Mar 16, 2020

Conversation

untitaker
Copy link
Member

No description provided.

@untitaker untitaker requested a review from rhcarvalho February 27, 2020 11:32
@@ -59,12 +59,12 @@ def reraise(tp, value, tb=None):

def with_metaclass(meta, *bases):
# type: (Any, *Any) -> Any
class metaclass(type):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might not be remembering well, but I thought class metaclass was common practice?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't know. Are you saying that metaclasses are supposed to be snakecase?

@@ -106,99 +106,101 @@ def process_event(event, hint):


class SparkListener(object):
def onApplicationEnd(self, applicationEnd):
def onApplicationEnd(self, applicationEnd): # noqa: N802,N803
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe apply this to the whole class or module/file?
Doing it per method is very noisy :(

Also could we have a note like "# noqa: ...; ignore camelCase in methods names and attributes because this code is inherited from somewhere..."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure how to specify it on a class level. I would like to avoid doing it on a module level for sure asssuming we do not restructure the modules.

.flake8 Outdated
B014 // does not apply to Python 2
B014, // does not apply to Python 2
N812, // i don't care
N804 // conflicts with B902
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a link to https://pypi.org/project/pep8-naming/?

Would be easier to figure out what the codes mean. A quick note on their meaning wouldn't hurt either?!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I will look into how to document this better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated all the docs but couldn't figure out how to truly reference lints by name

@untitaker untitaker merged commit 03a5e65 into master Mar 16, 2020
@untitaker untitaker deleted the ref/naming-rules-linter branch March 16, 2020 11:36
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

Successfully merging this pull request may close these issues.

2 participants