Uploaded image for project: 'Rules Repository'
  1. Rules Repository
  2. RSPEC-101

Class names should comply with a naming convention

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Rename class "XXXX" to match the regular expression ${format}.
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Legacy Key:
      ClassName
    • Targeted languages:
      APEX
    • Covered Languages:
      ABAP, C#, C, C++, Flex, Java, JavaScript, Kotlin, Objective-C, PHP, Python, Ruby, Scala, Swift, TypeScript, VB.Net
    • Irrelevant for Languages:
      Go
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      5min
    • Analysis Level:
      Syntactic Analysis
    • Analysis Scope:
      Main Sources, Test Sources
    • Common Rule:
      Yes
    • Checkstyle:
      AbbreviationAsWordInName, TypeName
    • ESLint:
      id-length, id-match, no_underscore_dangle, new_cap
    • FindBugs:
      NM_CLASS_NAMING_CONVENTION
    • FxCop:
      IdentifiersShouldNotContainUnderscores, IdentifiersShouldBeCasedCorrectly, IdentifiersShouldHaveCorrectSuffix, IdentifiersShouldNotHaveIncorrectSuffix, IdentifiersShouldHaveCorrectPrefix, IdentifiersShouldNotHaveIncorrectPrefix
    • PMD:
      ClassNamingConventions,ShortClassName
    • Pylint:
      C0103
    • ReSharper:
      InconsistentNaming
    • SwiftLint:
      type_name
    • TSLint:
      class-name

      Description

      Shared coding conventions allow teams to collaborate effectively. This rule allows to check that all class names match a provided regular expression.

      Noncompliant Code Example

      With default provided regular expression ^[A-Z][a-zA-Z0-9]*$:

      class my_class {...}
      

      Compliant Solution

      class MyClass {...}
      

        Attachments

          Issue Links

          1.
          C-Family RSPEC-2439 Language-Specification Active Unassigned
          2.
          VB.NET RSPEC-3106 Language-Specification Active Unassigned
          3.
          PHP RSPEC-3120 Language-Specification Active Unassigned
          4.
          ABAP RSPEC-3193 Language-Specification Active Unassigned
          5.
          Flex RSPEC-3300 Language-Specification Active Unassigned
          6.
          C#: Types should be named in PascalCase RSPEC-3323 Language-Specification Active Unassigned
          7.
          Python RSPEC-3585 Language-Specification Active Unassigned
          8.
          Swift RSPEC-3586 Language-Specification Active Unassigned
          9.
          Java RSPEC-3587 Language-Specification Active Unassigned
          10.
          JavaScript RSPEC-4448 Language-Specification Active Unassigned
          11.
          Kotlin RSPEC-4700 Language-Specification Active Unassigned
          12.
          Ruby RSPEC-4745 Language-Specification Active Unassigned
          13.
          Apex RSPEC-4980 Language-Specification Active Unassigned
          14.
          Go: Type names should comply with a naming convention RSPEC-5340 Language-Specification Active Unassigned

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                freddy.mallet Freddy Mallet (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: