feat(cli): .glint.yml config and inline suppression comments
Adds project-level configuration and per-job suppression directives:
.glint.yml (searched from pipeline dir up to the git root):
- ignore: [GL007, GL032] — suppress rules globally for the project
- severity: {GL004: warning} — override rule severity (error/warning/ignore)
- stages: [quality] — extra stages beyond the pipeline's stages: block
- token: / url: / cache_dir: — defaults for flags; lower priority than
CLI flags and environment variables
Inline suppression (# glint: ignore):
- Place "# glint: ignore GL007" immediately before a job definition to
suppress that rule for the specific job only
- Multiple rules: "# glint: ignore GL007, GL032" (comma or space separated)
- Wildcard: "# glint: ignore all" suppresses every finding for the job
- Suppressions are scoped to the annotated job; pipeline-level findings
are unaffected
- Parsed from yaml.Node head/line comments in the first parse pass;
stored in Pipeline.Suppressions (root file only, not includes)
New packages: internal/config (Load, walk-up search, .git boundary stop)
New files: cmd/glint/filter.go (applyConfig, isSuppressed helpers)
Tests: config_test.go, parser_suppress_test.go, filter_test.go
Validate fixtures: testdata/config_ignored/, config_severity/, config_suppress/
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+10
@@ -0,0 +1,10 @@
|
||||
stages:
|
||||
- build
|
||||
|
||||
# GL007 (only/except deprecated) would normally fire here, but the .glint.yml
|
||||
# in this directory ignores GL007.
|
||||
deprecated-job:
|
||||
stage: build
|
||||
only:
|
||||
- main
|
||||
script: echo ok
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
ignore:
|
||||
- GL007
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
stages:
|
||||
- build
|
||||
|
||||
# GL004 (undefined stage) is demoted to warning by .glint.yml, so the exit
|
||||
# code must be 0 even though there is a finding.
|
||||
bad-stage-job:
|
||||
stage: nonexistent
|
||||
script: echo hi
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
severity:
|
||||
GL004: warning
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
stages:
|
||||
- build
|
||||
|
||||
# glint: ignore GL007
|
||||
suppressed-job:
|
||||
stage: build
|
||||
only:
|
||||
- main
|
||||
script: echo ok
|
||||
|
||||
still-flagged-job:
|
||||
stage: build
|
||||
only:
|
||||
- main
|
||||
script: echo ok
|
||||
Reference in New Issue
Block a user