feat(lint): add bats-raw-mise-dispatch rule — flag 'mise run' in BATS test bodies (#38)#68
Open
olavostauros wants to merge 2 commits into
Open
Conversation
… test bodies
Flag raw `mise run` invocations in BATS test files — tests should call
the tool wrapper (`notes lock`) instead of reconstructing the dispatch
path inline. Complements the existing `bats-test-helper` rule (which
catches direct script invocation) by catching the converse anti-pattern.
Detection scope:
- `mise run <task>` at statement boundaries (line start, after `|`,
`||`, `&&`, `;`, `(`, `{`, `exec`, `run`)
- `mise -C <dir> run <task>` — remote/targeted dispatch
- Correctly skips patterns inside quoted strings (grep, test descriptions)
- Allowlists test_helper.bash/helpers.bash for wrapper definitions
Known limitation: `bash -c '... mise run ...'` wraps the dispatch in a
quoted string, making it indistinguishable from grep patterns at the
line-scanning level. Not flagged in this implementation.
Closes KnickKnackLabs#38
olavostauros
force-pushed
the
feat/bats-raw-mise-dispatch
branch
from
June 24, 2026 17:55
9ac3ddb to
2a7117e
Compare
This was referenced Jun 26, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a lint rule that flags raw
mise runinvocations in BATS test files — tests should call the tool wrapper (notes lock) instead of reconstructing the dispatch path inline.Complements the existing
bats-test-helperrule (which catches direct script invocation viabash .mise/tasks/foo) by catching the converse anti-pattern: usingmise runin test bodies instead of the wrapper function.Both converge on the same principle from fold
bats-tool-testing.md('Call the Tool, Not the Script').Detection
mise run <task>at statement boundaries (line start, after|,||,&&,;,(,{,exec,run)mise -C <dir> run <task>— remote/targeted dispatchtest_helper.bash/helpers.bashas canonical wrapper definition files*/fixtures/*paths (lint-rule synthetic inputs)Known limitation
bash -c '... mise run ...'wraps the dispatch in a quoted string, making it indistinguishable fromgrep -q '... mise run ...'at the line-scanning level. Not flagged in this implementation — documented in tests.Fixtures (6 scenarios)
cleandirtyrun mise run -q lock, flaggeddirty-bash-cbash -c '... mise run ...', known limitationignored-inline# codebase:ignore, passesignored-repocodebase:ignoreinmise.toml, skipsemptytest/dir, passesSelf-hosting
The codebase repo itself passes cleanly after adding inline ignores to two
exec mise runtest fixture lines incaller-pwd-contract.bats(these define wrapper scripts inside multi-line test strings, not test dispatch).Validation
mise run test— all 230 tests pass (12 new + 218 existing)codebase lint "$PWD"— self-hosting passesreadme build --check— N/A (codebase does not use README.tsx)git diff --check— cleanFixes #38