Details

    • Type: Language-Specification
    • Status: Active
    • Resolution: Unresolved
    • Labels:
      None
    • List of parameters:
      Hide
      • Key : format
      • Description : Regular expression used to check the class names against.
      • Default value: ^_?([A-Z_][a-zA-Z0-9]*|[a-z_][a-z0-9_]*)$
      Show
      Key : format Description : Regular expression used to check the class names against. Default value: ^_?( [A-Z_] [a-zA-Z0-9] *| [a-z_] [a-z0-9_] *)$
    • Impact:
      Unknown 'null' severity
    • Likelihood:
      Unknown 'null' severity

      Description

      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_]*)$:

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

      Compliant Solution

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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tamas.vajk Tamas Vajk (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: