refactor: batch BATS rules — raw dispatch, python one-liner, setup-suite path, mise-run-quiet#73
Closed
olavostauros wants to merge 9 commits into
Closed
Conversation
The codebase_target_for_rule() function treated the entire scope value as a single path, so a TOML string like or-true = ".mise/tasks lib" would produce a single target /repo/.mise/tasks lib (with space) instead of two separate targets /repo/.mise/tasks and /repo/lib. This meant multi-path scope overrides either errored (path doesn't exist) or silently scanned nothing — users thought they had multi-path coverage but got false passes. Changes: - lib/codebase-config.sh: Replace codebase_target_for_rule() with codebase_targets_for_rule() that splits the scope value on whitespace and emits one target line per token. - .mise/tasks/lint/_default: Iterate over the multi-line output so each target is linted independently. - test/lint/default.bats: Add test covering multi-path scope with space-separated path list. The fix uses shell word-splitting on the scope string (unquoted in a for loop), which naturally handles TOML string values with internal spaces. Each token is resolved as a relative path against the repo root, or passed through unchanged if absolute. Fixes KnickKnackLabs#22
Adds first-class lint groups/presets so repos can opt into convention bundles with a single @maintained-tool reference instead of enumerating every lint rule individually. Includes: - lib/lint-groups.sh — built-in group registry, expansion, and discoverability functions - lib/codebase-config.sh — source lint-groups.sh, expand @group references in codebase_configured_lint_rules(), support lint_exclude - .mise/tasks/lint/_default — show expanded group count in preamble; updated error hint to mention groups - .mise/tasks/lint/groups — new lint:groups discoverability task - test/lint/lint-groups/ — 17 BATS tests Closes KnickKnackLabs#69
… 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
Detect unreadable Python assertion one-liners (`python3 -c "...assert..."`) in BATS test files. Prefer heredoc Python scripts for readability. Closes KnickKnackLabs#47
Adds bats-setup-suite-path lint rule that flags test/setup_suite.bash files calling `mise env` without preserving BATS_LIBEXEC first. BATS 1.13.0 relies on libexec path resolution; mise env can rewrite PATH and drop bats's libexec directory, causing 'bats-exec-file: command not found' before any tests run. Follows established file-discovery + scan pattern. ShellCheck-clean (SC2016 excluded on intentional code-snippet echo lines). Implements KnickKnackLabs#55 (KnickKnackLabs/codebase)
This was referenced Jun 26, 2026
Open
Author
|
Closing this stacked batch in favor of individual re-evaluation. See ricon-family/olavo#9 for context. |
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
Stacked batch 2/4. See ricon-family/olavo#9.
Consolidates 4 BATS-related lint rules (supersedes #68, #65, #61, #64). Includes the shiv-plugin rule (#60) which shipped inside #61.
Rules included
bats-raw-mise-dispatchmise runin BATS test bodiesbats-python-one-linerbats-setup-suite-pathsetup_suite.bashpath conventionsmise-run-quiet--quietflag onmise runin tasksCommits
dbd4e79e239d4a698f42e6813143c03a0d3069e7434c3408eValidation
mise run test— 289 tests passinggit diff --check— clean