Skip to content

feat: add native linting mode and version mapping infrastructure#93

Merged
zeitlinger merged 15 commits intomainfrom
feat/native-linters
Mar 11, 2026
Merged

feat: add native linting mode and version mapping infrastructure#93
zeitlinger merged 15 commits intomainfrom
feat/native-linters

Conversation

@zeitlinger
Copy link
Copy Markdown
Member

Summary

  • Add --native flag to super-linter.sh for fast local dev feedback — runs a subset of linters directly on the host using the same super-linter.env config
  • Add --full flag to lint all files instead of only changed files (both native and container modes)
  • Add lint hint on failure suggesting mise run fix
  • Add setup tasks (setup:native-lint-tools, setup:update-super-linter-versions) for installing and managing native lint tool versions matching the pinned super-linter release
  • Add super-linter-versions/ directory with TOML version mappings consumed by mise install -E
  • Switch flint's own super-linter.env to allow-list pattern as a role model for consuming repos

Native mode details

Native mode parses super-linter.env and follows the same VALIDATE_/FIX_ logic as super-linter. Supported linters: shellcheck, shfmt, markdownlint, prettier, editorconfig-checker, actionlint, hadolint, golangci-lint, ruff, codespell, biome. Unsupported VALIDATE_* flags are warned about. Missing tools are skipped with a warning.

Test plan

  • Run mise run lint:super-linter -- --native on flint itself
  • Run mise run lint:super-linter -- --native --full to verify full-file mode
  • Run mise run lint:super-linter -- --native --autofix to verify fix mode
  • Test in a consuming repo by pointing mise.toml to this branch
  • Verify container mode still works (mise run lint:super-linter)
  • Verify mise run setup:update-super-linter-versions extracts correct versions

- Add --native flag to super-linter.sh for fast local dev feedback
  (subset of linters, changed files only, same env file config)
- Add --full flag to lint all files instead of only changed files
- Add lint hint on failure suggesting `mise run fix`
- Add setup tasks for installing native lint tools (mise -E)
- Add version extraction script for super-linter tool versions
- Switch flint's own super-linter.env to allow-list pattern
- Cache file list per native run to avoid repeated git commands
- Warn about unsupported VALIDATE_* flags in native mode
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Copilot AI review requested due to automatic review settings March 6, 2026 12:17
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Add pre-commit and setup:pre-commit-hook tasks that use native
linting with autofix for fast pre-commit feedback. Document
setup for both flint and consuming repos.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Previously skipped tools were only shown when another linter
failed, making it easy to miss that tools like shfmt weren't
installed.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a “native” execution path to the existing lint:super-linter task so developers can run a subset of Super-Linter-equivalent checks directly on the host, and introduces a version-mapping mechanism (via super-linter-versions/*.toml) to install matching native tool versions with mise.

Changes:

  • Add --native (host-run subset) and --full (lint all files) flags to tasks/lint/super-linter.sh, plus a lint failure hint pointing to mise run fix.
  • Add setup tasks/scripts to fetch/install native linter tool versions aligned with the pinned Super-Linter image.
  • Switch this repo’s super-linter.env to an allow-list style and add an initial Super-Linter version mapping TOML.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tasks/lint/super-linter.sh Implements --native mode, --full support, env parsing, and shared exit hint behavior.
tasks/setup/native-lint-tools.sh Downloads a version mapping TOML and installs matching native lint tools via mise.
tasks/setup/update-super-linter-versions.sh Generates super-linter-versions/<version>.toml from the upstream Super-Linter repo.
super-linter-versions/v8.4.0.toml Initial tool-version mapping for the pinned Super-Linter release.
mise.toml Adds tasks for native linting and setup/version generation.
README.md Documents native mode behavior and supported linters.
AGENTS.md Updates agent guidance to mention native mode behavior.
.github/config/super-linter.env Converts to allow-list VALIDATE_*=true configuration.
.gitignore Ignores locally-generated .mise.super-linter-*.toml files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tasks/lint/super-linter.sh
Comment thread README.md
Comment thread AGENTS.md Outdated
Comment thread tasks/lint/super-linter.sh Outdated
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
- Use mapfile for cached file list (robust for edge cases)
- Wire golangci-lint to diff mode via --new-from-rev
- Document --full flag in README and AGENTS.md
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
Copy link
Copy Markdown
Member Author

zeitlinger commented Mar 6, 2026

Hey @martincostello 👋 Your friendly neighborhood AI here — I've been busy adding native linting mode to super-linter.sh so humans can get faster local feedback without waiting for the container. Also snuck in a pre-commit hook and version mapping infrastructure. Would appreciate your eyes on this when you get a chance!

@zeitlinger zeitlinger closed this Mar 6, 2026
@zeitlinger zeitlinger reopened this Mar 6, 2026
The config change detection in links.sh treated any mise.toml
modification as a config change, triggering a full link check.
This caused unnecessary 429 rate limiting on Renovate branches
that only bump tool versions.

Now mise.toml is checked content-aware: only lychee-related
lines (version or task config) trigger a full check. Also
lower max_concurrency from 4 to 1 to reduce GitHub rate
limiting on legitimate full checks.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
This reverts commit d46b342.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Comment thread README.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will renovate keep this file fresh?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a generate-super-linter-versions.yml workflow that triggers on Renovate branch pushes when mise.toml changes. It checks if SUPER_LINTER_VERSION was bumped, regenerates the version mapping, and commits it back to the branch — same pattern as generate-protobuf.yml in client_java.

Comment thread tasks/lint/super-linter.sh Outdated
Comment thread tasks/setup/native-lint-tools.sh Outdated
- Convert supported native linters to bullet list (README.md)
- Add workflow to regenerate version mapping on Renovate bumps
- Refactor _find_files to use array params, eliminating 2 SC2086 suppressions
- Add comment explaining why FLINT_REF defaults to main
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Comment thread .github/workflows/generate-super-linter-versions.yml Outdated
Comment thread README.md Outdated
Comment thread tasks/setup/native-lint-tools.sh Outdated
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Instead of defaulting to main, extract the flint commit SHA
from task file URLs in the consuming repo's mise.toml. Falls
back to main for flint itself where tasks are local paths.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
Copy link
Copy Markdown
Member Author

@martincostello please check again

…ile in flint

Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@martincostello
Copy link
Copy Markdown
Member

I was waiting on https://github.com/grafana/grafana-renovate-config/pull/65 so we can drop the new workflow.

@zeitlinger
Copy link
Copy Markdown
Member Author

I was waiting on grafana/grafana-renovate-config#65 so we can drop the new workflow.

OK - I thought we'd no that as a follow-up.
I'm just trying to decide if it's worth waiting for the release.

Pull out generate-super-linter-versions.yml into a follow-up PR.
Until Renovate postUpgradeTasks support lands, document the manual
step for regenerating version mappings after super-linter bumps.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger zeitlinger force-pushed the feat/native-linters branch from 6bec445 to 0980507 Compare March 11, 2026 12:21
@zeitlinger
Copy link
Copy Markdown
Member Author

@martincostello Pulled out the auto-generation workflow into a follow-up PR (#102) as discussed. This PR now has a RELEASING.md with the manual step for regenerating version mappings after super-linter bumps. #102 will replace that with automation once grafana/grafana-renovate-config#65 lands.

@zeitlinger zeitlinger merged commit 24b06da into main Mar 11, 2026
7 checks passed
@zeitlinger zeitlinger deleted the feat/native-linters branch March 11, 2026 12:28
zeitlinger pushed a commit that referenced this pull request Mar 11, 2026
🤖 I have created a release *beep* *boop*
---


## [0.8.0](v0.7.1...v0.8.0)
(2026-03-11)


### Features

* add native linting mode and version mapping infrastructure
([#93](#93))
([24b06da](24b06da))


### Bug Fixes

* add 'mise run fix' hint to lint failure output
([#90](#90))
([5b4ad5d](5b4ad5d))
* improve link checker reliability against GitHub rate limiting
([#95](#95))
([7a5282d](7a5282d))
* remap same-repo GitHub URLs to local file paths
([#100](#100))
([b4feadd](b4feadd))

---
> [!IMPORTANT]
> Close and reopen this PR to trigger CI checks.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
zeitlinger added a commit that referenced this pull request Mar 30, 2026
Resolve conflicts after #93 merge, taking main's evolved versions
for native linting (env var propagation, mise env activation,
stricter missing-tool handling) while keeping the automation
workflow description in RELEASING.md.
zeitlinger pushed a commit that referenced this pull request Apr 13, 2026
## flint v0.20.0 — Rust rewrite

flint has been rewritten from scratch in Rust. The bash + Docker stack
is replaced by a fast, cross-platform native binary with no container
dependency.

### Highlights

- **Native binary** — no Docker, no bash wrappers; runs anywhere mise
can install a Rust crate
- **Parallel linting** — all checks run concurrently
- **Diff-aware** — only checks files changed since the merge base by
default (`--full` for everything)
- **`flint update`** — migrates obsolete `mise.toml` tool keys
automatically (e.g. `ubi:` → `github:`, `npm:markdownlint-cli` →
`npm:markdownlint-cli2`)
- **`flint hook install`** — installs a pre-commit hook without any mise
task knowledge
- **New linters**: `gofmt`, `google-java-format`, `ktlint`,
`dotnet-format`, `markdownlint-cli2`, `xmllint` (via `cargo:xmloxide`),
`license-header` (pure-Rust, no binary)
- **Windows support** — ktlint self-executing JAR handled via explicit
`java -jar` invocation

### Migration

See
[AGENTS-V2.md](https://github.com/grafana/flint/blob/main/AGENTS-V2.md)
and [README.md](https://github.com/grafana/flint/blob/main/README.md)
for full setup instructions.

Quick reference for existing consumers:

```toml
[tools]
# While installing from source (pre-crates.io release):
"cargo:https://github.com/grafana/flint" = "branch:main"

[env]
FLINT_CONFIG_DIR = ".github/config"

[tasks.lint]
run = "flint run"

[tasks."lint:fix"]
run = "flint run --fix"
```

Remove: `lint:super-linter`, `lint:links`, `lint:renovate-deps`,
`setup:native-lint-tools`, `setup:pre-commit-hook` tasks. Run `flint
update` to auto-migrate any obsolete tool keys.

> [!NOTE]
> The changelog below includes entries from the legacy v1 bash era — see
[README-V1.md](https://github.com/grafana/flint/blob/main/README-V1.md)
for v1 docs.

---

##
[0.20.0](flint-v0.19.0...flint-v0.20.0)
(2026-04-13)


### Features

* add flint v2 Rust binary
([#139](#139))
([19f2b25](19f2b25))
* add native linting mode and version mapping infrastructure
([#93](#93))
([24b06da](24b06da))
* add Renovate shareable preset for consuming repos
([#17](#17))
([8a06590](8a06590))
* consolidate link checking and add autofix flags
([#7](#7))
([086a5e9](086a5e9))
* flint update command, explicit JAR flag, v0.20.0
([#146](#146))
([b43bf52](b43bf52))
* handle line-number anchors and issue comments globally
([#56](#56))
([cf751df](cf751df))
* **links:** add GitHub URL remaps for line-number and fragment anchors
([#28](#28))
([5b59065](5b59065))
* **links:** auto-remap base-branch GitHub URLs to PR branch
([#18](#18))
([dd6cc61](dd6cc61))
* **renovate:** support SHA-pinned URLs in Renovate preset
([#21](#21))
([4fd1f28](4fd1f28))
* **super-linter:** default to slim image
([#24](#24))
([c8eeab8](c8eeab8))
* support NATIVE env var for container-free linting
([#107](#107))
([0a8193d](0a8193d))


### Bug Fixes

* activate mise environment in native lint mode
([#123](#123))
([d0fec45](d0fec45))
* add 'mise run fix' hint to lint failure output
([#90](#90))
([5b4ad5d](5b4ad5d))
* decouple version mapping generation from pinned super-linter version
([#112](#112))
([5370e77](5370e77))
* **deps:** update rust crate crossterm to 0.29
([#156](#156))
([c59ae3e](c59ae3e))
* **deps:** update rust crate similar to v3
([#160](#160))
([684be4e](684be4e))
* **deps:** update rust crate toml to v1
([#161](#161))
([3aae614](3aae614))
* **deps:** update rust crate toml_edit to 0.25
([#158](#158))
([42d9efd](42d9efd))
* exclude GitHub compare links from lychee checks
([#10](#10))
([e714608](e714608))
* fail native lint when enabled tools are missing
([#111](#111))
([163bb6b](163bb6b))
* improve link checker reliability against GitHub rate limiting
([#95](#95))
([7a5282d](7a5282d))
* include staged files in native lint file list
([#135](#135))
([34412d6](34412d6))
* **links:** add regex anchors to remap patterns
([#19](#19))
([2e17348](2e17348))
* native lint in worktrees, trust toml, use ec binary, drop isort
([#134](#134))
([8594bba](8594bba))
* **release-please:** fix footer not appearing on release PRs
([#40](#40))
([d7a55e4](d7a55e4))
* remap same-repo GitHub URLs to local file paths
([#100](#100))
([b4feadd](b4feadd))
* **renovate-deps:** forward GITHUB_TOKEN as GITHUB_COM_TOKEN
([#132](#132))
([4d6510b](4d6510b))
* replace broken release-please PR comment with docs
([#12](#12))
([817b37d](817b37d))
* run shellcheck on .bats files in native mode
([#137](#137))
([a4fd3f8](a4fd3f8))
* strip Scroll to Text Fragment anchors in link checks
([#86](#86))
([b630cdf](b630cdf))
* tighten markdownlint config for native mode
([#106](#106))
([6ef25b2](6ef25b2))
* use remap instead of exclude for issue comment anchors
([#58](#58))
([656f355](656f355))

---
> [!IMPORTANT]
> Close and reopen this PR to trigger CI checks.

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This was referenced Apr 16, 2026
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.

3 participants