fix(cli): consistent output format, sorted findings, version flag
- Workflow rules now use strict if: evaluation (parse failure → skip rule, not match); fixes premature matching that blocked later rules and injected wrong variables into the context - Single = accepted as alias for == in rules:if: expressions - File/Line preserved through extends: resolution (lost during YAML encode/decode round-trip in the resolver) - Findings sorted by (File, Line, Rule) so same-file issues group together - All warnings use ruff-style path: [warning] message format (includes, extends chains, workflow non-start) - Add --version / -v flag; version shown at top of every --help output - Build injects version via ldflags using git describe Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -42,7 +42,11 @@ func EvalWorkflow(p *model.Pipeline, ctx *Context) (bool, map[string]string) {
|
||||
}
|
||||
vars := ctx.Get
|
||||
for _, rule := range p.Workflow.Rules {
|
||||
if !ruleIfMatches(rule.If, vars) {
|
||||
// Workflow rules use strict evaluation: an unparseable condition is
|
||||
// treated as no-match so later rules (with valid conditions or a
|
||||
// bare when:) are reached. Permissive-true would cause an early rule
|
||||
// with a complex/invalid condition to block all subsequent rules.
|
||||
if !ruleIfMatchesStrict(rule.If, vars) {
|
||||
continue
|
||||
}
|
||||
when := rule.When
|
||||
@@ -94,6 +98,13 @@ func ruleIfMatches(ifExpr string, vars func(string) string) bool {
|
||||
return EvalIf(ifExpr, vars)
|
||||
}
|
||||
|
||||
func ruleIfMatchesStrict(ifExpr string, vars func(string) string) bool {
|
||||
if ifExpr == "" {
|
||||
return true // no if: condition → rule always matches
|
||||
}
|
||||
return EvalIfStrict(ifExpr, vars)
|
||||
}
|
||||
|
||||
func whenToState(when string) JobState {
|
||||
switch when {
|
||||
case "never":
|
||||
|
||||
Reference in New Issue
Block a user