feat(lint): add exec-stderr-silence rule — flag 'exec ... 2>/N' persistent stderr suppression#67
Open
olavostauros wants to merge 1 commit into
Open
Conversation
…r suppression Adds text-based detection for 'exec' with stderr redirection (2>/dev/null, 2>&-, 2>!) that persists for the current shell. - Detection via bash regex: \bexec\b[^#]*2> with dangerous target - Fixtures: clean, dirty, ignored-inline, ignored-file, broad-walk, no-toml, empty - 17 BATS tests covering detection, ignore mechanisms, discovery, edge cases - Self-hosting verified: task file does not self-report - Follows or-true pattern for output format, ignore conventions, and scope
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
Adds a new lint rule
exec-stderr-silencethat flagsexecwith stderr redirection (e.g.exec 3<>"$path" 2>/dev/null). Unlike other commands,execmakes the redirection persist for the current shell, which can silently suppress diagnostic output. Discovered during KnickKnackLabs/notes#15 work.Detection approach
Text-based pattern matching via bash regex:
execfollowed by2>/dev/null,2>&-,2>!(noclobber override)Files
.mise/tasks/lint/exec-stderr-silence— task implementation (67 lines of logic)test/lint/exec-stderr-silence/exec-stderr-silence.bats— 17 BATS teststest/lint/exec-stderr-silence/fixtures/— 7 fixture scenariosValidation
mise run test— all 17 tests passcodebase lint:exec-stderr-silence .mise/tasks/lint/exec-stderr-silence— self-hosting passes (task doesn't self-report)git diff --check— clean