apache / apache/lucene

Can `gradle tidy` reflow text properly when it inserts newlines?

Open
#13,766 4 comments 1 reaction 0 assignees View on GitHub
type:enhancement
Dominant language
Java
Stars
3.6k
Forks
1.4k
Avg merge
2d 11h
Merged PRs (30d)
88

Description

### Description

I'm working on #13519, and ran `gradle tidy` to ... tidy things up, and it does this:

```
// verifies it's fine to change your mind on the number of bits quantization you want for the same
// field
// in the same index by changing up the Codec. This is allowed because at merge time we
// requantize the
// vectors.
```

It's because my original line wrap was too long for its taste, which is fine. But, then it creates these widow lines with just one or two words. I can revisit and reflow to right column width, manually, but can we fix tidy to not do this? It would ideally not gleefully create widow lines like this!

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported formatting with `gradle tidy` using the long Java comment shown in the issue. Trace the tidy text reflow entry point and its existing tests, then verify that inserted newlines avoid one- or two-word widow lines while preserving the intended column width.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.