openrewrite / openrewrite/rewrite

Support maximum line length / column limits formatting

Open
#4,571 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
3.7k
Forks
570
Avg merge
13h 12m
Merged PRs (30d)
261

Description

What problem are you trying to solve?

Many style guides such as Google's impost maximum column limits (https://google.github.io/styleguide/javaguide.html#s4.4-column-limit). There is tooling such as Checkstyle that enforces these limits. https://checkstyle.sourceforge.io/checks/sizes/linelength.html . Automated refactoring will fail often due to changes made that trigger checkstyle and other formatting checks.

Describe the solution you'd like

Update formatters to reformat lines to conform to the line length limit.

Examples for strings as here
https://github.com/google/google-java-format/blob/098431221007a0fce1b0d213ded10948087332a4/core/src/main/java/com/google/googlejavaformat/java/StringWrapper.java#L123

Have you considered any alternatives or workarounds?

Additional context

Are you interested in contributing this feature to OpenRewrite?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read the linked google-java-format StringWrapper.java example, then locate the formatter implementations and their tests in this repository; the issue names no specific paths. Establish which formatters and line-length behavior are in scope, and verify that formatted output conforms to the requested maximum without breaking existing formatting.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.