Semantic lints on by default: the index knows who mentions what, and the linter finally asks
TODO section 24, coverage_gaps M7 via topo 2.9-6 and 2.9-4. unused-signal, undriven-net and multiply-driven shipped off because a per-file analysis cannot see a signal read or driven from another file's hierarchy. The index now carries a per-file identifier census - FileFacts::words, FACTS_FORMAT 12 -> 13, one harvest lifted from the server's completion candidates and now feeding them back from the store instead of re-lexing every file at startup (scan -28 percent) - and the linter gains a MentionOracle: unused-signal and undriven-net say nothing when the name is mentioned in any other indexed file, the false-negative-safe direction; multiply-driven shares the gate but never reads it. The three are on wherever an oracle exists (the editor always, the CLI when it walks a project) and off for a single file or stdin. With them, the missing off switch: [lint] select/ignore in lucisv.toml with CLI flags winning key by key, and lucisv.lint.select/ignore in the editor. QA's finding, reworked: the census dropped macro invocations whole, so a signal named only inside `uvm_info(..., dut.sig) was not silenced; the harvest now splits macro, directive and attribute words, skipping double-quoted runs so a "%d" cannot silence a signal named d project-wide, with workspace-defined macro names filtered out of the completion table at the reader. Store +16.9 percent corpus / +15.0 percent opentitan, measured. Corpus unused-signal 52 -> 44 and undriven-net 3 -> 0 with every silencing hand-checked, nothing added; opentitan - lint-clean under its own tools - 14 findings, all classified true against the whole repo. Also: the docs-site rules page gains the empty-item row it lacked. docs/features/semantic-lints-on/README.md. Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
29096cbbac
commit
5051bbdf15
36 files changed
+3064
-216
No files matched your search
@@ -54,6 +54,42 @@ workspace index, from the same file list, and are replaced with it.
|
||||
rebuild: its own token stream is already computed on every change, so its
|
||||
words are harvested per request and an unsaved name is a candidate
|
||||
immediately.
|
||||
- **The harvest is `vlog_semantic::words::harvest`, not this crate's.**
|
||||
Amended 2026-09-02 by `semantic-lints-on`: `candidates::words_in` and
|
||||
`words_of_tokens` are now one-line wrappers over it, and the same census
|
||||
rides in each file's `FileFacts` (`FACTS_FORMAT` 13). Two consequences.
|
||||
The rules for what counts as a word are stated once: `Ident`/`SystemIdent`
|
||||
tokens, plus — since the round's second pass — the identifiers **inside** a
|
||||
macro invocation, a directive line and an attribute, which the lexer hands
|
||||
over as single tokens carrying their whole text. So `` `CHECK(u_dut.sig) ``
|
||||
offers `sig`, which it did not before; a quoted run inside such a token is
|
||||
stepped over (it is a value), and an escaped identifier is still dropped
|
||||
whole (inserting one needs a terminating space a plain word cannot promise).
|
||||
Comments and string literals stay unreachable by construction. The semantic
|
||||
lint rules ask the *same* table "does any other file mention this name", so a
|
||||
completion list and a lint finding can never disagree about what a file
|
||||
contains.
|
||||
|
||||
**One subtraction, at the reader rather than the harvest.** A name the
|
||||
workspace `` `define``s is in the census — it is a word the file writes down
|
||||
— but `Candidates::words_scan` does not offer it, because the macro tier
|
||||
already does and does so **by prefix only**, which is this feature's own
|
||||
fuzzy ruling (`the_keyword_template_macro_and_module_tiers_did_not_go_fuzzy`
|
||||
pins it). Without the skip, splitting `` `define CLK_OSC_EN_Q 1 `` into
|
||||
words would have made a macro name reachable by subsequence through a side
|
||||
door, and would have offered it bare where the code needs a backtick. Pinned
|
||||
by `macro_argument_words_are_offered_and_macro_names_are_left_to_their_own_tier`.
|
||||
Note the coupling this creates:
|
||||
`a_fuzzy_scan_finds_exactly_what_brute_force_subsequence_finds` compares the
|
||||
fuzzy scan against a brute-force sweep of the whole table, and that
|
||||
equivalence now holds only for a table whose fixture declares no macros —
|
||||
which its does not. And a scan no longer lexes a file to build this table: a cache hit
|
||||
brings the words with the record, a parse harvests them from tokens it
|
||||
already has, which is TODO §10's deferred item and −28 % to −31 % over a
|
||||
667-file scan. The one thing that did move is order: `harvest` returns its words
|
||||
sorted rather than in `HashSet` order. Nothing depended on the old order —
|
||||
`Candidates` sorts everything it holds — but it is a change, and it is what
|
||||
lets a record round-trip byte for byte.
|
||||
- **A macro name is written with a backtick where it is used and without one
|
||||
where it is defined or tested.** See *The backtick ruling* below.
|
||||
- **`sortText` is a nudge, not a guarantee.** VS Code scores its own fuzzy match
|
||||
|
||||
Reference in new issue
Block a user