checkstyle / checkstyle/checkstyle
Allow multiline UnnecessaryParentheses
- Dominant language
- Java
- Stars
- 9.6k
- Forks
- 4.2k
- Avg merge
- 22h 23m
- Merged PRs (30d)
- 232
Description
using Adding parenthesis around multiline returns (honestly not certain all of the rules) is how prettier treats typescript and thus the prettier-plugin-java treats java. I'd like a way to be able to say allow unnecessary parentheses when multiline.
if not java 17, you should be able to use old instanceof cast pattern to get the same results
```java
public abstract class AbstractEntity> {
private boolean dirty;
private ID id;
private int version;
protected abstract boolean canEqual(AbstractEntity that);
@Override
public final boolean equals(Object other) {
if (other instanceof AbstractEntity that) {
return (
that.canEqual(this) &&
Objects.equals(this.id, that.id) &&
this.version == that.version &&
this.dirty == that.dirty
);
}
return false;
}
}
```
```xml
```
*suggested:*
```xml
```
```
com.puppycrawl.tools:checkstyle:{strictly 9.3} -> 9.3
```
Contributor guide
Research direction
Start at the UnnecessaryParentheses check entry point and review how its current configuration handles unnecessary parentheses. Use the multiline return example and the suggested allowMultiline XML property as the expected behavior; done means multiline parentheses can be allowed without disabling the check for other cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100