SonarQube Java
  1. SonarQube Java
  2. SONARJAVA-194

Rule: Useless parentheses around expressions should be removed to prevent any misunderstanding

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4
    • Component/s: Rules
    • Labels:
      None
    • Number of attachments :
      0

      Description

      This ticket should lead to the depreciation of the following rules:

      • Checkstyle: UnnecessaryParenthesesCheck
      • PMD: UnnecessaryParentheses

        Activity

        Hide
        Freddy Mallet added a comment -
        Show
        Freddy Mallet added a comment - Implements http://jira.sonarsource.com/browse/RSPEC-1110
        Hide
        Dinesh Bolkensteyn added a comment -

        Done

        Show
        Dinesh Bolkensteyn added a comment - Done
        Hide
        Dinesh Bolkensteyn added a comment -

        4,165 violations

        Show
        Dinesh Bolkensteyn added a comment - 4,165 violations
        Hide
        Fabrice Bellingard added a comment -

        The following case is detected by PMD and should be covered:

        (new String("")).toString();
        
        Show
        Fabrice Bellingard added a comment - The following case is detected by PMD and should be covered: ( new String ("")).toString();
        Hide
        Dinesh Bolkensteyn added a comment -

        As discussed, some might want to have parenthesis for that use case for clarity, whereas the goal of this rule is really to find only totally useless ones.

        Another rule could cover all these 'redundant' or 'extra' parenthesis, but I would not say that they are totally 'useless'.

        Show
        Dinesh Bolkensteyn added a comment - As discussed, some might want to have parenthesis for that use case for clarity, whereas the goal of this rule is really to find only totally useless ones. Another rule could cover all these 'redundant' or 'extra' parenthesis, but I would not say that they are totally 'useless'.

          People

          • Assignee:
            Dinesh Bolkensteyn
            Reporter:
            Freddy Mallet
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: