checkstyle / checkstyle/checkstyle
Unnecessary Parentheses does not report violation on assignment within conditional
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 4.2k
- Avg merge
- 22h 23m
- Merged PRs (30d)
- 232
Description
Check documentation: https://checkstyle.org/config_coding.html#UnnecessaryParentheses
```
C:\Users\Shashwat\Documents>cat config.xml
C:\Users\Shashwat\Documents>cat Test.java
public class Test
{
public static void main(String[] args) {
int n=2;
if(((n=n%2))==0) // warning expected
System.out.println("yes");
}
}
C:\Users\Shashwat\Documents>javac Test.java
// no output
C:\Users\Shashwat\Documents>java -jar checkstyle-8.31-all.jar -c config.xml Test.java
Starting audit...
Audit done.
```
---------------
There is a redundant set of parentheses on line 5 which should have been reported.
Contributor guide
Assessment
This issue has not been assessed yet.