Skip to content

feat: add bats-setup-suite-path lint rule (#55)#61

Open
olavostauros wants to merge 4 commits into
KnickKnackLabs:mainfrom
olavostauros:feat/bats-setup-suite-path
Open

feat: add bats-setup-suite-path lint rule (#55)#61
olavostauros wants to merge 4 commits into
KnickKnackLabs:mainfrom
olavostauros:feat/bats-setup-suite-path

Conversation

@olavostauros

@olavostauros olavostauros commented Jun 23, 2026

Copy link
Copy Markdown

Summary

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.

The rule:

  1. Scans each target for test/setup_suite.bash
  2. If found and it calls mise env, checks that BATS_LIBEXEC (or ${BATS_LIBEXEC:-}) is captured before the mise env call
  3. Reports the dangerous pattern as FAIL with the safe shape as a remedy hint
  4. Respects codebase:ignore bats-setup-suite-path at repo-level and inline

Also included in this PR (from the feat/mise-shiv-plugin branch):

  • mise-shiv-plugin lint rule: checks that mise.toml has the shiv plugin entry and experimental = true when declaring shiv-managed tools
  • Style refactor: collapses 3-line section comment blocks (# ==========...) to single-line comments across existing test files
  • Adds codebase:ignore mise-shiv-plugin to the fix-lints-provisioned fixture to prevent cross-rule false positives

Files changed

File Change
.mise/tasks/lint/bats-setup-suite-path New rule (~120 lines)
.mise/tasks/lint/mise-shiv-plugin New rule (~75 lines)
test/lint/bats-setup-suite-path/ 10 BATS tests + 6 fixture scenarios
test/lint/mise-shiv-plugin/ 11 BATS tests + 7 fixture scenarios
test/lint/*.bats (8 files) + test/lib/shell-files.bats Style: collapse section comment blocks
test/lint/github-actions/fixtures/fix-lints-provisioned/mise.toml Add codebase:ignore mise-shiv-plugin

Validation

  • mise run test239/239 pass (10 new tests for bats-setup-suite-path at indices 7–16, 11 new tests for mise-shiv-plugin, zero regressions)
  • mise run lint:bats-setup-suite-path . — self-hosting clean (codebase repo has no test/setup_suite.bash)
  • mise run lint:shellcheck .mise/tasks/lint/bats-setup-suite-path .mise/tasks/lint/mise-shiv-plugin — ShellCheck-clean (SC2016 excluded on intentional code-snippet echo lines, per established convention)
  • git diff --check — no whitespace errors

Closes #55

Adds mise-shiv-plugin lint rule that flags mise.toml files declaring
shiv-managed tools without the required [plugins] shiv entry and
[settings] experimental = true. Based on the CI failure observed in
KnickKnackLabs/chat#39.

Includes 11 BATS tests across 7 fixture scenarios, plus an ignore
directive on an existing github-actions fixture that declares shiv tools.

Implements KnickKnackLabs#34 (KnickKnackLabs/codebase)
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)
mise requires task files under .mise/tasks/ to be executable (mode 755)
to discover them. Both bats-setup-suite-path and mise-shiv-plugin were
committed as 644 (non-executable), causing mise run to report
"no task found" and all functional BATS tests to fail.
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.

lint: catch setup_suite PATH rewrites that hide Bats libexec

1 participant