@@ -6,6 +6,7 @@ lychee = "0.23.0"
66node = " 24.14.0"
77"npm:renovate" = " 43.45.1"
88protoc = " 34.0"
9+ "ubi:google/google-java-format" = " 1.34.1"
910
1011[env ]
1112RENOVATE_TRACKED_DEPS_EXCLUDE =" github-actions,github-runners"
@@ -66,23 +67,29 @@ file = "https://raw.githubusercontent.com/grafana/flint/8a39d96e17327c54974623b2
6667description = " Install native lint tools matching the pinned super-linter version"
6768file = " https://raw.githubusercontent.com/grafana/flint/8a39d96e17327c54974623b252eb5260d67ed68a/tasks/setup/native-lint-tools.sh" # v0.9.1
6869
69- [tasks ."lint:spotless" ]
70- description = " Check Java formatting with Spotless"
71- # examples don't have the spotless plugin, so we exclude them via the profile.
72- # integration-tests are covered by the CI build task.
73- run = " ./mvnw com.diffplug.spotless:spotless-maven-plugin:check -P '!examples-and-integration-tests' -q"
70+ [tasks ."lint:java" ]
71+ description = " Check Java formatting (changed files only)"
72+ run = """
73+ files=$(git diff --name-only --diff-filter=d origin/main...HEAD -- '*.java')
74+ [ -z "$files" ] && exit 0
75+ google-java-format --dry-run --set-exit-if-changed $files
76+ """
7477
7578[tasks ."lint:fast" ]
7679description = " Run fast lints (no Renovate)"
77- depends = [" lint:super-linter" , " lint:links" , " lint:bom" , " lint:example-poms" , " lint:spotless " ]
80+ depends = [" lint:super-linter" , " lint:links" , " lint:bom" , " lint:example-poms" , " lint:java " ]
7881
7982[tasks ."lint" ]
8083description = " Run all lints"
8184depends = [" lint:fast" , " lint:renovate-deps" ]
8285
8386[tasks .fix ]
8487description = " Auto-fix lint issues"
85- run = " AUTOFIX=true mise run lint"
88+ run = """
89+ files=$(git diff --name-only --diff-filter=d origin/main...HEAD -- '*.java')
90+ [ -n "$files" ] && google-java-format -i $files
91+ AUTOFIX=true mise run lint
92+ """
8693
8794[tasks .native-lint ]
8895description = " Run lints natively (no container)"
0 commit comments