== Why is this an issue?

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.

=== Noncompliant code example

With default provided regular expression ``++^_?([A-Z_][a-zA-Z0-9]*|[a-z_][a-z0-9_]*)$++``:

[source,python]
----
class myClass:  # Noncompliant
   ...

class my_CONTEXT_manager:  # Noncompliant
    def __enter__(self):
        pass
    def __exit__(self, type, value, traceback):
        pass
----

=== Compliant solution

[source,python]
----
class MyClass:
   ...

class my_context_manager:
    def __enter__(self):
        pass
    def __exit__(self, type, value, traceback):
        pass
----

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

=== Parameters

.format
****

----
^_?([A-Z_][a-zA-Z0-9]{empty}*|[a-z_][a-z0-9_]{empty}*)$
----

Regular expression used to check the class names against.
****


'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]
