Uploaded image for project: 'SonarJava'
  1. SonarJava
  2. SONARJAVA-1079

S109 - Magic Numbers: add an "authorized numbers" parameter

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6
    • Component/s: Rules
    • Labels:
      None

      Description

      Original thread for the ML: http://sonarqube.15.x6.nabble.com/squid-S109-Magic-Numbers-ignore-2-td5035346.html

      The rule S109 deprecates rules MagicNumber from CheckStyle and AvoidLiteralsInIfCondition from PMD. However, the current implementation is too sensitive regarding Checkstyle's version and not enough strict regarding PMD's version.

      Authorized values by implementation:

      • Java plugin S109: -1, 0, 1
      • CheckStyle MagicNumber: -1, 0, 1, 2
      • PMD AvoidLiteralsInIfCondition: -1, 0

      In order to stay coherent, a parameter allowing to manage authorized values should be added to the rule, with default value being -1,0,1

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              michael.gumowski Michael Gumowski
              Reporter:
              m.g.sonar OLD - Michael Gumowski
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: