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

Enforce constants to be SCREAMING_SNAKE_CASE #1885

Open
orsinium opened this issue Feb 18, 2021 · 0 comments
Open

Enforce constants to be SCREAMING_SNAKE_CASE #1885

orsinium opened this issue Feb 18, 2021 · 0 comments
Labels
rule request Adding a new rule

Comments

@orsinium
Copy link
Collaborator

Rule request

Thesis

According to PEP-8:

Constants are usually defined on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL.

Examples:

# good
SOMETHING = 'hello'

def hello():
  # good, not a global var
  something = 'hello'

# good, not a constant
something = User()

# bad
something = 'hello'

PyLint has C0103 rule to validate it.

Reasoning

Follow PEP-8

@orsinium orsinium added the rule request Adding a new rule label Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule request Adding a new rule
Projects
None yet
Development

No branches or pull requests

1 participant