Commit d77061f
fix(ego-lint): check ALL schema IDs for settings-schema match (#154)
## Problem
When `gschema.xml` contains multiple `<schema>` elements (e.g. a main
schema plus a `.keybindings` sub-schema), the previous code extracted
only the **first** `<schema id=...>` attribute. If a sub-schema appeared
first — as in **PaperWM**, where
`org.gnome.shell.extensions.paperwm.keybindings` precedes the main
`org.gnome.shell.extensions.paperwm` schema — `schema/id-matches` and
`schema/filename-convention` both produced **false-positive FAILs** even
though the correct schema was present.
## Root Cause
`extract_schema_id()` used `| head -1`, so it always returned the first
`<schema id=...>` attribute regardless of order. The `schema/id-matches`
check then compared that first ID against `settings-schema`, and the
`schema/filename-convention` check expected the file to be named after
that first ID.
## Fix
- Add `extract_all_schema_ids()` — returns all `<schema id=...>` values
from a file
- Refactor `extract_schema_id()` to use it (single-schema case is
unchanged)
- Add `schema_id_in_file(file, id)` — returns 0 if the target ID is in
any schema element
- **`schema/id-matches`**: pass if `settings-schema` is found in **any**
`<schema>` element (not just the first)
- **`schema/filename-convention`**: when `settings-schema` is defined in
`metadata.json`, use it as the reference ID for the expected filename
(instead of the first schema found)
## Test Coverage
- New `multi-schema@test` fixture reproduces the PaperWM layout:
`.keybindings` sub-schema appears first, main schema second
- 4 new assertions: both checks produce PASS (not FAIL) on multi-schema
XML
## Affected Extensions
- **PaperWM** — primary case: 2 false-positive FAILs eliminated
- Any extension using a single `gschema.xml` with sub-schemas
(keybindings, overrides, etc.)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: NanoClaw Research <research@nanoclaw.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent dad1e72 commit d77061f
File tree
5 files changed
+80
-15
lines changed- skills/ego-lint/scripts
- tests
- fixtures/multi-schema@test
- schemas
5 files changed
+80
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
19 | 33 | | |
20 | 34 | | |
21 | 35 | | |
| |||
63 | 77 | | |
64 | 78 | | |
65 | 79 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
70 | 85 | | |
71 | | - | |
| 86 | + | |
| 87 | + | |
72 | 88 | | |
73 | 89 | | |
74 | 90 | | |
75 | 91 | | |
76 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
77 | 96 | | |
78 | | - | |
79 | | - | |
80 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
81 | 104 | | |
82 | 105 | | |
83 | | - | |
| 106 | + | |
84 | 107 | | |
85 | 108 | | |
86 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
469 | 478 | | |
470 | 479 | | |
471 | 480 | | |
| |||
0 commit comments