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

Annotation arguments should appear in the order in which they were declared

    Details

    • Type: Code Smell Detection
    • Status: Deprecated
    • Resolution: Unresolved
    • Labels:
      None
    • Message:
      Reorder these annotation arguments to match their order of declaration.
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Covered Languages:
      Java
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      2min
    • Analysis Scope:
      Main Sources, Test Sources

      Description

      For optimal code readability, annotation arguments should be specified in the same order that they were declared in the annotation definition.

      Noncompliant Code Example

      @interface Pet {
          String name();
          String surname(); 
      }
      
      @Pet(surname ="", name="") // Noncompliant
      

      Compliant Solution

      @interface Pet {
          String name();
          String surname(); 
      }
      
      @Pet(name ="", surname="") // Compliant
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                nicolas.peru Nicolas Peru
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: