Skip to content

Commit 9f67e8e

Browse files
ZviBaratzclaude
andcommitted
docs(ego-lint): add section descriptions to patterns.yaml
Add one-line description comments to the 13 section headers that lacked them. All 18 sections now have a brief explanation of what the section catches, helping new contributors navigate the 113 rules. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e3d1f57 commit 9f67e8e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

rules/patterns.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
fix: "Ensure _destroyed is checked after the race resolves. Consider simpler alternatives."
114114

115115
# --- Deprecated APIs (blocking/advisory) ---
116+
# APIs removed or superseded in GNOME 45+.
116117

117118
- id: R-DEPR-04
118119
pattern: "\\bimports\\.(ui|gi|misc)\\."
@@ -181,6 +182,7 @@
181182
fix: "Replace format() calls with template literals: `my ${variable} string`."
182183

183184
# --- Import segregation (blocking) ---
185+
# prefs.js runs in a separate process and cannot import Shell/Clutter/Meta/St.
184186

185187
- id: R-IMPORT-08
186188
pattern: "resource:///org/gnome/shell/ui/"
@@ -191,6 +193,7 @@
191193
fix: "Preferences must only use GTK/Adw/Gio/GLib. Shell UI modules run in a different process."
192194

193195
# --- Security (blocking/advisory) ---
196+
# eval(), dynamic code, telemetry, insecure paths, privilege escalation.
194197

195198
- id: R-SEC-01
196199
pattern: "\\beval\\s*\\("
@@ -290,6 +293,7 @@
290293
fix: "If used legitimately (e.g., data URIs), add a comment explaining the purpose"
291294

292295
# --- Subprocess safety (blocking/advisory) ---
296+
# Synchronous spawning blocks the main loop; curl/gsettings via subprocess banned.
293297

294298
- id: R-SEC-14
295299
pattern: "\\bspawn_sync\\b"
@@ -351,6 +355,7 @@
351355
fix: "Remove automatic package installation. Document manual installation steps for required system packages."
352356

353357
# --- Prefs.js GTK3 widget detection (blocking/advisory) ---
358+
# GTK3 widgets with direct Adwaita replacements should use the Adw equivalent.
354359

355360
- id: R-PREFS-04
356361
pattern: "\\bnew\\s+Gtk\\.(HeaderBar|StackSwitcher|Notebook|InfoBar)\\b"
@@ -370,6 +375,7 @@
370375
fix: "Gtk.Grid → Adw rows, Gtk.ScrolledWindow → Adw.PreferencesPage (auto-scrolls), Gtk.Frame → Adw.PreferencesGroup, Gtk.ComboBoxText → Adw.ComboRow, Gtk.RadioButton → Adw.ActionRow, Gtk.Stack → Adw.ViewStack, Gtk.Revealer → Adw.ExpanderRow, Gtk.Expander → Adw.ExpanderRow, Gtk.FlowBox → Adw.PreferencesGroup, Gtk.ListBox → Adw.PreferencesGroup (for static lists)"
371376

372377
# --- Translation (advisory) ---
378+
# Template literals and concatenation inside gettext break xgettext extraction.
373379

374380
- id: R-I18N-01
375381
pattern: "_\\(\\`[^`]*\\$\\{"
@@ -388,6 +394,7 @@
388394
fix: "Use _('Hello %s').format(name) instead of _('Hello ' + name)"
389395

390396
# --- Logging (advisory) ---
397+
# Legacy log()/print()/printerr() should use console.debug/error in GNOME 45+.
391398

392399
- id: R-LOG-02
393400
pattern: "(?<![.\\w])log\\s*\\("
@@ -406,6 +413,7 @@
406413
fix: "Replace print()/printerr() with console.debug() or console.error()."
407414

408415
# --- GSettings (advisory) ---
416+
# Common GSettings API misuse: wrong bind flag enum, missing settings cleanup.
409417

410418
- id: R-QUAL-23
411419
pattern: "\\.bind\\s*\\([^)]*GObject\\.BindingFlags"
@@ -614,6 +622,7 @@
614622
fix: "Use Shell.ActionMode.NORMAL for most keybindings, or Shell.ActionMode.OVERVIEW | Shell.ActionMode.NORMAL for multi-mode"
615623

616624
# --- Code quality (advisory/blocking) ---
625+
# Module-scope GObject construction, unnecessary patterns, code smell detection.
617626

618627
- id: R-QUAL-04b
619628
pattern: "^(let|var)\\s+\\w+\\s*=\\s*new\\s+(St|Gio|GLib|Clutter|Meta|Shell|GObject)\\."
@@ -680,6 +689,7 @@
680689
fix: "Remove ?version= from the import; only Soup, Gtk, Gdk, and Adw require version specifiers"
681690

682691
# --- GNOME 44-46 migration (version-gated) ---
692+
# APIs removed or renamed in GNOME 44-46 transition to ESM.
683693

684694
- id: R-VER44-01
685695
pattern: "\\bMeta\\.later_add\\b"
@@ -763,6 +773,7 @@
763773
min-version: 46
764774

765775
# --- GNOME 47 migration (version-gated) ---
776+
# Clutter.Color removed in GNOME 47; use Cogl.Color.
766777

767778
- id: R-VER47-01
768779
pattern: "\\bClutter\\.Color\\b"
@@ -774,6 +785,7 @@
774785
min-version: 47
775786

776787
# --- GNOME 48 migration (version-gated) ---
788+
# Clutter.Image, Meta display functions, CSS class renames.
777789

778790
- id: R-VER48-01
779791
pattern: "\\bClutter\\.Image\\b"
@@ -849,6 +861,7 @@
849861
replacement-pattern: "quick-toggle-has-menu"
850862

851863
# --- GNOME 49 migration (version-gated) ---
864+
# Clutter action classes replaced by gesture equivalents; Meta.Rectangle → Mtk.
852865

853866
- id: R-VER49-01
854867
pattern: "\\bMeta\\.Rectangle\\b"

0 commit comments

Comments
 (0)