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

Static non-final field names should comply with a naming convention

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Rename this field "XXX" to match the regular expression ${format}.
    • List of parameters:
      Hide

      Key: format
      Description: Regular expression used to check the field names against.
      Default Value for Java : ^[a-z][a-zA-Z0-9]*$

      Show
      Key: format Description: Regular expression used to check the field names against. Default Value for Java : ^ [a-z] [a-zA-Z0-9] *$
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Covered Languages:
      Java
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      2min
    • Analysis Scope:
      Main Sources, Test Sources
    • Checkstyle:
      StaticVariableName

      Description

      Shared naming conventions allow teams to collaborate efficiently. This rule checks that static non-final field names match a provided regular expression.

      Noncompliant Code Example

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

      public final class MyClass {
         private static String foo_bar;
      }
      

      Compliant Solution

      class MyClass {
         private static String fooBar;
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              alexandre.gigleux Alexandre Gigleux
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated: