Skip to content

Commit 5442f13

Browse files
ZviBaratzclaude
andauthored
fix(ego-lint): add version-compat suppression and calibrate severities (#69)
## Summary - Add `replacement-pattern` to R-VER49-02 (`Clutter.ClickGesture`), R-VER46-05 (`ExtensionState.ACTIVE`), R-VER48-02 (`global.compositor`) — files containing both old and new APIs are recognized as intentional backward-compat, not errors - Downgrade R-VER48-07 to advisory (CSS can't have runtime guards, consistent with R-VER48-04/04b/06) - Downgrade `non-gjs-scripts` to WARN (EGO allows when justified, per R-PKG-14) - Downgrade `future-shell-version` to WARN (EGO allows preemptive declarations; dev-limit check stays FAIL) - Update test assertions to match new severities Expected field test impact: 56 → 44 FAILs across 10 extensions. Closes #68 ## Test plan - [x] `bash tests/run-tests.sh` — 603 passed, 0 failed - [ ] `bash scripts/field-test-runner.sh --no-fetch` — verify FAIL count drops - [ ] Verify media-controls R-VER49-02 no longer FAIL - [ ] Verify dash-to-panel R-VER48-02 and R-VER46-05 no longer FAIL - [ ] Verify just-perfection R-VER48-07 appears as WARN 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 22fc27c commit 5442f13

File tree

6 files changed

+16
-8
lines changed

6 files changed

+16
-8
lines changed

rules/patterns.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@
871871
category: version-compat
872872
fix: "Use ACTIVE, INACTIVE, ENABLING, DISABLING instead"
873873
min-version: 46
874+
replacement-pattern: "ExtensionState.ACTIVE"
874875

875876
- id: R-VER46-06
876877
pattern: "\\bBlurEffect[^;]*\\.sigma\\b|\\bBlurEffect\\s*\\(\\s*\\{[^}]*sigma"
@@ -926,6 +927,7 @@
926927
min-version: 48
927928
guard-pattern: "if\\s*\\(\\s*Meta\\.disable_unredirect|PACKAGE_VERSION.*['\"]4[89]|PACKAGE_VERSION.*['\"][5-9]"
928929
guard-window: 10
930+
replacement-pattern: "global.compositor"
929931

930932
- id: R-VER48-03
931933
pattern: "\\bCursorTracker\\.get_for_display\\b"
@@ -978,7 +980,7 @@
978980
- id: R-VER48-07
979981
pattern: "quick-menu-toggle"
980982
scope: ["*.css"]
981-
severity: blocking
983+
severity: advisory
982984
message: "CSS class .quick-menu-toggle renamed to .quick-toggle-has-menu in GNOME 48"
983985
category: version-compat
984986
fix: "Replace .quick-menu-toggle with .quick-toggle-has-menu"
@@ -1006,6 +1008,7 @@
10061008
fix: "Use new Clutter.ClickGesture() instead"
10071009
min-version: 49
10081010
guard-pattern: "\\|\\|\\s*Clutter\\.Click(Gesture|Action)|if\\s*\\(\\s*Clutter\\.ClickAction"
1011+
replacement-pattern: "Clutter.ClickGesture"
10091012

10101013
- id: R-VER49-03
10111014
pattern: "\\bClutter\\.TapAction\\b"

skills/ego-lint/references/rules-reference.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,7 @@ Rules for APIs removed or changed in specific GNOME Shell versions. These rules
17771777
- **Rule**: Extension code must not use the old `ExtensionState` enum values (`ENABLED`, `DISABLED`, `INITIALIZED`, `DEACTIVATING`, `ACTIVATING`) when targeting GNOME 46+.
17781778
- **Rationale**: The `ExtensionState` enum values were renamed in GNOME 46 to better reflect their meaning: `ENABLED` became `ACTIVE`, `DISABLED` became `INACTIVE`, `ACTIVATING` became `ENABLING`, and `DEACTIVATING` became `DISABLING`.
17791779
- **Fix**: Replace `ExtensionState.ENABLED` with `ExtensionState.ACTIVE`, `DISABLED` with `INACTIVE`, `ACTIVATING` with `ENABLING`, and `DEACTIVATING` with `DISABLING`.
1780+
- **Suppressed when**: File also contains `ExtensionState.ACTIVE` (backward-compat shim)
17801781

17811782
### GNOME 47 (R-VER47)
17821783

@@ -1802,6 +1803,8 @@ Rules for APIs removed or changed in specific GNOME Shell versions. These rules
18021803
- **Rule**: Extension code must not call `Meta.disable_unredirect_for_display()`, `Meta.enable_unredirect_for_display()`, `Meta.get_window_actors()`, `Meta.get_window_group_for_display()`, or `Meta.get_top_window_group_for_display()` when targeting GNOME 48+.
18031804
- **Rationale**: These display management functions were moved from the `Meta` namespace to `Meta.Compositor` in GNOME 48. They are now accessible via `global.compositor`.
18041805
- **Fix**: Access these functions via `global.compositor` instead of `Meta` directly. For example, replace `Meta.get_window_actors()` with `global.compositor.get_window_actors()`.
1806+
- **Guard**: Suppressed when `if (Meta.disable_unredirect` or `PACKAGE_VERSION >= '48'` appears within 10 lines
1807+
- **Suppressed when**: File also contains `global.compositor` (backward-compat shim)
18051808

18061809
### R-VER48-03: CursorTracker.get_for_display changed
18071810
- **Severity**: blocking
@@ -1877,6 +1880,8 @@ Rules for APIs removed or changed in specific GNOME Shell versions. These rules
18771880
- **Rule**: `Clutter.ClickAction` was removed in GNOME 49.
18781881
- **Rationale**: Replaced by the gesture-based input API.
18791882
- **Fix**: Use `new Clutter.ClickGesture()` instead.
1883+
- **Guard**: Suppressed when `|| Clutter.Click(Gesture|Action)` or `if (Clutter.ClickAction` appears on the same line
1884+
- **Suppressed when**: File also contains `Clutter.ClickGesture` (backward-compat shim)
18801885

18811886
### R-VER49-03: Clutter.TapAction removed
18821887
- **Severity**: blocking
@@ -2273,7 +2278,7 @@ Rules for APIs removed or changed in specific GNOME Shell versions. These rules
22732278
## GNOME 48/49 Version-Gated Rules (New)
22742279
22752280
### R-VER48-07: QuickMenuToggle CSS class rename
2276-
- **Severity**: blocking
2281+
- **Severity**: advisory
22772282
- **Checked by**: apply-patterns.py (min-version: 48)
22782283
- **Rule**: The CSS class `.quick-menu-toggle` was renamed to `.quick-toggle-has-menu` in GNOME 48.
22792284
- **Rationale**: Extensions targeting GNOME 48+ that use the old class name will have broken styling.

skills/ego-lint/scripts/check-metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def main():
262262
for v in sv:
263263
try:
264264
if int(v) > CURRENT_STABLE:
265-
result("FAIL", "metadata/future-shell-version",
265+
result("WARN", "metadata/future-shell-version",
266266
f"shell-version '{v}' is newer than current stable ({CURRENT_STABLE})")
267267
except ValueError:
268268
pass

skills/ego-lint/scripts/ego-lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ if [[ -n "$non_gjs_scripts" ]]; then
371371
if [[ "$has_pkexec" == true ]]; then
372372
print_result "PASS" "non-gjs-scripts" "Found $hit_count non-GJS script(s) — pkexec helper detected, scripts support privileged operations"
373373
else
374-
print_result "FAIL" "non-gjs-scripts" "Found $hit_count non-GJS script(s) — scripts MUST be written in GJS; no pkexec/privileged helper justification found"
374+
print_result "WARN" "non-gjs-scripts" "Found $hit_count non-GJS script(s) — scripts MUST be written in GJS; no pkexec/privileged helper justification found"
375375
fi
376376
else
377377
print_result "PASS" "non-gjs-scripts" "No non-GJS scripts found"

tests/assertions/version-compat.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
echo "=== gnome48-css-compat ==="
66
run_lint "gnome48-css-compat@test"
77
assert_exit_code "exits with 1 (has failures)" 1
8-
assert_output_contains "detects quick-menu-toggle CSS rename" "\[FAIL\].*R-VER48-07"
8+
assert_output_contains "detects quick-menu-toggle CSS rename" "\[WARN\].*R-VER48-07"
99
echo ""
1010

1111
# --- gnome49-maximize ---

tests/run-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ echo "=== metadata-polish ==="
286286
run_lint "metadata-polish@test"
287287
assert_exit_code "exits with 1 (has failures)" 1
288288
assert_output_contains "warns on missing gettext-domain" "\[WARN\].*metadata/missing-gettext-domain"
289-
assert_output_contains "fails on future shell-version" "\[FAIL\].*metadata/future-shell-version"
289+
assert_output_contains "warns on future shell-version" "\[WARN\].*metadata/future-shell-version"
290290
echo ""
291291

292292
# --- clipboard-access ---
@@ -524,8 +524,8 @@ echo ""
524524
# --- non-gjs-scripts ---
525525
echo "=== non-gjs-scripts ==="
526526
run_lint "non-gjs-scripts@test"
527-
assert_exit_code "exits with 1 (has failures)" 1
528-
assert_output_contains "fails on non-GJS scripts (no pkexec)" "\[FAIL\].*non-gjs-scripts"
527+
assert_exit_code "exits with 0 (warnings only)" 0
528+
assert_output_contains "warns on non-GJS scripts (no pkexec)" "\[WARN\].*non-gjs-scripts"
529529
echo ""
530530

531531
# --- logging-volume ---

0 commit comments

Comments
 (0)