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

Warning suppression should be relevant

    XMLWordPrintable

    Details

    • Type: Code Smell Detection
    • Status: Active
    • Resolution: Unresolved
    • Labels:
    • Message:
      Remove this irrelevant "xxx", no such warning would be raised without it.
    • Highlighting:
      Hide

      the suppression annotation/marking

      Show
      the suppression annotation/marking
    • Default Severity:
      Minor
    • Impact:
      Low
    • Likelihood:
      Low
    • Default Quality Profiles:
      Sonar way
    • Targeted languages:
      Java
    • Irrelevant for Languages:
      C#, VB.Net
    • Remediation Function:
      Constant/Issue
    • Constant Cost:
      2min
    • Analysis Scope:
      Main Sources, Test Sources

      Description

      It can be useful to use in-code notation to suppress issues, but when those suppressions are no longer relevant they become a potential source of confusion and should be removed.

      Noncompliant Code Example

      @SuppressWarnings("squid:S4174") // Noncompliant
      public void doSomething() {
        final int LOCAL = 42;  // S4174 is about naming of local constants but there's nothing wrong here
      

      Compliant Solution

      public void doSomething() {
        final int LOCAL = 42;  // S4174 is about naming of local constants but there's nothing wrong here
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ann.campbell.2 Ann Campbell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: