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

S2757: Fix FP and change message for '=!' operators when not used in the context of multiple assignment

    Details

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

      Description

      The following code raise an issue:

      void foo(boolean b, boolean c) {
        boolean a = true;
        // ...
        a = b =! c // valid issue
        a =! b; // S2757: there is no '!=' assignment operator in Java, so the message displayed should be different
      
        i =
           +num; // FP not on same line
      
      }
      

      1. Fix FP when operators are not on same line
      2. Display the following message when issue is raised on "=!" tokens

      Add a space between "=" and "!" to avoid confusion.
      

        Attachments

          Activity

            People

            • Assignee:
              christophe.zurn Christophe Zurn
              Reporter:
              michael.gumowski Michael Gumowski
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Due:
                Created:
                Updated:
                Resolved: