Expose `maxLineLength` on the `googleJavaFormat` step (configurable upstream since gjf 1.37.0)
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 28/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Estancado
- Stack tecnológico
- groovy, java
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Java
- Estrellas
- 5.7k
- Forks
- 563
- Merge medio
- 2 d 11 h
- PR fusionados (30 d)
- 13
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de diffplug/spotless
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 43/100
diffplug/spotless#3147 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
Todos los issues de diffplug/spotless
Issues similares
-
area:core bug priority:p2
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
aomarai/minecraft-mcp#247 ·
Los mantenedores suelen responder en 1 día
-
help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
antonyrag/ragleap-core#1062 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Vakore/ZappierGames#232 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
constellation-app/constellation#2588 ·