Skip to content

Commit 37c7806

Browse files
authored
ci: bump flint to v0.8.0, switch to allow-list, add native lint tasks (#1945)
## Summary - Bump flint from v0.7.1 to v0.8.0 - Switch `super-linter.env` from deny-list to allow-list format (only enables: bash, editorconfig, github-actions, git-merge-conflict-markers, json-prettier, markdown, markdown-prettier, renovate, shell-shfmt, spell-codespell, xml, yaml-prettier) - Add `setup:native-lint-tools`, `pre-commit`, and `setup:pre-commit-hook` mise tasks for local native linting ## Test plan - [ ] CI passes with allow-list format - [ ] `mise run lint:super-linter -- --native` works locally --------- Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
1 parent 199f1fb commit 37c7806

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

.github/config/super-linter.env

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,23 @@ FILTER_REGEX_EXCLUDE=mvnw|src/main/generated/.*|docs/themes/.*|keystore.pkcs12|.
22
IGNORE_GITIGNORED_FILES=true
33
JAVA_FILE_NAME=google_checks.xml
44
LOG_LEVEL=ERROR
5-
# conflicts with prettier
6-
VALIDATE_BIOME_FORMAT=false
7-
# conflicts with prettier
8-
VALIDATE_BIOME_LINT=false
9-
# disable kubernetes linter - complains about resource limits, etc
10-
VALIDATE_CHECKOV=false
11-
VALIDATE_CSS=false
12-
VALIDATE_CSS_PRETTIER=false
13-
VALIDATE_DOCKERFILE_HADOLINT=false
14-
VALIDATE_GIT_COMMITLINT=false
15-
# done by maven
16-
VALIDATE_GOOGLE_JAVA_FORMAT=false
17-
# times out
18-
VALIDATE_GO_MODULES=false
19-
VALIDATE_HTML=false
20-
# done by checkstyle
21-
VALIDATE_JAVA=false
22-
# we have many duplicate code in our codebase for demo purposes
23-
VALIDATE_JSCPD=false
24-
VALIDATE_PYTHON_PYLINT=false
25-
# conflicts with black
26-
VALIDATE_PYTHON_RUFF_FORMAT=false
27-
# excluding simpleclient-archive doesn't seem to work
28-
VALIDATE_TRIVY=false
295

30-
FIX_ENV=true
31-
FIX_GITHUB_ACTIONS_ZIZMOR=true
32-
FIX_GO=true
33-
FIX_JAVASCRIPT_PRETTIER=true
34-
FIX_JSON=true
35-
FIX_JSONC=true
36-
FIX_JSONC_PRETTIER=true
6+
VALIDATE_BASH=true
7+
VALIDATE_EDITORCONFIG=true
8+
VALIDATE_GIT_MERGE_CONFLICT_MARKERS=true
9+
VALIDATE_GITHUB_ACTIONS=true
10+
VALIDATE_JSON_PRETTIER=true
11+
VALIDATE_MARKDOWN=true
12+
VALIDATE_MARKDOWN_PRETTIER=true
13+
VALIDATE_RENOVATE=true
14+
VALIDATE_SHELL_SHFMT=true
15+
VALIDATE_SPELL_CODESPELL=true
16+
VALIDATE_XML=true
17+
VALIDATE_YAML_PRETTIER=true
18+
3719
FIX_JSON_PRETTIER=true
3820
FIX_MARKDOWN=true
3921
FIX_MARKDOWN_PRETTIER=true
40-
FIX_PYTHON_BLACK=true
4122
FIX_SHELL_SHFMT=true
4223
FIX_SPELL_CODESPELL=true
4324
FIX_YAML_PRETTIER=true

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ To autofix linting issues:
5656

5757
`mise run fix`
5858

59+
### Pre-commit Hook (Optional)
60+
61+
Run `mise run setup:pre-commit-hook` to install a git pre-commit hook
62+
that auto-lints changed files before each commit.
63+
This requires native lint tools,
64+
which you can install with `mise run setup:native-lint-tools`.
65+
These are optional but catch formatting and lint issues before CI.
66+
5967
## Running Tests
6068

6169
If you're getting errors when running tests:

mise.toml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,26 @@ 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/0ac131d7832bd8964f6ca9e5af73207dca6a85ba/tasks/lint/super-linter.sh" # v0.7.1
55+
file = "https://raw.githubusercontent.com/grafana/flint/84e2d760286dead4e503315f9483a44fe872ee85/tasks/lint/super-linter.sh" # v0.8.0
5656

5757
[tasks."lint:links"]
5858
description = "Lint links"
59-
file = "https://raw.githubusercontent.com/grafana/flint/0ac131d7832bd8964f6ca9e5af73207dca6a85ba/tasks/lint/links.sh" # v0.7.1
59+
file = "https://raw.githubusercontent.com/grafana/flint/84e2d760286dead4e503315f9483a44fe872ee85/tasks/lint/links.sh" # v0.8.0
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/0ac131d7832bd8964f6ca9e5af73207dca6a85ba/tasks/lint/renovate-deps.py" # v0.7.1
63+
file = "https://raw.githubusercontent.com/grafana/flint/84e2d760286dead4e503315f9483a44fe872ee85/tasks/lint/renovate-deps.py" # v0.8.0
64+
65+
[tasks."setup:native-lint-tools"]
66+
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"
6475

6576
[tasks."lint"]
6677
description = "Run all lints"

0 commit comments

Comments
 (0)