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

S1481 / "Unused local variables should be removed" should raise issues on variables which are only assigned

    XMLWordPrintable

    Details

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

      Description

      In the following example, an issue should be raised on the declaration of x because its value is never used:

        public int myMethod() {
          int x = 0;
          x = 1;
          return 1;	
        }
      

        Attachments

          Activity

            People

            Assignee:
            pynicolas OLD - Pierre-Yves Nicolas
            Reporter:
            pynicolas OLD - Pierre-Yves Nicolas
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: