Skip to content

Commit 1bcb903

Browse files
authored
ci: replace Maven Checkstyle with Flint (#2341)
## Summary - use the released Flint 0.22.10 Checkstyle implementation - add Checkstyle 13.8.0 as the direct `checkstyle` mise entry - update CI to mise 2026.7.15 so that direct registry entry is available in every workflow - allow the verified `@yarnpkg/libzip` 3.2.2 release for Renovate because it was published without provenance - remove the Maven Checkstyle plugin and its obsolete skip settings so Checkstyle runs only once, through Flint - preserve the repository's previous main-source scope with narrow suppressions for test and archived Java sources - suppress `VariableDeclarationUsageDistance` for examples, where setup declarations intentionally precede simulated work Flint Checkstyle support is released in [v0.22.10](https://github.com/grafana/flint/releases/tag/v0.22.10), and this PR uses the standard `aqua:grafana/flint` backend for Flint itself. ## Testing - `mise exec -- flint run --full checkstyle` - `mise run lint:fix` - `mise run build` --------- Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent 3ad84d4 commit 1bcb903

10 files changed

Lines changed: 57 additions & 48 deletions

File tree

‎.github/renovate-tracked-deps.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@
163163
"aqua:jonwiggins/xmloxide",
164164
"aqua:owenlamont/ryl",
165165
"biome",
166+
"checkstyle",
166167
"editorconfig-checker",
167168
"google-java-format",
168169
"hugo",

‎AGENTS.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ mise run ci
1515
# Quick compile without tests or checks (fastest)
1616
mise run compile
1717

18-
# Run unit tests only (skips formatting/coverage/checkstyle)
18+
# Run unit tests only (skips formatting and coverage)
1919
mise run test
2020

2121
# Run all tests including integration tests
2222
mise run test-all
2323

2424
# Run a single test class
2525
./mvnw test -Dtest=CounterTest \
26-
-Dcoverage.skip=true -Dcheckstyle.skip=true
26+
-Dcoverage.skip=true
2727

2828
# Run a single test method
2929
./mvnw test -Dtest=CounterTest#testIncrement \
30-
-Dcoverage.skip=true -Dcheckstyle.skip=true
30+
-Dcoverage.skip=true
3131

3232
# Run tests in a specific module
3333
./mvnw test -pl prometheus-metrics-core \
34-
-Dcoverage.skip=true -Dcheckstyle.skip=true
34+
-Dcoverage.skip=true
3535

3636
# Regenerate protobuf classes (after protobuf dep update)
3737
mise run generate

‎CONTRIBUTING.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,12 @@ mise --cd .mise/envs/native run native-test
9696
### Avoid failures while running tests
9797

9898
- Use `-Dcoverage.skip=true` to skip the coverage check during development.
99-
- Use `-Dcheckstyle.skip=true` to skip the checkstyle check during development.
10099
- Use `-Dwarnings=-nowarn` to skip the warnings during development.
101100

102101
Combine all with
103102

104103
```shell
105-
./mvnw install -DskipTests -Dcoverage.skip=true \
106-
-Dcheckstyle.skip=true -Dwarnings=-nowarn
104+
./mvnw install -DskipTests -Dcoverage.skip=true -Dwarnings=-nowarn
107105
```
108106

109107
or simply

‎checkstyle-suppressions.xml‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,12 @@
2121

2222
<!-- Suppress all Javadoc checks for integration tests -->
2323
<suppress checks="Javadoc" files=".*[/\\]integration-tests[/\\].*"/>
24+
25+
<!-- Preserve the repository's main-source-only Checkstyle policy when Flint invokes the
26+
standalone CLI with explicit Java files. -->
27+
<suppress checks=".*" files=".*[/\\]src[/\\]test[/\\]java[/\\].*"/>
28+
<suppress checks=".*" files=".*[/\\]src[/\\]archive[/\\]java[/\\].*"/>
29+
30+
<!-- Example setup intentionally groups declarations before the simulated work that uses them. -->
31+
<suppress checks="VariableDeclarationUsageDistance" files=".*[/\\]examples[/\\].*"/>
2432
</suppressions>

‎checkstyle.xml‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,6 @@
4848
</module>
4949

5050
<module name="TreeWalker">
51-
<module name="RegexpSinglelineJava">
52-
<property name="format"
53-
value="(?&lt;!import static io.opentelemetry.sdk.testing.assertj.)OpenTelemetryAssertions\."/>
54-
<property name="message"
55-
value="Please statically import methods from OpenTelemetryAssertions"/>
56-
</module>
57-
<module name="RegexpSinglelineJava">
58-
<property name="format"
59-
value="(?&lt;!import static org.assertj.core.api.|OpenTelemetry)Assertions.assertThat"/>
60-
<property name="message"
61-
value="Please statically import methods from Assertions (OpenTelemetryAssertions extends Assertions)"/>
62-
</module>
6351
<module name="OuterTypeFilename"/>
6452
<module name="IllegalTokenText">
6553
<property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/>

‎mise.lock‎

Lines changed: 39 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎mise.toml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ actionlint = "1.7.12"
1212
"aqua:jonwiggins/xmloxide" = "v0.5.0"
1313
"aqua:owenlamont/ryl" = "0.21.0"
1414
biome = "2.5.8"
15+
checkstyle = "13.8.0"
1516
editorconfig-checker = "3.11.1"
1617
google-java-format = "1.36.1"
1718
lychee = "0.24.2"
@@ -48,16 +49,16 @@ run = "./mvnw clean"
4849

4950
[tasks.compile]
5051
description = "bare compile, ignoring formatting and linters"
51-
run = "./mvnw install -DskipTests -Dcoverage.skip=true -Dcheckstyle.skip=true -Dwarnings=-nowarn"
52+
run = "./mvnw install -DskipTests -Dcoverage.skip=true -Dwarnings=-nowarn"
5253

5354
[tasks.generate]
5455
description = "regenerate protobuf sources"
55-
run = "./mvnw clean install -DskipTests -Dcoverage.skip=true -Dcheckstyle.skip=true -Dwarnings=-nowarn"
56+
run = "./mvnw clean install -DskipTests -Dcoverage.skip=true -Dwarnings=-nowarn"
5657
env.PROTO_GENERATION = "true"
5758

5859
[tasks.test]
5960
description = "run unit tests, ignoring formatting and linters"
60-
run = "./mvnw test -Dcoverage.skip=true -Dcheckstyle.skip=true -Dwarnings=-nowarn"
61+
run = "./mvnw test -Dcoverage.skip=true -Dwarnings=-nowarn"
6162

6263
[tasks.test-all]
6364
description = "run all tests"
@@ -78,7 +79,6 @@ BASELINE_OVERRIDE="${API_DIFF_BASELINE_VERSION:+-Dapi.diff.baseline.version=${AP
7879
${BASELINE_OVERRIDE} \
7980
-DskipTests \
8081
-Dcoverage.skip=true \
81-
-Dcheckstyle.skip=true \
8282
-Dwarnings=-nowarn
8383
./.github/scripts/sync-api-diffs.sh
8484
"""

‎pom.xml‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
<!-- Bumped by .github/workflows/bump-api-diff-baseline.yml after each release. -->
3333
<api.diff.baseline.version>1.8.0</api.diff.baseline.version>
3434
<jacoco.line-coverage>0.70</jacoco.line-coverage>
35-
<checkstyle.skip>false</checkstyle.skip>
3635
<coverage.skip>false</coverage.skip>
3736
<javadoc.skip>false</javadoc.skip>
3837
<warnings>-Werror</warnings>
@@ -182,28 +181,6 @@
182181
</plugins>
183182
</pluginManagement>
184183
<plugins>
185-
<plugin>
186-
<groupId>org.apache.maven.plugins</groupId>
187-
<artifactId>maven-checkstyle-plugin</artifactId>
188-
<version>3.6.0</version>
189-
<configuration>
190-
<consoleOutput>true</consoleOutput>
191-
<configLocation>google_checks.xml</configLocation>
192-
<configLocation>checkstyle.xml</configLocation>
193-
<violationSeverity>warning</violationSeverity>
194-
<failOnViolation>true</failOnViolation>
195-
<skip>${checkstyle.skip}</skip>
196-
<suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
197-
<excludes>**/generated/**,**/jmh_generated/*</excludes>
198-
</configuration>
199-
<executions>
200-
<execution>
201-
<goals>
202-
<goal>check</goal>
203-
</goals>
204-
</execution>
205-
</executions>
206-
</plugin>
207184
<plugin>
208185
<groupId>org.jacoco</groupId>
209186
<artifactId>jacoco-maven-plugin</artifactId>

‎prometheus-metrics-otel-support/pom.xml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
</description>
2020

2121
<properties>
22-
<checkstyle.skip>true</checkstyle.skip>
2322
<coverage.skip>true</coverage.skip>
2423
<javadoc.skip>true</javadoc.skip>
2524
</properties>

‎prometheus-metrics-parent/pom.xml‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
</description>
1515

1616
<properties>
17-
<checkstyle.skip>true</checkstyle.skip>
1817
<coverage.skip>true</coverage.skip>
1918
<javadoc.skip>true</javadoc.skip>
2019
</properties>

0 commit comments

Comments
 (0)