Use file-format layer names for silkscreen rules, and lint for it - #36
Closed
Cimos wants to merge 2 commits into
Closed
Use file-format layer names for silkscreen rules, and lint for it#36Cimos wants to merge 2 commits into
Cimos wants to merge 2 commits into
Conversation
The silkscreen rules referenced ?.Silkscreen and F./B.Silkscreen, which are Board Setup display names. That name is editable, board importers overwrite it with the source tool's naming, and boards written before KiCad 6 load with the file-format name showing instead. On any of those boards it does not resolve. In a (layer ...) clause that makes KiCad reject the whole rule file, so every rule in it silently stops being enforced. In the Pad to Silkscreen condition it fails with no message anywhere. Both now use F.SilkS/B.SilkS, which the board file format fixes and nothing can rename. Checked by running DRC on the paired test boards under KiCad 9.0.6 and 10.0.5. Refs #33
The linter had no layer vocabulary, so it passed both rule files despite the silkscreen bug. It now checks every layer name in a (layer ...) clause, a .Layer comparison and an existsOnLayer() call against the file-format names, handling the ? and * wildcards and the outer/inner keywords. Display-name spellings get a targeted message naming the file-format form to use; anything matching no layer is reported as unknown. README gains a short section on why the file-format names matter, and the warning that kicad-cli pcb drc reports a rejected rule file as a clean run with exit code 0 - so green CI does not prove the rules ran. Refs #33
Owner
Author
|
Superseded by the move. This fix shipped in kicad-druid as part of the migration — the new repo's |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two users hit
ERROR: Unrecognized layer '?.Silkscreen'when adding these rules to their projects (#33, and the same report upstream). They were right, and the problem is bigger than the error suggests.What was wrong
The silkscreen rules used
?.SilkscreenandF./B.Silkscreen. Those are Board Setup display names. A layer name in a.kicad_druresolves against the file-format name (F.SilkS, always present) plus the board's current layer name — and the current name only equalsF.Silkscreenwhile the board keeps KiCad's default.Two ways a board carries a different name with no user action:
Top Overlay..kicad_pcbolder than file version 20200922 (KiCad 5.1 and earlier) loads with the layer namedF.SilkS, and looks untouched in Board Setup.On those boards the name does not resolve, and KiCad rejects the entire rule file — every JLCPCB or PCBWay rule silently reverts to KiCad defaults.
What changed
Rule files. Both surfaces, in both fabs. The
(layer ...)clauses that produce the visible error, and thePad to Silkscreenconditions that fail with no message at all (#34) — fixing only the first would have left that rule dead.Linter. It had no layer vocabulary and passed both files despite this bug (#35). It now checks every layer name in a
(layer ...)clause, a.Layercomparison and anexistsOnLayer()call, handling the?/*wildcards and theouter/innerkeywords. Display-name spellings get a message naming the file-format form to use; anything matching no layer is reported as unknown.README. Short section on why the file-format names matter, plus the warning that
kicad-cli pcb drcreports a rejected rule file as a clean run with exit code 0 — so green CI does not prove the rules ran.Evidence
Run against the paired test boards on KiCad 9.0.6 and 10.0.5. Thresholds exaggerated so a live rule must fire; baseline with no custom rules is 30 violations.
?.Silkscreen?.SilkS?.Silkscreen+ a good rule?.SilkS+ a good rule== 'F.Silkscreen'== 'F.SilkS'Linter checked both ways: it passes the fixed files, and flags all four occurrences in the pre-fix content with the right suggestion.
Not a version regression — the layer names are identical in KiCad 7, 8, 9, 10 and master, and 9.0.4 and 9.0.6 are byte-identical in the files that matter. The README claim about tokens being unchanged across 8/9/10 still holds and is left alone.
#32 carries the same spelling in its generator and emits it into all eight generated files; that needs the same change on its branch.
Refs #33
Refs #34
Refs #35