You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Five targeted fixes for false positives found during Dash to Panel field test:
1. R-SEC-03 guard for GPL license headers: `http://www.gnu.org/licenses/` in
GPL boilerplate no longer fires (-18 FP WARNs)
2. R-VER48-02 PACKAGE_VERSION guard: `Config.PACKAGE_VERSION >= '48'` recognized
as version-compat guard with guard-window: 3 (-2 FP FAILs)
3. skip-comments field for pattern rules: new opt-in that skips matches inside
// and /* */ comments. Applied to R-DEPR-05/06 (-3 FP FAILs)
4. guard-window-forward for forward-looking guard: new field that checks N lines
after the match. Applied to R-SLOP-24 for multi-line system schema
constructors (-5 FP WARNs)
5. Provenance post-filter output fix: R-SLOP-01/02 WARNs deferred until
provenance score is known, fixing visual bug where suppressed WARNs still
appeared in terminal output
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
`ego-lint.sh` is the main orchestrator. It uses a three-tier rule system (pattern → structural → semantic) and delegates to sub-scripts via `run_subscript`:
45
45
46
46
-`rules/patterns.yaml` — Tier 1 pattern rules (124 regex-based, declarative rules). Note: at project root, not under `skills/ego-lint/`
47
-
-`apply-patterns.py` — Tier 1 pattern engine (inline YAML parser, no PyYAML dependency). Supports `guard-pattern` + `guard-window` (sliding `deque` lookback), `replacement-pattern`, `exclude-dirs`, version-gating, `fix-min-version` (suppresses fix text when extension min shell-version is below threshold)
47
+
-`apply-patterns.py` — Tier 1 pattern engine (inline YAML parser, no PyYAML dependency). Supports `guard-pattern` + `guard-window` (sliding `deque` lookback) + `guard-window-forward` (forward peeking), `replacement-pattern`, `exclude-dirs`, version-gating, `fix-min-version` (suppresses fix text when extension min shell-version is below threshold), `skip-comments` (skips matches inside `//` and `/* */` comments)
This checks the next 2 lines after the matched line for the guard pattern. The typical case is a multi-line constructor:
191
+
192
+
```js
193
+
this._mutter = new Gio.Settings({ // ← pattern fires here
194
+
schema_id: 'org.gnome.mutter' // ← guard matches here (forward +1)
195
+
});
196
+
```
197
+
198
+
**Guidelines:**
199
+
- Set `guard-window-forward` to the maximum expected distance between the flagged pattern and the guard evidence
200
+
- Can be combined with `guard-window` for bidirectional lookback
201
+
- Keep the window as small as practical to avoid false suppressions
202
+
203
+
### Comment Skipping (`skip-comments`)
204
+
205
+
When a rule should not match inside comments (e.g., deprecated API names mentioned in code comments), use `skip-comments: true`:
206
+
207
+
```yaml
208
+
- id: R-DEPR-06
209
+
pattern: "\\bTweener\\b"
210
+
skip-comments: true
211
+
```
212
+
213
+
This skips matches inside `//` single-line comments and `/* */` block comments (including multi-line). Code on the same line as a comment is still checked — only the portion after `//` or between `/* */` is skipped.
214
+
215
+
**Use cases:**
216
+
- Deprecated API names mentioned in migration comments
217
+
- Commented-out legacy code that hasn't been removed
218
+
179
219
### Fix Version Gating (`fix-min-version`)
180
220
181
221
When a deprecation rule suggests a fix that only works on newer GNOME versions, use `fix-min-version` to suppress the fix text for extensions whose minimum shell-version is below the threshold. The warning still fires (developers should know about deprecations), but the fix suggestion is omitted when applying it would break backward compatibility.
0 commit comments