Expose `maxLineLength` on the `googleJavaFormat` step (configurable upstream since gjf 1.37.0)
維護者通常 1 天內回覆
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 28/100
- Issue 類型
- 功能
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- groovy, java
研究方向
Start with the googleJavaFormat step implementation and its existing style, reflowLongStrings, and formatJavadoc option plumbing. Locate the Gradle and Maven configuration entry points, then run their googleJavaFormat step tests. Done means maxLineLength is exposed for google-java-format 1.37.0+, is rejected or unavailable for older versions, and is covered by both build-tool configurations.
由索引模型根據 Issue 內容生成。
描述
Summary
The googleJavaFormat step currently has no way to configure the column limit, and historically there was no way to add one: upstream hard-coded 100 columns in Formatter.MAX_LINE_LENGTH, a public static final constant that got inlined at compile time — which is why #1563 was closed back in 2023 as impossible to implement.
That upstream blocker is now gone. google-java-format v1.37.0 (released 2026-10-01) added an official --max-line-length flag, resolving google/google-java-format#425 (open since Dec 2019). The gjf maintainers describe it as an orthogonal option — it moves the column limit without changing any other layout decisions — so exposing it doesn't conflict with the "opinionated, minimal configuration" philosophy.
What the new API looks like
The hard-coded constant was removed; the limit now flows through the options object. JavaFormatterOptions.Style is now a record with a public builder that Spotless can call directly (the step already builds a JavaFormatterOptions for the existing style / reflowLongStrings / formatJavadoc settings):
JavaFormatterOptions.Style.builder()
.aosp() // or .google()
.maxLineLength(120)
.build();
(landed in 6b86849)
Requested
Expose the option on the step, gated on gjf 1.37.0+:
Gradle:
googleJavaFormat {
maxLineLength(120)
}
Maven:
<googleJavaFormat>
<version>1.37.0</version>
<maxLineLength>120</maxLineLength>
</googleJavaFormat>
Considerations
- gjf 1.29+ requires JDK 21+ to run. Spotless already applies JVM-tiered defaults for gjf (1.28.0 on JVM 17, newer on 21+), so this option would effectively require the JVM-21 tier with an explicit gjf version of 1.37.0 or newer.
- The default-version bump to 1.37.0 is currently pending in #3130.
- 1.37.0 also added
--style=google|aosp, anduseTabs/indentationMultiplierbecame programmatically settable on the same builder — potential follow-ups, not part of this request.
- 主要語言
- Java
- 星號
- 5.7k
- 分支
- 563
- 平均合併
- 2 天 11 小時
- 30 天內合併 PR
- 13
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
diffplug/spotless 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
bug
難度 4/5 3-5 天 新手友好度 43/100
diffplug/spotless#3147 · 1 個 reaction ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 28/100
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 68/100
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 35/100
維護者通常 1 天內回覆
查看 diffplug/spotless 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 78/100
aws/context-ontology-accelerator#325 ·
維護者通常 1 天內回覆
-
The README tells to run `mvn jeo:disassemble`, which fails with `No plugin found for prefix 'jeo'`未關閉
難度 1/5 1 小時以內 新手友好度 82/100
objectionary/jeo-maven-plugin#1938 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
oVirt/ovirt-engine#1219 ·
維護者通常 1 天內回覆
-
pending:code-area pending:issue-category to-triage
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
area:core bug priority:p2
難度 2/5 1-3 小時 新手友好度 82/100
aomarai/minecraft-mcp#247 ·
維護者通常 1 天內回覆