Skip to content

Commit 430675e

Browse files
committed
ci: add native linting and exclude CHANGELOG.md from lint
- Add lint:spotless task for Java format checking - Add lint:fast grouping (super-linter + links + bom + example-poms + spotless) - Add native-lint task (NATIVE=true, no container needed) - Switch pre-commit to NATIVE=true mise run lint:fast - Exclude generated CHANGELOG.md from super-linter and lychee Depends on grafana/flint#107 (NATIVE env var) and grafana/flint#112 (v8.5.0 version mapping). Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent ede6ae5 commit 430675e

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

mise.toml

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ description = "build all modules without tests"
5050
run = "./mvnw install -DskipTests -Dcoverage.skip=true"
5151

5252
# Shared lint tasks from flint (https://github.com/grafana/flint)
53+
# TODO: update SHA after grafana/flint#107 and grafana/flint#112 merge
5354
[tasks."lint:super-linter"]
5455
description = "Run Super-Linter on the repository"
5556
file = "https://raw.githubusercontent.com/grafana/flint/84e2d760286dead4e503315f9483a44fe872ee85/tasks/lint/super-linter.sh" # v0.8.0
@@ -65,22 +66,38 @@ file = "https://raw.githubusercontent.com/grafana/flint/84e2d760286dead4e503315f
6566
[tasks."setup:native-lint-tools"]
6667
description = "Install native lint tools matching the pinned super-linter version"
6768
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"
69+
70+
[tasks."lint:spotless"]
71+
description = "Check Java formatting with Spotless"
72+
# examples don't have the spotless plugin, so we exclude them via the profile.
73+
# integration-tests are covered by the CI build task.
74+
run = "./mvnw com.diffplug.spotless:spotless-maven-plugin:check -P '!examples-and-integration-tests' -q"
75+
76+
[tasks."lint:fast"]
77+
description = "Run fast lints (no Renovate)"
78+
depends = ["lint:super-linter", "lint:links", "lint:bom", "lint:example-poms", "lint:spotless"]
7579

7680
[tasks."lint"]
7781
description = "Run all lints"
78-
depends = ["lint:super-linter", "lint:links", "lint:bom", "lint:example-poms", "lint:renovate-deps"]
82+
depends = ["lint:fast", "lint:renovate-deps"]
7983

8084
[tasks.fix]
8185
description = "Auto-fix lint issues"
8286
run = "AUTOFIX=true mise run lint"
8387

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

0 commit comments

Comments
 (0)