feat(linter): context-scoped needs:/dependencies: cross-checks
When glint check runs in single-context mode (--branch, --tag, --source, or --var), jobs that resolve to JobSkipped against that context are now excluded from needs: and dependencies: cross-job checks (GL027-GL031). This eliminates false-positive errors for jobs intentionally gated to specific pipeline events (e.g. a deploy job with rules:if: CI_COMMIT_TAG no longer triggers GL027 on branch pipelines). linter.Lint now accepts a skipped map[string]bool (nil = check all jobs); checkNeeds and checkDependencies skip jobs present in the map. Multi-context mode (--context) passes nil, so all jobs are checked regardless of context. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+11
@@ -151,6 +151,17 @@ Use `--list-vars` to print the resolved variable table to stderr.
|
||||
| `--changes PATH` | Mark PATH as changed; repeatable |
|
||||
| `--changes-from REF` | Run `git diff --name-only REF` to auto-detect changed files |
|
||||
|
||||
**Context-scoped linting** (single-context mode):
|
||||
|
||||
When a context is given, jobs evaluated as `skipped` are excluded from `needs:` and `dependencies:` cross-job checks (GL027–GL031). This eliminates false positives for jobs that are intentionally gated to specific pipeline events:
|
||||
|
||||
```yaml
|
||||
deploy-job:
|
||||
needs: [build-job] # GL027 suppressed on branch pipelines; only checked on tag pipelines
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG != ""'
|
||||
```
|
||||
|
||||
**Multi-context comparison** (`--context`):
|
||||
|
||||
Pass `--context KEY=VALUE[,...]` (repeatable) instead of `--branch`/`--tag`/`--source` to evaluate every job across multiple contexts simultaneously. Each `--context` flag defines one column; glint prints a table showing `active`, `manual`, `skipped`, or `blocked` per job per context.
|
||||
|
||||
Reference in New Issue
Block a user