fix: validate set and shopt options when reading a Taskfile#2911
Open
posidoni wants to merge 1 commit into
Open
fix: validate set and shopt options when reading a Taskfile#2911posidoni wants to merge 1 commit into
posidoni wants to merge 1 commit into
Conversation
trulede
reviewed
Jul 10, 2026
trulede
left a comment
Contributor
There was a problem hiding this comment.
IMHO I think it would be better if errors with options were raised by mvdan (which I think does this already, perhaps?) than to have to keep such a list up to date.
End effect would be (is) the same, an error.
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.
Follow-up to #2429. The panic from that issue was fixed upstream in
mvdan/sh, but an invalidset:/shopt:option is still only reported when a command actually runs — once per command, with no hint about the actual mistake:This PR validates
setandshoptlists when the Taskfile is read (root, task and command level), following the approach of #2892:posixOptsTable/bashOptsTable(mvdan.cc/sh/v3/interp), i.e. exactly what works at runtime.shopt: ["-o", "pipefail"]keeps working: a-oentry switches validation of the remaining entries tosetoptions, matchingshopt -s -osemantics (covered by a regression test).pipefail→set,globstar→shopt).schema.json: theshoptenum was missing three supported options (dotglob,extglob,nocaseglob) — extended to all six; reference docs updated accordingly.Note on behavior: an invalid option now fails at parse time even if the task declaring it never runs — consistent with other Taskfile validation such as #2892.
Tested with four new tests (an invalid option at each of the three levels, plus the
-oregression) and a fullgo test ./...run.Disclosure per the AI usage policy: this PR (code and description) was prepared with AI assistance. I reviewed and tested all changes and can explain every line.