Shared coding conventions allow teams to collaborate effectively. This rule allows to check that all class names match a provided regular expression.
The default regular expression is based on PEP-8 standard. It allows "CapWords" convention and "snake_case" in lowercase. The "snake_case" convention is accepted by PEP-8 when the class is primarily used as a callable (ex: decorator, context manager, etc...). However the "CapWords" convention is recommended in every case.
With default provided regular expression ^_?([A-Z_][a-zA-Z0-9]*|[a-z_][a-z0-9_]*)$:
class myClass: # Noncompliant
...
class my_CONTEXT_manager: # Noncompliant
def __enter__(self):
pass
def __exit__(self, type, value, traceback):
pass
class MyClass:
...
class my_context_manager:
def __enter__(self):
pass
def __exit__(self, type, value, traceback):
pass