Skip to content

Commit 9862869

Browse files
authored
ci: add native linting tasks (#1963)
## Summary - Add `lint:spotless` task for Java format checking - Add `lint:fast` grouping task (super-linter + links + bom + example-poms + spotless) - Add `native-lint` meta-task (`NATIVE=true`, no container needed) - Switch `pre-commit` to `NATIVE=true mise run lint:fast` ## Blocked on - grafana/flint#107 — `NATIVE` env var support for `lint:super-linter` - grafana/flint#112 — v8.5.0 version mapping for `setup:native-lint-tools` After those merge, update the flint SHA in `mise.toml`. ## Test plan - [ ] `mise run native-lint` passes after flint update - [ ] `mise run lint` still works in CI (container mode) - [ ] Pre-commit hook works with native linting --------- Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent 643d0e7 commit 9862869

1 file changed

Lines changed: 28 additions & 12 deletions

File tree

mise.toml

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,51 @@ run = "./mvnw install -DskipTests -Dcoverage.skip=true"
5252
# Shared lint tasks from flint (https://github.com/grafana/flint)
5353
[tasks."lint:super-linter"]
5454
description = "Run Super-Linter on the repository"
55-
file = "https://raw.githubusercontent.com/grafana/flint/84e2d760286dead4e503315f9483a44fe872ee85/tasks/lint/super-linter.sh" # v0.8.0
55+
file = "https://raw.githubusercontent.com/grafana/flint/8a39d96e17327c54974623b252eb5260d67ed68a/tasks/lint/super-linter.sh" # v0.9.1
5656

5757
[tasks."lint:links"]
5858
description = "Lint links"
59-
file = "https://raw.githubusercontent.com/grafana/flint/84e2d760286dead4e503315f9483a44fe872ee85/tasks/lint/links.sh" # v0.8.0
59+
file = "https://raw.githubusercontent.com/grafana/flint/8a39d96e17327c54974623b252eb5260d67ed68a/tasks/lint/links.sh" # v0.9.1
6060

6161
[tasks."lint:renovate-deps"]
6262
description = "Verify renovate-tracked-deps.json is up to date"
63-
file = "https://raw.githubusercontent.com/grafana/flint/84e2d760286dead4e503315f9483a44fe872ee85/tasks/lint/renovate-deps.py" # v0.8.0
63+
file = "https://raw.githubusercontent.com/grafana/flint/8a39d96e17327c54974623b252eb5260d67ed68a/tasks/lint/renovate-deps.py" # v0.9.1
6464

6565
[tasks."setup:native-lint-tools"]
6666
description = "Install native lint tools matching the pinned super-linter version"
67-
file = "https://raw.githubusercontent.com/grafana/flint/84e2d760286dead4e503315f9483a44fe872ee85/tasks/setup/native-lint-tools.sh" # v0.8.0
68-
[tasks.pre-commit]
69-
description = "Pre-commit hook: native lint with autofix"
70-
depends = ["setup:native-lint-tools"]
71-
run = "mise run lint:super-linter -- --native --autofix"
72-
[tasks."setup:pre-commit-hook"]
73-
description = "Install git pre-commit hook that runs native linting"
74-
run = "mise generate git-pre-commit --write --task=pre-commit"
67+
file = "https://raw.githubusercontent.com/grafana/flint/8a39d96e17327c54974623b252eb5260d67ed68a/tasks/setup/native-lint-tools.sh" # v0.9.1
68+
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"
74+
75+
[tasks."lint:fast"]
76+
description = "Run fast lints (no Renovate)"
77+
depends = ["lint:super-linter", "lint:links", "lint:bom", "lint:example-poms", "lint:spotless"]
7578

7679
[tasks."lint"]
7780
description = "Run all lints"
78-
depends = ["lint:super-linter", "lint:links", "lint:bom", "lint:example-poms", "lint:renovate-deps"]
81+
depends = ["lint:fast", "lint:renovate-deps"]
7982

8083
[tasks.fix]
8184
description = "Auto-fix lint issues"
8285
run = "AUTOFIX=true mise run lint"
8386

87+
[tasks.native-lint]
88+
description = "Run lints natively (no container)"
89+
run = "NATIVE=true mise run lint:fast"
90+
91+
[tasks.pre-commit]
92+
description = "Pre-commit hook: native lint"
93+
depends = ["setup:native-lint-tools"]
94+
run = "NATIVE=true mise run lint:fast"
95+
96+
[tasks."setup:pre-commit-hook"]
97+
description = "Install git pre-commit hook that runs native linting"
98+
run = "mise generate git-pre-commit --write --task=pre-commit"
99+
84100
[tasks.acceptance-test]
85101
description = "Run OATs acceptance tests"
86102
depends = "build"

0 commit comments

Comments
 (0)