openrewrite / openrewrite/rewrite-static-analysis
UnnecessaryParentheses should keep line breaks
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 62
- Forks
- 112
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 40
Description
This is more a discussion.
I am applying prettier-java to my project (https://github.com/JabRef/jabref/pull/10646). It turned out best (in comparison to GJF, palantir-java, spring-java-style). It has very good review-friendly line wrapping.
UnnecessaryParentheses undoes newlines in some cases
- sb.append(
- StringUtil.quote(
+ sb.append(StringUtil.quote(
...
stringBuilder.append(
- style.getNumCitationMarkerForBibliography(citedKey).toString()
+ stringBuilder.append(style.getNumCitationMarkerForBibliography(citedKey).toString()
Is it possible to turn-off this behavior - or move that behavior to another rule (maybe "ObsoleteNewLines", "CompressCode", ...)?
Link to failing test: https://github.com/JabRef/jabref/actions/runs/6905905922/job/18789707499?pr=10646
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the UnnecessaryParentheses rule and the failing test linked in the issue. Compare the shown before-and-after formatting to determine where line breaks are removed. Done means the rule preserves those breaks or its behavior can be disabled or separated as agreed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100