Affects Version/s: None
Fix Version/s: None
Python default styling convention is de facto PEP-8. Anything accepted by PEP-8 should be accepted by the few styling rules we have.
The current implementation also raises on classes which follow function name convention, i.e. snake-case in lowercase. This is allowed by PEP8:
Class names should normally use the CapWords convention.
The naming convention for functions may be used instead in cases where the interface is documented and used primarily as a callable.
We could try to make a difference between callable and non-callable classes, but we wouldn't be able to detect every case as we often miss part of the hierarchy.
Thus the simplest solution is to allow both styles and describe in the RSPEC when each style should be used. If a project needs a stricter naming its developers can change the regular expression. We will avoid making noise by default.
Here are example of False Positives
The new default regular expression should be ^_?([A-Z_][a-zA-Z0-9]*|[a-z_][a-z0-9_]*)$
Once done the RSPEC should be updated as follow:
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_]*)$: