Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rules/patterns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,8 @@
category: version-compat
fix: "Call window.set_maximize_flags(flags) then window.maximize()"
min-version: 49
guard-pattern: "get_maximized\\s*\\?"
guard-window: 1

- id: R-VER49-09
pattern: "\\bAppMenuButton\\b"
Expand Down Expand Up @@ -1084,6 +1086,8 @@
category: version-compat
min-version: 49
fix: "Call unmaximize() without the MaximizeFlags parameter"
guard-pattern: "get_maximized\\s*\\?"
guard-window: 1

# --- GNOME 50 migration (version-gated) ---
# GNOME 50 removed X11 support and associated APIs.
Expand Down
4 changes: 3 additions & 1 deletion skills/ego-lint/references/rules-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,8 @@ Rules for APIs removed or changed in specific GNOME Shell versions. These rules
- **Rule**: `maximize()` lost the `MaximizeFlags` parameter in GNOME 49.
- **Rationale**: Passing `MaximizeFlags` to `maximize()` will throw in GNOME 49.
- **Fix**: Call `window.set_maximize_flags(flags)` first, then `window.maximize()`.
- **Tested by**: `tests/fixtures/gnome49-maximize@test/`
- **Guard**: Suppressed when `get_maximized ?` appears on the same line (ternary version-compat pattern).
- **Tested by**: `tests/fixtures/gnome49-compat@test/`

### R-VER49-09: AppMenuButton removal
- **Severity**: blocking
Expand Down Expand Up @@ -2556,6 +2557,7 @@ Rules for APIs removed or changed in specific GNOME Shell versions. These rules
- **Rule**: `MaximizeFlags` parameter was removed from `unmaximize()` in GNOME 49.
- **Rationale**: The `unmaximize()` method no longer accepts a flags parameter.
- **Fix**: Call `unmaximize()` without the `MaximizeFlags` parameter.
- **Guard**: Suppressed when `get_maximized ?` appears on the same line (ternary version-compat pattern).

---

Expand Down
14 changes: 9 additions & 5 deletions skills/ego-lint/scripts/ego-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,12 @@ for f in "$EXT_DIR"/*.js; do
continue
fi

# Check for any line > 500 chars (strong minification signal)
if awk 'length > 500 { found=1; exit } END { exit !found }' "$f" 2>/dev/null; then
minified_files+=" $rel_path (lines > 500 chars)"$'\n'
# Check for lines > 500 chars — need 3+ such lines to flag as minified.
# A single long line (e.g., keyboard constant chain) in an otherwise
# readable file is not minification.
long_line_count=$(awk 'length > 500 { n++ } END { print n+0 }' "$f" 2>/dev/null || true)
if [[ "$long_line_count" -ge 3 ]]; then
minified_files+=" $rel_path ($long_line_count lines > 500 chars)"$'\n'
fi
done
if [[ -d "$EXT_DIR/lib" ]]; then
Expand All @@ -433,8 +436,9 @@ if [[ -d "$EXT_DIR/lib" ]]; then
minified_files+=" $rel_path (webpack bundle)"$'\n'
continue
fi
if awk 'length > 500 { found=1; exit } END { exit !found }' "$f" 2>/dev/null; then
minified_files+=" $rel_path (lines > 500 chars)"$'\n'
long_line_count=$(awk 'length > 500 { n++ } END { print n+0 }' "$f" 2>/dev/null || true)
if [[ "$long_line_count" -ge 3 ]]; then
minified_files+=" $rel_path ($long_line_count lines > 500 chars)"$'\n'
fi
done < <(find "$EXT_DIR/lib" -name '*.js' -print0 2>/dev/null)
fi
Expand Down
9 changes: 9 additions & 0 deletions tests/fixtures/gnome49-compat@test/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ export default class Gnome49Test extends Extension {
this._tap = new Clutter.TapAction();
}

// Ternary version-compat guard: should NOT trigger R-VER49-08/11
_maximizeCompat(window) {
window.get_maximized ? window.maximize(Meta.MaximizeFlags.BOTH) : window.maximize();
}

_unmaximizeCompat(window) {
window.get_maximized ? window.unmaximize(Meta.MaximizeFlags.BOTH) : window.unmaximize();
}

disable() {
this._click = null;
this._tap = null;
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/minified-boundary@test/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SPDX-License-Identifier: GPL-2.0-or-later
15 changes: 15 additions & 0 deletions tests/fixtures/minified-boundary@test/extension.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions tests/fixtures/minified-boundary@test/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"uuid": "minified-boundary@test",
"name": "Minified Boundary Test",
"description": "Tests that 2 long lines do not trigger minified-js detection",
"shell-version": ["48"],
"url": "https://example.com"
}
2 changes: 2 additions & 0 deletions tests/fixtures/minified-js@test/extension.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ assert_exit_code "exits with 1 (has failures)" 1
assert_output_contains "fails on minified JS" "\[FAIL\].*minified-js"
echo ""

# --- minified-boundary (2 long lines — below threshold) ---
echo "=== minified-boundary ==="
run_lint "minified-boundary@test"
assert_output_not_contains "no minified-js with only 2 long lines" "\[FAIL\].*minified-js"
echo ""

# --- init-time-safety ---
echo "=== init-time-safety ==="
run_lint "init-time-safety@test"
Expand Down Expand Up @@ -428,6 +434,8 @@ assert_exit_code "exits with 1 (has failures)" 1
assert_output_contains "fails on Meta.Rectangle" "\[FAIL\].*R-VER49-01"
assert_output_contains "fails on Clutter.ClickAction" "\[FAIL\].*R-VER49-02"
assert_output_contains "fails on Clutter.TapAction" "\[FAIL\].*R-VER49-03"
assert_output_not_contains "no R-VER49-08 with ternary guard" "\[FAIL\].*R-VER49-08"
assert_output_not_contains "no R-VER49-11 with ternary guard" "\[FAIL\].*R-VER49-11"
echo ""

# --- gnome46-extras ---
Expand Down