wemake-python-styleguide icon indicating copy to clipboard operation
wemake-python-styleguide copied to clipboard

Enforce constants to be SCREAMING_SNAKE_CASE

Open orsinium opened this issue 4 years ago • 5 comments

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 avatar Feb 18 '21 12:02 orsinium