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

Abstract class names should comply with a naming convention

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Rename this abstract class name to match the regular expression ${format}
    • List of parameters:
      Hide

      Key: format
      Description: Regular expression used to check the abstract class names against.
      Default: ^Abstract[A-Z][a-zA-Z0-9]*$
      Type:String

      Show
      Key: format Description: Regular expression used to check the abstract class names against. Default: ^Abstract [A-Z] [a-zA-Z0-9] *$ Type:String
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Covered Languages:
      Java
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      10min
    • Analysis Scope:
      Main Sources, Test Sources
    • Checkstyle:
      AbstractClassName, AbbreviationAsWordInName
    • PMD:
      AbstractNaming

      Description

      Sharing some naming conventions is a key point to make it possible for a team to efficiently collaborate. This rule allows to check that all abstract class names match a provided regular expression. If a non-abstract class match the regular expression, an issue is raised to suggest to either make it abstract or to rename it.

      Noncompliant Code Example

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

      abstract class MyClass { // Noncompliant
      }
      
      class AbstractLikeClass { // Noncompliant
      }
      

      Compliant Solution

      abstract class AbstractClass {
      }
      
      class LikeClass {
      }
      

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated: