feat: add flint setup preflight migrations#233
Conversation
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR introduces a new internal flint-setup preflight check to own Flint-managed repository setup state (setup versioning, key migrations, and canonical mise.toml layout) and runs it before other linters.
Changes:
- Add
setup_version+ versioned setup migrations, withflint-setupas an always-on preflight check that can fix setup drift. - Move one-to-one tool key replacements into registry metadata and expand normalization of
mise.tomltool ordering /# Lintersgrouping into the setup preflight. - Add
flint init --flint-rev <git-rev>to pin Flint via a cargo git revision for prerelease validation, and update docs/tests accordingly.
Reviewed changes
Copilot reviewed 44 out of 44 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cases/shellcheck/sourced-file/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/shellcheck/failure/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/shellcheck/config-dir/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/shellcheck/clean/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/renovate-deps/fast-only-relevant/files/mise.toml | Add # Linters grouping in fixture. |
| tests/cases/renovate-deps/fast-only-irrelevant/files/mise.toml | Add # Linters grouping in fixture. |
| tests/cases/general/update-obsolete-key/test.toml | Adjust expected mise.toml output (header/grouping changes). |
| tests/cases/general/update-no-op/test.toml | Update flint update no-op output expectation. |
| tests/cases/general/unsupported-alternate-config/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/time-flag/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/list/test.toml | Update linter list output expectations (new flint-setup, built-in binary display). |
| tests/cases/general/init-rust/test.toml | Update init expectations: setup_version in flint.toml and tool ordering. |
| tests/cases/general/exclude-paths/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/env-var-exclude/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/baseline-new-linter/changes/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/baseline-flint-settings-change/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/baseline-excluded-config-change/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/baseline-config-change/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/auto-review-unfixable/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/auto-review-two-linters/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/general/auto-fix-and-review/files/mise.toml | Update ShellCheck tool key to canonical GitHub backend in fixture. |
| tests/cases/editorconfig-checker/formatter-exclusion/files/mise.toml | Add # Linters grouping in fixture. |
| src/setup.rs | Introduce setup version constants, migration lists, and guard tests. |
| src/runner.rs | Add PreparedCheck::FlintSetup and integrate running it before other checks. |
| src/registry/types.rs | Add SpecialCheck metadata, tool-key migration metadata, and install_key() helper. |
| src/registry/tests.rs | Add tests for ShellCheck aliasing, tool-key migrations, optional ec config, and Flint pin detection. |
| src/registry/obsolete.rs | Rework obsolete/unsupported key handling to combine setup + registry migrations. |
| src/registry/mod.rs | Export new obsolete/unsupported key helpers; expand known Flint tool keys. |
| src/registry/mise.rs | Treat cargo-backed Flint pins as version identities for baseline expansion. |
| src/registry/checks.rs | Register flint-setup, migrate tool keys via registry metadata, and update special-check constructors. |
| src/main.rs | Add --flint-rev; run flint-setup preflight early; improve binary display for built-ins. |
| src/linters/mod.rs | Export new flint_setup module. |
| src/linters/lychee.rs | Update tests to include setup_version in settings. |
| src/linters/flint_setup.rs | New setup preflight linter implementation + tests. |
| src/init/mod.rs | Thread --flint-rev through init; add setup migration application entry point; adjust update behavior. |
| src/init/migrations.rs | Split setup migrations from repo migrations and parameterize obsolete/unsupported key lists. |
| src/init/generation.rs | Move tools normalization responsibility away from many writers; update Flint self-pin behavior. |
| src/init/detection.rs | Detect obsolete keys via new dynamic obsolete list. |
| src/init/config_files.rs | Write setup_version into generated flint.toml and add write_setup_version(). |
| src/config.rs | Add setup_version to settings with default + test for missing field behavior. |
| docs/linters.md | Document the new flint-setup linter and update wrapping/formatting for long lines. |
| docs/cli.md | Document --flint-rev and adjust baseline-expansion wording for Flint pin changes. |
| README.md | Update examples and linter table to include flint-setup and ShellCheck canonical key. |
| .github/config/flint.toml | Set repo setup_version = 2. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
| exit = 1 | ||
| stderr = ''' | ||
| [dotnet-format] | ||
| [dotnet-fmt] |
There was a problem hiding this comment.
This looks a bit weird to me because the native command is dotnet format. Does it need to be changed to fmt?
There was a problem hiding this comment.
no it doesn't - I think I went a bit too far in trying to make it look similar in flint - which is actually against the goal of making it look familiar to the users
Signed-off-by: Gregor Zeitlinger <[email protected]>
Signed-off-by: Gregor Zeitlinger <[email protected]>
|
@martincostello can you check again? |
### Added - add flint setup preflight migrations ([#233](#233)) - support managed linter configs and aqua-backed tool keys ([#228](#228)) - switch xmloxide to github backend ([#229](#229)) - add taplo formatter check ([#224](#224)) - *(init)* configure line length during init ([#218](#218)) ### Fixed - support renovate v43.136.3 ([#223](#223)) - switch yaml-lint to ryl ([#226](#226)) - *(ruff)* install via github releases ([#227](#227)) - resolve init rollout regressions ([#220](#220)) ### Other - reduce fake-bin fixture coverage ([#240](#240)) - *(deps)* update dependency npm:renovate to v43.141.1 ([#221](#221)) - guard fixture case groups ([#238](#238)) - *(deps)* update dependency grafana/flint to v0.20.4 ([#235](#235)) - *(deps)* lock file maintenance ([#237](#237)) - *(deps)* update dependency mise to v2026.4.19 ([#236](#236)) - *(deps)* update rust crate json5 to v1 ([#232](#232)) - *(deps)* update taiki-e/install-action digest to 787505c ([#219](#219)) - *(deps)* update dependency grafana/flint to v0.20.3 ([#225](#225)) > [!IMPORTANT] > Close and reopen this PR to trigger CI checks. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gregor Zeitlinger <[email protected]>
Summary
Adds an internal
flint-setuppreflight check that owns Flint-managed repository setup state before other linters run.setup_versionwith explicit setup states:0for v1 bootstrap,1for the deployed v2 baseline, and2for the next setup migration state.setup_versionin existing v2flint.tomlfiles as the deployed v2 baseline (1).flint-setupbefore other active linters and exits early when setup is dirty or was fixed.mise.tomlsorting and# Lintersgrouping into the setup preflight.flint init --flint-rev <git-rev>for cargo-backed prerelease consumer validation, and makes plainflint initswitch back to the releasedgithub:grafana/flintbackend.--flint-revwrites only the cargo-backed Flint tool entry and does not add Cargo fetch environment config.shellchecktogithub:koalaman/shellcheckwhile the aqua-backed key is blocked on Windows..editorconfig-checker.jsonoptional: existing configs are still passed toec, but Flint no longer treats that JSON file as a generated baseline config.Validation
mise exec -- cargo test -qmise run lint:fixgit diff --checkclient_javavalidation from currentmainwithflint init -y --flint-rev 302c0da94a6cce98c7c770e9f63b1f9625896295followed bymise run lint:fix