Skip to content

chore: migrate from super-linter to flint v2#1988

Draft
zeitlinger wants to merge 11 commits intoprometheus:mainfrom
zeitlinger:feat/flint-v2
Draft

chore: migrate from super-linter to flint v2#1988
zeitlinger wants to merge 11 commits intoprometheus:mainfrom
zeitlinger:feat/flint-v2

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

@zeitlinger zeitlinger commented Apr 8, 2026

Blocked by grafana/flint#139

Summary

  • Replaces lint:super-linter, lint:links, and lint:renovate-deps tasks with a single flint run invocation
  • Adds google-java-format via ubi:google/google-java-format (activates the formatter automatically)
  • Adds standard lint tools: shellcheck, shfmt, prettier, markdownlint-cli2, actionlint, editorconfig-checker, codespell, ruff
  • Creates .github/config/flint.toml with path exclusions (docs/themes/, src/main/generated/, mvnw) and migrates RENOVATE_TRACKED_DEPS_EXCLUDE[checks.renovate-deps] exclude_managers
  • spotless/Maven checkstyle unchanged — flint does not replace those

Test plan

  • CI lint job passes
  • flint run --fix renovate-deps run locally to generate renovate-tracked-deps.json (will fail on first CI run until this is committed)
  • Verify google-java-format version 1.26.0 resolves via ubi

Replace super-linter, lint:links, and lint:renovate-deps with a single
flint run invocation. Add google-java-format and standard lint tools
(shellcheck, shfmt, prettier, markdownlint-cli2, actionlint,
editorconfig-checker, codespell, ruff) to mise.toml.

flint.toml excludes docs/themes/ (Hugo theme), src/main/generated/
(generated code), and mvnw (generated Maven wrapper with known
shellcheck issues). renovate-deps exclude_managers migrated from the
former RENOVATE_TRACKED_DEPS_EXCLUDE env var.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
exclude_paths uses prefix matching from the project root, so
"src/main/generated/" did not match the nested path
"prometheus-metrics-exposition-formats/src/main/generated/".
Switch to exclude (regex, substring match) which works for any depth.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
- .markdownlint.json: disable MD013/MD031/MD033/MD036 (line length,
  fences, inline HTML, emphasis-as-heading — all pre-existing in docs)
- .codespellrc: ignore nd/atmost/re-use/errorprone (false positives in
  Java identifiers and comments)
- .editorconfig: extend workflow exemption to all .github/workflows/*.yml
  at 300 chars; add CODE_OF_CONDUCT.md to high-limit group
- .editorconfig-checker.json: explicitly exclude *.java (handled by
  google-java-format via defer_to_formatters, belt-and-suspenders)
- flint.toml: add simpleclient-archive/ to exclude_paths
- SpanContext.java: fix Examplar → Exemplar typo
- renovate-tracked-deps.json: regenerated (pretty-print normalisation)
- java-version-matrix-tests.yml: prettier quote normalisation
- Metrics.java: google-java-format string split normalisation
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…markdownlint config

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…ithub: backend

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…ormat via flint

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
…tless removal

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Adds cargo:xmloxide which installs the xmllint binary — validates
well-formedness of all *.xml files (pom.xml, version-rules.xml, etc.).

Also migrates flint.toml from the old exclude/exclude_paths fields to
the new single glob list format (required by current flint v2).

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
zeitlinger added a commit to grafana/flint that referenced this pull request Apr 10, 2026
## Summary

Introduces the `flint` Rust binary: a mise-native lint orchestrator that
replaces the v1 bash task scripts.

**How it works**: reads installed tools from `mise.toml`, maps them to a
built-in check registry, runs checks against changed files (merge-base
diff) in parallel. Special checks (lychee links, renovate-deps) are
implemented in Rust.

## File breakdown

282 files changed — the count is misleading without context:

| Category | Files |
|---|---|
| `tests/` — e2e test fixtures (70 test cases × ~3-4 files each) | 248 |
| `src/` — Rust source | 13 |
| Config, docs, CI, Cargo | 21 |

The 23 linters covered by e2e tests: actionlint, biome, biome-format,
cargo-clippy, cargo-fmt, codespell, dotnet-format, editorconfig-checker,
gofmt, golangci-lint, google-java-format, hadolint, ktlint,
license-header, lychee, markdownlint-cli2, prettier, renovate-deps,
ruff, ruff-format, shellcheck, shfmt, plus general cases.

## What's not in this PR

**Deferred features:**
- `flint hook install` — installs a git pre-commit hook; replaces the
per-repo `mise run setup:pre-commit-hook` task with something
self-contained in the CLI
- `check_task` / `fix_task` in `flint.toml` — allows a fast script (e.g.
regex/Python) as the check with a slow canonical fixer (e.g. Gradle);
motivating use case: javaagent's `StaticImportFormatter`
- Biome config injection — `--config-path` takes a directory, not a
file; needs a directory-injection variant in the registry API

**Low-priority linters** (no consuming repo needs them yet):
- `merge-conflict-markers` — pure-Rust special check
- `dotenv-linter`, `go-mod-tidy`, `xmllint`

**Post-merge:**
- Bash task scripts (`tasks/lint/`) — retire once consumer PRs are
merged
- GitHub release / `github:grafana/flint` registration — cut after this
PR merges; consumer repos switch from branch tracking to a pinned
version

## Consumer migration status

All 7 consumer PRs green — validated across Rust, Go, Java, Kotlin,
Python, .NET, Shell, Dockerfile:

- grafana/mox [#63](grafana/mox#63)
- grafana/oats [#272](grafana/oats#272)
- grafana/otel-checker
[#267](grafana/otel-checker#267)
- grafana/grafana-opentelemetry-java
[#1251](grafana/grafana-opentelemetry-java#1251)
- grafana/docker-otel-lgtm
[#1243](grafana/docker-otel-lgtm#1243)
- prometheus/client_java
[#1988](prometheus/client_java#1988)
- open-telemetry/opentelemetry-java-instrumentation
[#17759](open-telemetry/opentelemetry-java-instrumentation#17759)

## Test plan

- [x] CI passes
- [x] `flint list` shows all registry entries with correct
installed/missing status
- [x] All 7 consumer PRs pass CI

Release-As: 0.20.0

---------

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant