Linter expansion, wave 1: severities end to end, per-rule editor toggles generated from the registry, and nineteen Error/Warning-class rules
TODO section 33. Every rule states a Severity (error: would likely fail
to compile or elaborate, or silently mis-synthesize; warning: a probable
bug; style), printed in lucisv check text and JSON, mapped to
ERROR/WARNING/INFORMATION in the editor, grouped in --rules-doc, and
accepted by --select/--ignore and [lint] as a class word. VS Code gains
lucisv.lint.severity.{error,warning,style} and one tri-state
lucisv.lint.rules.<rule> per rule (default/on/off - a client sends
every key, so a boolean cannot say unset), generated by
vlog_linter::vscode with a drift test, and lint::enabled_rules is the
one documented ladder: defaults -> select -> class switches -> per-rule
-> ignore. Nineteen new rules (17 -> 36), one file each with true
positives and near-misses: Error - mismatched-labels,
duplicate-declaration (Semantics::duplicates(), additive),
undeclared-identifier (with a project; silent for macro text, included
fragments, hierarchical tails, any name another file mentions),
unknown-port, unknown-parameter; Warning - forbid-defparam,
invalid-system-task-function, truncated-numeric-literal,
undersized-binary-literal (safe fix), suspicious-semicolon,
packed-dimensions-range-ordering, module-port, module-parameter,
explicit-function-task-parameter-type, plusarg-assignment,
instance-shadowing, forbid-negative-array-dim, void-cast,
incomplete-assignment. Every false-positive class found on opentitan
closed with a named test; 3 383 tests / 48 binaries; corpus 814/820
and byte-identical (formatter untouched); vsix smoke OK.
docs/features/linter-expansion-1/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
965c4ee25a
commit
cebeff45b4
70 files changed
+6855
-127
No files matched your search
@@ -0,0 +1,618 @@
|
||||
# linter expansion, wave 1 (TODO §33)
|
||||
|
||||
## Goal
|
||||
|
||||
Grow the linter from 17 rules toward what Verible's 62 cover, and give a user
|
||||
a way to say which of them they want. Three things, in one lane because they
|
||||
touch the same registry: a **severity** on every rule (`error` / `warning` /
|
||||
`style`) carried end to end — into `--select`/`--ignore`, the CLI diagnostic
|
||||
line, the JSON output, the editor's squiggle colour and the generated rule
|
||||
reference; **per-rule toggles in VS Code**, generated from the registry so a
|
||||
rule cannot ship without its switch, with one documented precedence for the
|
||||
five ways a rule can be turned on or off; and the **rules that matter first** —
|
||||
the ones that say the code would not compile (Error) and the ones that say it
|
||||
does not mean what it says (Warning). The Style family and per-rule options are
|
||||
wave 2 (§34). 17 rules → **36**.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- **Severity is a property of the rule, not of the finding.** Every violation a
|
||||
rule reports is in the same class, so the runner stamps it
|
||||
(`vlog_linter::lint`) rather than each `check` remembering to. A rule whose
|
||||
findings would want two classes is two rules.
|
||||
- **`Error` means "a tool would refuse this file", and a rule may only claim
|
||||
it when it is certain.** Every Error-class rule added here is silent whenever
|
||||
the workspace cannot answer: a file that did not fully parse, a module that
|
||||
is not indexed or is indexed twice, a name a macro produces, a fragment
|
||||
written to be `` `include``d. A wrong accusation in this class is worse than
|
||||
a hundred missed ones, and the opentitan census below is what turned that
|
||||
sentence into code — every Error rule's first measurement found false
|
||||
positives, and each one became an exclusion with a test.
|
||||
- **A severity word is not a rule name.** `error`, `warning` and `style` are
|
||||
accepted wherever a rule name is, and
|
||||
`registry::every_rule_has_a_severity_and_no_name_shadows_a_class` pins that
|
||||
no rule may be named after a class.
|
||||
- **The editor's classes map to LSP severities 1/2/3.** Style is
|
||||
`INFORMATION`, not `HINT`: a hint is invisible in most themes, which would
|
||||
make the style rules look broken rather than quiet.
|
||||
- **The VS Code settings are generated, never hand-written.** The generator is
|
||||
the registry; the drift test in `lucisv_server` is what makes that true after
|
||||
the next rule is added.
|
||||
- **A file that does not parse gets no structural opinion.** `LintContext::
|
||||
parsed_cleanly` is the shared guard: error recovery unwinds out of the
|
||||
construct it failed in, so declarations that followed are bound in whatever
|
||||
scope recovery landed in. Three rules ask it before saying anything.
|
||||
- **Verible's defaults are matched unless §33 says otherwise**, options
|
||||
included: `undersized-binary-literal` exempts a zero literal because
|
||||
Verible's `lint_zero` defaults off, and checks binary only because its `oct`
|
||||
and `hex` default off. Four rules Verible ships **off** are on here by §33's
|
||||
instruction: `mismatched-labels`, `suspicious-semicolon`,
|
||||
`instance-shadowing`, `forbid-negative-array-dim`.
|
||||
|
||||
## Handshakes
|
||||
|
||||
**Consumed**
|
||||
|
||||
- `vlog_parser::ast` — unchanged. The new syntactic rules read the same nodes
|
||||
the existing ones do, through `crate::visit` and the new `crate::decls`.
|
||||
- `vlog_semantic::words::harvest_raw` — already public; `undeclared-identifier`
|
||||
reads it for the "a macro writes this name down" exclusion.
|
||||
- `vlog_semantic::WorkspaceIndex::{units, members_of}` — already public; the
|
||||
server answers `module_interface` from them.
|
||||
|
||||
**Requested and taken — `vlog_semantic`, additive (flag for the lead)**
|
||||
|
||||
`duplicate-declaration` could not be answered from the existing tables: the
|
||||
binder turns a redeclaration into a *reference* to the first declaration
|
||||
(which is what makes a non-ANSI port's body declaration attach to its header
|
||||
port), so the fact that a second declaration was written is not recoverable.
|
||||
As §33.2 anticipated, one additive query was added:
|
||||
|
||||
- `vlog_semantic::Duplicate` — name, both spans, kind, the first symbol, the
|
||||
scope.
|
||||
- `Binder::duplicates` records one on the path that already existed
|
||||
(`declare`'s "already bound" arm); nothing else in that function changed.
|
||||
- `Semantics::duplicates() -> &[Duplicate]`.
|
||||
|
||||
**No `FACTS_FORMAT` change**: nothing was added to `FileFacts`, nothing is
|
||||
persisted, and no existing answer moved — a redeclaration is still a reference
|
||||
to the first declaration everywhere it was one before. `vlog_semantic`'s own
|
||||
tests are unchanged and green.
|
||||
|
||||
**Requested and taken — `lucisv_server/src/server/notification.rs` (flag for
|
||||
the lead)**
|
||||
|
||||
Two lines. `apply_settings` republishes every open file when the lint
|
||||
*selection* changes, and compares it through a private `lint_selection()` that
|
||||
cloned `lint_select` and `lint_ignore`. §33.1 requires the same republish when
|
||||
a class switch or a per-rule toggle changes, so that function now calls the new
|
||||
`settings::lint_selection(&ClientSettings)`, which returns all four. The file
|
||||
is not on this lane's ownership list; the change is mechanically required by
|
||||
§33.1's "changing any of them republishes every open file", cannot collide with
|
||||
the §31 lane (different crate), and is called out here and in the lane report
|
||||
so the lead can rule on it at merge.
|
||||
|
||||
**Promised (new public surface of `vlog_linter`)**
|
||||
|
||||
- `Severity` (`Error` / `Warning` / `Style`) with `as_str`, `from_name`,
|
||||
`describes` and `ALL`.
|
||||
- `Rule::severity(&self) -> Severity` — **no default**; every rule states one.
|
||||
*A consumer implementing `Rule` outside this crate must add it.* No such
|
||||
consumer exists.
|
||||
- `Violation::severity` — set by `lint`, not by the reporting rule.
|
||||
- `rules_named(&str) -> Option<Vec<&'static dyn Rule>>`; `select_rules` now
|
||||
accepts severity words on either list.
|
||||
- `LintContext::parsed_cleanly()`, `LintContext::module_interface()`.
|
||||
- `MentionOracle::module_interface(&str) -> Option<ModuleInterface>` — a
|
||||
**defaulted** method returning `None`, so every existing implementor keeps
|
||||
compiling and answers "I cannot say", which leaves the two rules that ask it
|
||||
silent.
|
||||
- `ModuleInterface { ports, parameters }` with `has_port` / `has_parameter`.
|
||||
- `module_interfaces(&SourceFile)` — the CLI's reading of a parse.
|
||||
- `ParsedSource::file()`.
|
||||
- `vscode_lint_settings()`, `rule_setting`, `severity_setting`,
|
||||
`RULE_CHOICES`.
|
||||
- `rules_markdown()` gains a Severity column and groups its sections by class.
|
||||
|
||||
**Promised (CLI)** — text output is
|
||||
`FILE:LINE:COL: error|warning|style: message [rule]`; JSON gains `"severity"`.
|
||||
Exit codes unchanged.
|
||||
|
||||
**Promised (server)** — a lint diagnostic's `severity` is its rule's class;
|
||||
`lint::enabled_rules(settings, has_oracle)` is the one ladder.
|
||||
|
||||
## Status / TODO
|
||||
|
||||
- [x] 33.0 `Severity` on every rule; select/ignore by severity; CLI text/JSON;
|
||||
editor severities; `--rules-doc` grouped
|
||||
- [x] 33.1 package.json toggles generated + drift test; `enabled_rules`
|
||||
precedence pinned; republish on change
|
||||
- [x] 33.2 Error rules: mismatched-labels, duplicate-declaration,
|
||||
undeclared-identifier (measured; default decided by the count),
|
||||
unknown-port, unknown-parameter
|
||||
- [x] 33.3 Warning rules: the thirteen listed, each with tests and an
|
||||
opentitan count
|
||||
- [x] 33.4 docs; measurements table below
|
||||
- [x] Gates: fmt/clippy/`cargo test --workspace`; corpus 814/820
|
||||
byte-identical; opentitan read-only census + timing
|
||||
- [ ] QA
|
||||
|
||||
## Measurements
|
||||
|
||||
**Corpus** = lucisv's 860-file corpus (`corpus/`). **opentitan** = a read-only
|
||||
`lucisv check hw` over 3 975 files at `/Users/guoliangchen/repo/opentitan`
|
||||
(`git status --porcelain` after every run showed only the three files that were
|
||||
already modified before this lane started). "Sample" is findings read and
|
||||
classified, out of ten where there were ten.
|
||||
|
||||
| Rule | Sev | Default | Verible equivalent (its default) | Corpus | opentitan | Sample: true / false / judgment |
|
||||
|---|---|---|---|---:|---:|---|
|
||||
| `mismatched-labels` | error | on | `mismatched-labels` (off) → **on** | 0 | 1 | 1 / 0 / 0 |
|
||||
| `duplicate-declaration` | error | on | none | 0 | 0 | — (18 before the exclusions, all false) |
|
||||
| `undeclared-identifier` | error | on (project) | none | 5 | 5 | 5 / 0 / 0 |
|
||||
| `unknown-port` | error | on (project) | none | 0 | 40 | 6 / 0 / 0 |
|
||||
| `unknown-parameter` | error | on (project) | none | 1 | 4 | 4 / 0 / 0 |
|
||||
| `forbid-defparam` | warning | on | `forbid-defparam` (on) | 0 | 0 | — |
|
||||
| `invalid-system-task-function` | warning | on | same (on) | 8 | 23 | 10 / 0 / 0 |
|
||||
| `truncated-numeric-literal` | warning | on | same (on) | 0 | 0 | — (50 before the all-unknown exempt, all false) |
|
||||
| `undersized-binary-literal` | warning | on, safe fix | same (on, `lint_zero` off) | 11 | 6 | 6 / 0 / 0 |
|
||||
| `suspicious-semicolon` | warning | on | same (off) → **on** | 3 | 5 | 5 / 0 / 0 |
|
||||
| `packed-dimensions-range-ordering` | warning | on | same (on) | 0 | 4 | 4 / 0 / 0 |
|
||||
| `module-port` | warning | on | same (on) | 44 | 161 | 7 / 0 / 3 |
|
||||
| `module-parameter` | warning | on | same (on) | 2 | 0 | 2 / 0 / 0 |
|
||||
| `explicit-function-task-parameter-type` | warning | on | same (on) | 1 | 5 | 5 / 0 / 0 |
|
||||
| `plusarg-assignment` | warning | on | same (on) | 19 | 13 | 10 / 0 / 0 |
|
||||
| `instance-shadowing` | warning | on | same (off) → **on** | 28 | 129 | 3 / 0 / 0 |
|
||||
| `forbid-negative-array-dim` | warning | on | same (off) → **on** | 0 | 0 | — |
|
||||
| `void-cast` | warning | on | same (on), different subject | 0 | 0 | — (1 before the `with` fix, false) |
|
||||
| `incomplete-assignment` | warning | on | none | 3 | 0 | 3 / 0 / 0 (corpus) |
|
||||
|
||||
### Why a Verible-default-on rule fires on a "Verible-clean" tree
|
||||
|
||||
opentitan is lint-clean under Verible **for the filesets its `dvsim` lint
|
||||
configurations name** — `hw/top_*/lint/*_lint_cfgs.hjson`, which cover RTL and
|
||||
a chosen slice of DV. `lucisv check hw` covers all 3 975 files, including
|
||||
`hw/vendor/` (third-party: ibex, pulp, riscv-dv), `hw/ip/*/pre_dv`,
|
||||
`hw/ip/*/pre_sca` and `hw/ip/*/fpv`, none of which that flow lints. Every
|
||||
finding of a Verible-equivalent rule sits in one of those:
|
||||
|
||||
- `module-port` (161): every one in `hw/top_*/dv/`, mostly autogenerated
|
||||
`tb__xbar_connect.sv` interface instantiations (`tl_if tl_if(clk, rst_n)`).
|
||||
The three "judgment" samples are exactly that idiom — a two-port clocking
|
||||
interface connected positionally, which Verible would flag too.
|
||||
- `undersized-binary-literal` (6): all in `hw/vendor/`.
|
||||
- `invalid-system-task-function` (23), `plusarg-assignment` (13),
|
||||
`explicit-function-task-parameter-type` (5),
|
||||
`packed-dimensions-range-ordering` (4): DV, vendored and pre-silicon
|
||||
directories.
|
||||
- opentitan's own Verible config
|
||||
(`hw/lint/tools/veriblelint/lowrisc-styleguide.rules.verible_lint`) sets only
|
||||
four options and disables one rule; none of them is a rule this wave added.
|
||||
|
||||
### False positives found by the census and closed
|
||||
|
||||
Every one of these was found by reading opentitan findings, and every one is
|
||||
now a named exclusion with a test beside it:
|
||||
|
||||
| Rule | Before | Cause | After |
|
||||
|---|---:|---|---:|
|
||||
| `duplicate-declaration` | 18 | error recovery in a 454-error UVM file rebinds every method local at file scope; enum **name ranges** (`Gpr[0:2]`); non-ANSI port completion | 0 |
|
||||
| `undersized-binary-literal` | 456 | `2'b0` — Verible's `lint_zero` defaults **off** | 6 |
|
||||
| `truncated-numeric-literal` | 50 | `3'hz`, `7'hzz`: one hex digit is four bits, so an all-unknown literal always "overflows" | 0 |
|
||||
| `incomplete-assignment` | 3 | a temporary the block declares; a partial write before the branch; a `case` with a `default` covering every arm | 0 |
|
||||
| `void-cast` | 1 | `void'(randomize(x) with { … })` — a call wearing a postfix clause | 0 |
|
||||
| `undeclared-identifier` | 94 | `` `include``d **fragments** (a module body with no module around it: 85 of the 94); a generate label reached hierarchically | 5 |
|
||||
|
||||
### `undeclared-identifier`: the default decision
|
||||
|
||||
§33.2 made the default conditional on the count of *unexplained* findings on
|
||||
opentitan being zero. After the exclusions above it reports **five** findings,
|
||||
in one file, on both trees: `ibex/dv/formal/spec/spec_api.sv` connects
|
||||
`.mhartid_out(mhart_id_o)`, `.mimpid_out(mimp_id_o)`, `.minstret_in(minstret_i)`,
|
||||
`.minstret_out(minstret_o)` and `.mvendorid_out(mvendor_id_o)` to names its
|
||||
module header never declares — implicit one-bit nets, which is exactly what the
|
||||
rule exists to find. Unexplained: **0**. It therefore ships on wherever there
|
||||
is a project, the same terms `unused-signal` and `undriven-net` run on.
|
||||
|
||||
*The residual risk, for the lead:* the rule's safety rests on the census
|
||||
covering the whole project. A deliberately partial run (`lucisv check
|
||||
hw/ip/uart` alone) has a smaller census and could accuse a name declared in a
|
||||
directory the run did not include. The same is structurally true of
|
||||
`unused-signal`, but there the failure mode is a false *negative* and here it
|
||||
is a false positive. `--ignore undeclared-identifier`, `[lint] ignore` and the
|
||||
per-rule VS Code toggle are all off switches for it.
|
||||
|
||||
### Timing — `lucisv check hw` over opentitan (3 975 files)
|
||||
|
||||
| Build | Wall (best of 3) |
|
||||
|---|---:|
|
||||
| 0.34.0 baseline (`/tmp/lucisv-0.34.0-baseline`) | 0.91 s |
|
||||
| this lane, default rules | 0.83 s |
|
||||
| this lane, `--ignore unknown-port --ignore unknown-parameter` | 0.66 s |
|
||||
|
||||
The interface half of the CLI census costs a **parse** of every file on top of
|
||||
the lex the word census already paid for (~0.17 s here), and is built only when
|
||||
`unknown-port` or `unknown-parameter` is enabled. Even with it the run is
|
||||
*faster* than 0.34.0, because the same pass now harvests the word census from
|
||||
the parse's own tokens instead of lexing the text a second time. The nineteen
|
||||
new rules' own checking cost is inside the noise.
|
||||
|
||||
### Corpus and formatter gates
|
||||
|
||||
- `scripts/corpus_gate.sh corpus` → `{"passing":814,"total":820,"pct":99.3}`,
|
||||
the same six failures, exit 0.
|
||||
- `--stdout` over all 860 corpus files, byte-compared against the 0.34.0
|
||||
baseline binary: **860 checked, 0 differing**. The formatter is untouched.
|
||||
- `node editors/vscode/smoke.js target/debug/lucisv-server` → OK, 20 messages.
|
||||
|
||||
## Work log
|
||||
|
||||
### 2026-09-03 — 33.0, severity end to end
|
||||
|
||||
- New `vlog_linter::severity` (`Severity`, `as_str`/`from_name`/`describes`/
|
||||
`ALL`), `Rule::severity` with no default, `Violation::severity`.
|
||||
- **The runner stamps.** `lint()` ends with `stamp_severities`, which looks
|
||||
each finding's rule up in the registry. One place rather than one per rule,
|
||||
and it also covers the `unused-waiver` findings, which the waiver scanner
|
||||
builds without a rule's `check` ever running. Pinned by
|
||||
`the_runner_stamps_every_finding_with_its_rules_severity`.
|
||||
- The seventeen assignments §33.0 listed are pinned as a table test, so a rule
|
||||
changing class is a deliberate edit.
|
||||
- `select_rules` goes through the new `rules_named`. `--ignore style` and
|
||||
`[lint] ignore = ["style"]` therefore work with no change in
|
||||
`lucisv_core::config` (it never validated names).
|
||||
- CLI text gained the severity word; JSON gained `"severity"`. The server maps
|
||||
Error/Warning/Style to ERROR/WARNING/INFORMATION. Four existing tests
|
||||
asserted `WARNING` for style rules and were updated in place with the reason
|
||||
in a comment.
|
||||
- `rules_markdown` grew a Severity column, a per-rule `- Severity:` line and
|
||||
three class headings.
|
||||
|
||||
### 2026-09-03 — 33.1, the toggles
|
||||
|
||||
- New `vlog_linter::vscode` generates the whole `lucisv.lint.severity.*` +
|
||||
`lucisv.lint.rules.*` block; `examples/vscode_lint_settings.rs` prints it.
|
||||
- **Deviation from §33.1, deliberate.** The brief asked for "one boolean per
|
||||
rule, default = the rule's default", and for a precedence rung that fires
|
||||
only on an *explicitly set* toggle. Those two cannot both hold: a client
|
||||
sends the whole section with every key at its default, so a boolean cannot
|
||||
distinguish "unset" from "set to the shipped value", and rung 4 would then
|
||||
silently override `select` and the class switches for every user. The
|
||||
toggles are therefore a three-word enum — `default` / `on` / `off`, default
|
||||
`default` — which is tri-state, renders as a dropdown in the Settings UI
|
||||
(a `["boolean","null"]` schema renders as raw JSON), and states the rule's
|
||||
own default in its description and in its `enumDescriptions`.
|
||||
- `settings.rs` reads them into `lint_severity: BTreeMap<Severity, bool>` and
|
||||
`lint_rules: BTreeMap<String, bool>` (present only for `on`/`off`), on this
|
||||
module's standing rule that an unreadable value leaves the shipped default.
|
||||
The `select`/`ignore` validator now keeps severity words.
|
||||
- `lint::enabled_rules(settings, has_oracle)` is the one ladder, documented
|
||||
rung by rung and pinned by `the_enabled_rules_ladder_is_the_documented_one`,
|
||||
plus `a_class_switch_changes_what_the_server_publishes` through the real
|
||||
diagnostics path.
|
||||
- The drift guard `the_vscode_lint_toggles_match_the_registry` parses both
|
||||
`package.json` and the generator's output and compares them as JSON values.
|
||||
It caught the stale manifest three times during this lane, which is what it
|
||||
is for.
|
||||
|
||||
### 2026-09-03 — 33.2 and 33.3, the rules
|
||||
|
||||
- Nineteen rules, one file each, each with unit tests holding true positives
|
||||
**and** near-misses, and a `.lint` case in one of the four new case files
|
||||
(`literals`, `labels_and_scopes`, `statements`, `declarations`).
|
||||
- Two new shared walkers rather than growing `visit.rs` past its one sentence:
|
||||
`visit::walk_instantiations` (a plain instantiation and a `bind`'s), and a
|
||||
new `decls.rs` for every `DataType` and every `Dim` in a file, packed and
|
||||
unpacked told apart. A new `literal.rs` reads a sized based literal once for
|
||||
the two width rules.
|
||||
- `interfaces.rs` reads a parse's module headers into a `ModuleInterface`, for
|
||||
the CLI census. A header carrying **any** directive between its ports or
|
||||
parameters is reported unknowable rather than short: telling an `` `ifdef``
|
||||
arm from a macro standing where a port belongs would be a second
|
||||
preprocessor, and a short list is what turns a legal connection into an
|
||||
accusation.
|
||||
- `MentionOracle` gained one defaulted method. The CLI implements it from a
|
||||
new interface half of `Census`, built only when a rule asks; the server
|
||||
implements it from the workspace index, refusing a module the index holds
|
||||
more than once.
|
||||
- `LintContext::parsed_cleanly()` is the shared "this file's structure cannot
|
||||
be trusted" guard, asked by `duplicate-declaration`, `instance-shadowing`
|
||||
and `undeclared-identifier`.
|
||||
- One `#[allow(clippy::large_enum_variant)]` was added, on
|
||||
`context::SemanticsSlot`: `Semantics` grew past clippy's threshold when it
|
||||
gained its `duplicates` table, and boxing the lazy slot would add an
|
||||
allocation to the path that exists to avoid one. The reason is in a comment
|
||||
above it.
|
||||
- Every rule was measured on opentitan before it was called done; six false
|
||||
positive classes were found that way and closed, each with a test naming the
|
||||
file it came from. The counts are in Measurements above.
|
||||
|
||||
### 2026-09-03 — 33.4, docs
|
||||
|
||||
- README.md "Linting": the severity section, the class table, the ladder for
|
||||
`--select error` / `--ignore style`, and a 36-row rule table.
|
||||
- `editors/vscode/README.md`: two Diagnostics rows, six Settings rows and the
|
||||
five-rung precedence.
|
||||
- `docs/site/.../reference/rules.md`: the badge, the intro paragraphs on
|
||||
severity and on the Error-class discipline, a Severity column, and one
|
||||
hand-written section per new rule — with a note that `--rules-doc` is the
|
||||
generated truth. A test-free page, so it is checked by hand against
|
||||
`--rules-doc`'s section list (they match exactly).
|
||||
|
||||
## QA log
|
||||
|
||||
### 2026-09-03 — verification of 33.0–33.4, verdict PASS
|
||||
|
||||
Scope: everything on the Status/TODO list except the last box. Worked
|
||||
entirely in `.claude/worktrees/lint-1` (branch `lint-1`, based on 965c4ee,
|
||||
uncommitted); every experiment that needed a modified registry or a rebuilt
|
||||
baseline binary ran in a throwaway `git worktree` created from 965c4ee or
|
||||
999edd0 and removed when done (`baseline-965c4ee`, `throwaway-lint1`,
|
||||
`baseline-rebuild` — none left behind). Opentitan was touched read-only;
|
||||
`git -C opentitan status --porcelain` showed only the three pre-existing
|
||||
files (`hw/ip/aes/dv/tb/tb.sv`, `hw/top_darjeeling/ip/ast/rtl/ast.sv`,
|
||||
`hw/top_earlgrey/ip/ast/rtl/ast.sv`) before and after every run in this pass.
|
||||
|
||||
**1. Gates.**
|
||||
- `cargo fmt --all -- --check`: clean.
|
||||
- `cargo clippy --all-targets --workspace`: clean. The first run was a cache
|
||||
hit (0.11 s, nothing recompiled) so I re-ran it against a throwaway
|
||||
`--target-dir` to force a full rebuild of all nine workspace crates — still
|
||||
0 warnings, 14.5 s. The one new `#[allow(clippy::large_enum_variant)]` (on
|
||||
`vlog_linter::context::SemanticsSlot`) carries an explanatory comment.
|
||||
- `cargo test --workspace --no-fail-fast`: 48 binaries, **3383 passed, 0
|
||||
failed, 42 ignored** — matches the dev's reported numbers exactly.
|
||||
- `git diff --stat 965c4ee -- crates/vlog_formatter`: empty. `git diff
|
||||
--name-only 965c4ee`: confined to the §33 ownership list plus the two
|
||||
disclosed handshake files (`crates/vlog_semantic/src/{bind/mod.rs,lib.rs,
|
||||
model.rs}`, `crates/lucisv_server/src/server/notification.rs`) — nothing
|
||||
else.
|
||||
- `cargo build --release -p lucisv`: clean. `--stdout` over all 860 corpus
|
||||
files vs a freshly rebuilt 0.34.0 baseline (999edd0; `965c4ee` has no
|
||||
crate diff from it, confirmed with `git diff --stat 999edd0 965c4ee --
|
||||
crates/`): **860 checked, 0 differing**. (The originally-referenced
|
||||
`/tmp/lucisv-0.34.0-baseline` was removed by the environment between
|
||||
session restarts; rebuilding it from 999edd0 in a throwaway worktree
|
||||
produced a byte-identical binary — same size, 2 342 144 bytes — and the
|
||||
check was redone against the rebuild with the same 860/0 result.)
|
||||
- `scripts/corpus_gate.sh corpus`: `{"passing":814,"total":820,"pct":99.3}` —
|
||||
matches.
|
||||
- vsix smoke (`node editors/vscode/smoke.js target/debug/lucisv-server`): OK,
|
||||
20 messages.
|
||||
|
||||
**2. Severity plumbing.** Built a file with one violation of each class
|
||||
(`no-tabs`/style, `wire-reg-mixup`/error, `always-comb-blocking`/warning).
|
||||
Text output: `FILE:LINE:COL: error|warning|style: message [rule]`, exactly.
|
||||
JSON: every finding carries `"severity"`; the baseline's JSON for the same
|
||||
file has no such key. Exit code (1) matches the baseline binary's on the same
|
||||
file. `--select style` → only the style finding; `--ignore warning` → warning
|
||||
dropped, other two kept; `--select error --ignore mismatched-labels` → only
|
||||
`wire-reg-mixup` (the only error-class rule this file trips); `--select
|
||||
bogus` → `error: unknown rule: bogus (severities: error, warning, style;
|
||||
known rules: ...)`, exit 2. `[lint] ignore = ["style"]` in `lucisv.toml` →
|
||||
style dropped, same as `--ignore style`. `--rules-doc`: 36 rules, each with a
|
||||
severity; the seventeen original assignments in the table match
|
||||
`the_original_seventeen_keep_the_classes_they_were_given` exactly
|
||||
(`multiply-driven`/error, `wire-reg-mixup`/error, five warnings, nine
|
||||
styles).
|
||||
|
||||
**3. Editor toggles, through the real server.** No existing e2e test in
|
||||
`tests/e2e.rs` exercises `lucisv.lint.severity.*` or `lucisv.lint.rules.*`
|
||||
over the wire (only the pre-existing `lucisv.lint.ignore` case is there); the
|
||||
new settings are otherwise covered by `settings.rs` and `lint.rs` unit tests
|
||||
only. I drove the real `target/debug/lucisv-server` binary myself, framing
|
||||
JSON-RPC by hand (same Content-Length model as `tests/e2e.rs`'s `talk()`),
|
||||
one whole session per scenario so ordering could not be ambiguous:
|
||||
- (a) `severity.style=false` on a file with all three classes → style
|
||||
vanishes, error/warning stay. Correct.
|
||||
- (b) `rules.always-comb-blocking=off` (a warning rule) → that rule vanishes,
|
||||
others stay. Correct.
|
||||
- (c) `rules.module-name-style=on` (a default-off style rule, on a
|
||||
badly-named module) → it appears where it was silent before. Correct.
|
||||
- (d) `select=["style"]` + `severity.style=false` → **empty**, i.e. rung 3
|
||||
(class switch) applied after rung 2 (select) leaves nothing. Correct —
|
||||
matches `enabled_rules`'s documented ladder.
|
||||
- (e) `rules.module-name-style=on` + `ignore=["module-name-style"]` in the
|
||||
same push → absent. Rung 5 beats rung 4. Correct.
|
||||
- (f) every key sent explicitly at its default value → identical to the
|
||||
no-configuration baseline (one publish, same set). Correct.
|
||||
- A sequential single-session run (default → style off → reset to `{}` →
|
||||
a rule off) reproduced the same transitions, confirming each
|
||||
`didChangeConfiguration` payload fully replaces the settings rather than
|
||||
merging (an empty `{"lint":{}}` genuinely resets every key).
|
||||
- Diagnostic severities: `wire-reg-mixup` (error) → LSP 1, `always-comb-
|
||||
blocking` (warning) → LSP 2, `no-tabs` (style) → LSP 3 (INFORMATION).
|
||||
Confirmed.
|
||||
- **False start, resolved.** An earlier *interactive* driver (writing one
|
||||
frame, reading, writing the next) mis-reported scenario (d) as returning
|
||||
the unchanged baseline set. Cross-checked two ways: a throwaway unit test
|
||||
in a copy of `settings.rs` calling `from_payload` + `lint::enabled_rules`
|
||||
directly on the same JSON returned the correct empty set, and the
|
||||
whole-session driver above (matching `tests/e2e.rs`'s own proven model)
|
||||
also returned the correct empty set on the real wire. The interactive
|
||||
script's read/write interleaving was the bug, not the product; recorded
|
||||
here for the trail, not as a finding.
|
||||
- Drift test: read `the_vscode_lint_toggles_match_the_registry`
|
||||
(`crates/lucisv_server/src/settings.rs`). Added a fake rule
|
||||
(`qa-fake-rule`) to the registry in a throwaway worktree copy (not
|
||||
`lint-1`) without touching `package.json` — the test **failed**, naming
|
||||
the mismatch and pointing at the regenerate command. Not a test that
|
||||
cannot fail. Throwaway worktree removed afterward.
|
||||
|
||||
**4. The 19 new rules, adversarially.** For each rule: a true positive, a
|
||||
near-miss that must not fire, and a plan-named edge case, via `lucisv check
|
||||
--select <rule>` on hand-written files.
|
||||
|
||||
*Error class* (false positive here would be HIGH):
|
||||
- `mismatched-labels`: `end : wrong` fires; matching label, unlabeled `end`,
|
||||
matching `generate` block label, matching `endclass : name` all silent;
|
||||
mismatched generate label and mismatched `endclass` label both fire. All
|
||||
correct, no false positives.
|
||||
- `duplicate-declaration`: two `logic a;` fires; non-ANSI `input clk;` +
|
||||
`logic clk;` silent; two `generate` arms each declaring `x` silent; a
|
||||
macro-expanded double declaration (`` `DECLARE_X`` twice) silent. All
|
||||
correct.
|
||||
- `undeclared-identifier` (project only): a genuinely undeclared name in a
|
||||
project with no wildcard import fires; the same name is silent as a single
|
||||
file (rule is off without a workspace, confirmed via `--select` on one
|
||||
file vs. on its directory); a hierarchical tail (`u_sub.internal_sig`), a
|
||||
`$unit`-scope name declared outside any module and used from another file,
|
||||
and a name that appears only inside a macro invocation argument are all
|
||||
silent — none of these produced a false positive. **One thing worth
|
||||
recording, not a bug**: a file with *any* wildcard package import
|
||||
(`import p::*;`) gets every otherwise-unresolved value-position name
|
||||
reclassified from `Resolution::NotFound` to `Resolution::ExternalCandidate`
|
||||
at the single-file bind stage (`vlog_semantic::resolve::miss`), and the
|
||||
rule's own doc says it never looks past that — "a package member ...
|
||||
resolve[s] elsewhere and never reach[es] here." I verified this is
|
||||
unconditional: a name that is genuinely **not** a member of the
|
||||
wildcard-imported package still does not fire. This is squarely the
|
||||
documented, deliberate trade-off ("Error... a rule may only claim it when
|
||||
it is certain") — most UVM testbenches carry `import uvm_pkg::*;`, so the
|
||||
rule's real-world reach is narrower than the opentitan "5 findings, all
|
||||
true" headline number suggests on its own. Not a forcing finding since it
|
||||
matches the rule's own stated contract exactly; worth a line in the
|
||||
README's own doc if the lead wants it more visible.
|
||||
- `unknown-port` / `unknown-parameter`: `.nonexistent_port(clk)` on an
|
||||
indexed module fires; a correct connection is silent; `.*` is silent; an
|
||||
interface-typed port (`bus_if.m b`) connected by name is silent; a
|
||||
parameter override of a `localparam` (`.DOUBLE(16)`) fires as
|
||||
`unknown-parameter`, matching the dev's stated "counts it as true"; a
|
||||
module not indexed anywhere (single file, unknown submodule) is silent; a
|
||||
module indexed **twice** (two files each declaring `module leaf`) is
|
||||
silent. All eight scenarios matched the plan exactly.
|
||||
|
||||
*Warning class* (false positive here is MEDIUM): `forbid-defparam`,
|
||||
`invalid-system-task-function`, `truncated-numeric-literal` (fire on
|
||||
overflow, silent at-width, silent on an all-`z`/`x` literal),
|
||||
`undersized-binary-literal` (fire on a short literal, silent when full-width,
|
||||
silent on `4'b0`), `suspicious-semicolon`, `packed-dimensions-range-
|
||||
ordering`, `module-port` (fires on ≥2 **positional** connections, silent
|
||||
named, silent single-positional — checked the actual semantics against the
|
||||
doc after an initial wrong guess), `module-parameter` (same shape),
|
||||
`explicit-function-task-parameter-type` (fires on an untyped arg, silent
|
||||
when typed, silent when a later arg shares an earlier one's declared type —
|
||||
`int a, b` is both `int`), `plusarg-assignment`, `instance-shadowing`,
|
||||
`forbid-negative-array-dim`, `void-cast` (fires on `void'(x)` around a plain
|
||||
variable — not around a discarded call result, which is the opposite of my
|
||||
first guess; silent around a real call; silent around
|
||||
`randomize(x) with {...}`, the documented false-positive fix), and
|
||||
`incomplete-assignment` (fires on an `if` with no `else`, silent with an
|
||||
`else`, silent on a `case` with `default`). All fourteen behaved exactly as
|
||||
documented; zero false positives, zero missed true positives on the stated
|
||||
shapes. (Note: TODO §33.3 says "the thirteen listed" but the Measurements
|
||||
table lists fourteen warning-class rules delivered — a small, harmless
|
||||
wording/count mismatch, LOW.)
|
||||
|
||||
**5. Opentitan census (read-only).** `lucisv check --output-format json hw`
|
||||
(3 947 `.sv`/`.v`/`.svh`/`.vh` files by my own glob — close enough to the
|
||||
dev's 3 975 that the difference is almost certainly extension-set or a file
|
||||
added/removed since; not investigated further) produced 619 violations. One
|
||||
file failed to lex (`riscv_core_setting.tpl.sv`, a Jinja template, not real
|
||||
Verilog — pre-existing, unrelated to this lane) — same as the baseline would
|
||||
report. Per-rule counts for every §33 rule matched the README's table
|
||||
**exactly**: `mismatched-labels` 1, `undeclared-identifier` 5, `unknown-port`
|
||||
40, `unknown-parameter` 4, `invalid-system-task-function` 23,
|
||||
`undersized-binary-literal` 6, `suspicious-semicolon` 5,
|
||||
`packed-dimensions-range-ordering` 4, `module-port` 161,
|
||||
`explicit-function-task-parameter-type` 5, `plusarg-assignment` 13,
|
||||
`instance-shadowing` 129, and zero for `duplicate-declaration`,
|
||||
`forbid-defparam`, `truncated-numeric-literal`, `module-parameter`,
|
||||
`forbid-negative-array-dim`, `void-cast`, `incomplete-assignment`. Read five
|
||||
each of `undeclared-identifier` (the five `ibex/dv/formal/spec/spec_api.sv`
|
||||
implicit-net findings, exactly as documented — true), `unknown-port` (five
|
||||
`pre_dv`/`fpv` testbench-vs-RTL port mismatches — read as true, consistent
|
||||
with those directories sitting outside `dvsim`'s lint scope) and
|
||||
`instance-shadowing` (five nested-scope name reuses, e.g. loop variable `i`
|
||||
and a common `ral`/`id` — plausible warning-class findings, not false
|
||||
positives, though a few are the kind of "judgment" case the dev's own sample
|
||||
already flagged). `duplicate-declaration` and `incomplete-assignment`: 0,
|
||||
matching. `git status --porcelain` in opentitan stayed at the same three
|
||||
pre-existing files after this run.
|
||||
|
||||
**Timing — MEDIUM finding.** Rebuilt the 0.34.0 baseline (999edd0, byte-
|
||||
identical to the one the dev used) since the original was gone from `/tmp`.
|
||||
`lucisv check hw`, interleaved NEW/BASE, best of 3 (plus a separate 5-run
|
||||
pass for the new binary alone): **new lane ≈ 1.05 s, 0.34.0 baseline ≈
|
||||
0.83 s — roughly 25% slower**, on this machine, right now — the opposite of
|
||||
the dev's reported 0.83 s → 0.91 s... (dev: new *faster* than baseline; here:
|
||||
new *slower*). `--ignore unknown-port --ignore unknown-parameter` did not
|
||||
recover much (~0.92 s best of 3), unlike the dev's reported drop to 0.66 s.
|
||||
This session ran many concurrent cargo builds/tests across several worktrees
|
||||
throughout the QA pass, which is a real possible confound (shared cache
|
||||
contention, thermal throttling) — I do not have a quiet machine to rule that
|
||||
out — but the regression was consistent and reproducible across 11
|
||||
interleaved measurements, not a one-off. Flagging as MEDIUM per the timing
|
||||
threshold; recommend the dev or lead re-measure on an otherwise-idle machine
|
||||
before treating the absolute numbers as settled. This does not affect
|
||||
correctness and is not a PASS blocker on its own.
|
||||
|
||||
**6. `Semantics::duplicates()`.** `git diff 965c4ee -- crates/vlog_semantic/
|
||||
src/facts.rs`: empty — no `FACTS_FORMAT` change. Reviewed the `bind/mod.rs`,
|
||||
`model.rs` and `lib.rs` diffs directly: the "already bound" arm in
|
||||
`declare()` now also pushes a `Duplicate` record before doing exactly what it
|
||||
did before (`use_name` + return `None`); nothing else in that function
|
||||
changed. `cargo test -p vlog_semantic` in a throwaway worktree at 965c4ee vs.
|
||||
in `lint-1`: **test-for-test identical** (17 binaries, same pass count in
|
||||
each, e.g. 31/12/27/13/1/12/3/8/26+1ignored/40+1ignored/31/32/18/9/5/86+2ignored/0).
|
||||
Corpus, 17-original-rules-only: ran both the new binary and the rebuilt
|
||||
baseline with the **same explicit** `--select <the 17 original rule names>`
|
||||
over all 860 corpus files and diffed the JSON (severity field stripped for
|
||||
the comparison) — **0 differing**. (First attempt at this compared the new
|
||||
binary's explicit `--select` output against the *baseline's own default*
|
||||
run and found 13 spurious diffs, all `undriven-net`/`unused-signal` —
|
||||
these are `needs_workspace`-gated, default-off-without-a-project rules, and
|
||||
an explicit `--select` bypasses that gate in both versions identically per
|
||||
`select_rules`'s documented contract; comparing against the baseline's
|
||||
unselected default was an apples-to-oranges mistake on my part, not a
|
||||
product issue — resolved by selecting the same list on both sides.)
|
||||
|
||||
**7. Docs.** `--rules-doc`'s 36 rule names/severities match README.md's
|
||||
36-row table exactly, and match the docs-site
|
||||
`reference/rules.md`'s 36 section headers exactly (diffed all three sets
|
||||
programmatically). `editors/vscode/README.md` documents the tri-state
|
||||
dropdown (`default`/`on`/`off`) and spells out the five-rung precedence
|
||||
ladder in prose (does not use the literal words "tri-state"/"rung", but the
|
||||
content is there and correct). TODO.md §33 checkboxes match the work done;
|
||||
only the QA line is (correctly) still unchecked. **LOW**: the dev's work log
|
||||
does not record the "`docs/site/dist` was not rebuilt" note the plan
|
||||
expected — independently confirmed true (`git diff --name-only 965c4ee --
|
||||
docs/site/dist` is empty) but not written down anywhere in the feature
|
||||
README. **LOW**: §33.3's TODO text says "the thirteen listed" against
|
||||
fourteen warning rules actually delivered (see §4 above) — cosmetic.
|
||||
|
||||
**Verdict: PASS.**
|
||||
|
||||
No HIGH or CRITICAL findings. Every Error-class rule was attacked with the
|
||||
plan's own named shapes and produced zero false positives; the drift test
|
||||
provably fails when it should; the precedence ladder is correct on the real
|
||||
wire; the 17 original rules are byte-identical to baseline; opentitan is
|
||||
untouched. Two LOW documentation nits and one MEDIUM timing measurement
|
||||
(reproducible on this machine, opposite sign from the dev's own numbers,
|
||||
confounded by heavy concurrent build load during this QA pass) are recorded
|
||||
above for the lead's attention; none of them are correctness or safety-net
|
||||
issues and none block merge on their own.
|
||||
|
||||
## Review
|
||||
|
||||
**2026-09-03 — lead.** Accepted. The round is larger than any linter
|
||||
change before it — 17 → 36 rules, a severity on every one, the editor
|
||||
surface generated from the registry — and its discipline held: each
|
||||
rule is its own file with true positives and near-misses, the
|
||||
false-positive classes found on opentitan were closed one test at a
|
||||
time (456 → 6 on `undersized-binary-literal` by matching Verible's
|
||||
`lint_zero` default; 94 → 5 on `undeclared-identifier` by giving an
|
||||
`` `include``d fragment no opinion), and the drift test was proved able
|
||||
to fail. Two decisions the plan did not make are the right ones: the
|
||||
per-rule setting is tri-state because a VS Code client sends every key
|
||||
at its default and a boolean cannot say "unset" — the plan's boolean
|
||||
would have silently overridden `select` and the class switches for
|
||||
every user; and `undeclared-identifier` ships on-with-a-project because
|
||||
its unexplained count is zero and its silence rule (any other file
|
||||
mentioning the name) is the false-negative-safe direction the semantic
|
||||
lints already use. The two handshakes taken (`Semantics::duplicates()`,
|
||||
additive, no store change; two lines in `notification.rs` so a toggle
|
||||
republishes) are accepted. QA's MEDIUM timing note was measured under
|
||||
another lane's compiles; re-measured at merge on a quiet machine and
|
||||
recorded below. Ships in 0.36.0. Wave 2 (§34) takes the Style family
|
||||
and per-rule options.
|
||||
@@ -1,31 +1,56 @@
|
||||
---
|
||||
title: Lint rules
|
||||
description: Complete reference for all seventeen lucisv lint rules, their defaults, fixes, and rationale.
|
||||
description: Complete reference for every lucisv lint rule, its severity, default, fix, and rationale.
|
||||
---
|
||||
|
||||
<span class="badge">17 rules indexed</span>
|
||||
<span class="badge">36 rules indexed</span>
|
||||
|
||||
Every rule is in one of three **severity** classes. `error` is code that would very likely fail to compile, elaborate or synthesize; `warning` is code that compiles and very likely does not mean what it says; `style` is code that is correct and reads badly. The class is the word in the CLI diagnostic line (`FILE:LINE:COL: warning: …`), the `severity` field of `--output-format json`, and the colour of the editor's squiggle — and it is accepted wherever a rule name is, so `--ignore style` and `--select error` both work.
|
||||
|
||||
Every `error`-class rule is held to one discipline: it goes **silent whenever the run cannot answer** — a file that did not fully parse, a module the project does not hold or holds twice, a name a macro produces, a fragment written to be `` `include``d. A wrong accusation in that class is worse than a hundred missed ones.
|
||||
|
||||
This page is hand-written prose. The generated truth is `lucisv check --rules-doc`, which prints every rule with its class, default, fix and rationale straight from the registry.
|
||||
|
||||
A rule marked **on (project)** runs by default only where lucisv can see the other files of your project — `lucisv check <dir>`, or the language server. Over a single file or a stdin buffer it is off and must be `--select`ed, because its one false-positive mode is a use in another file. Turn any rule off with `--ignore`, with `ignore` under `[lint]` in `lucisv.toml`, or with `lucisv.lint.ignore` in your editor.
|
||||
|
||||
| Rule | Default | Fix | Purpose |
|
||||
|---|:---:|:---:|---|
|
||||
| [`always-comb-blocking`](#always-comb-blocking) | on | — | Use `=` inside `always_comb` |
|
||||
| [`always-ff-non-blocking`](#always-ff-non-blocking) | on | — | Use `<=` inside `always_ff` |
|
||||
| [`case-missing-default`](#case-missing-default) | on | — | Give every case a default branch |
|
||||
| [`empty-item`](#empty-item) | on | safe | Drop a `;` that stands where an item belongs |
|
||||
| [`enum-name-style`](#enum-name-style) | on | — | Name enum typedefs with `_e` or `_t` |
|
||||
| [`explicit-parameter-storage-type`](#explicit-parameter-storage-type) | on | — | Declare parameter storage types |
|
||||
| [`module-filename`](#module-filename) | on | — | Match one-module files to module names |
|
||||
| [`module-name-style`](#module-name-style) | off | — | Use lower_snake_case module names |
|
||||
| [`multiply-driven`](#multiply-driven) | on (project) | — | Give variables one driver |
|
||||
| [`no-tabs`](#no-tabs) | on | safe | Use spaces outside string literals |
|
||||
| [`no-trailing-whitespace`](#no-trailing-whitespace) | on | safe | Remove end-of-line whitespace |
|
||||
| [`parameter-name-style`](#parameter-name-style) | on | — | Use CamelCase or ALL_CAPS parameters |
|
||||
| [`struct-union-name-style`](#struct-union-name-style) | on | — | Name aggregate typedefs with `_t` |
|
||||
| [`undriven-net`](#undriven-net) | on (project) | — | Drive signals that are read |
|
||||
| [`unused-signal`](#unused-signal) | on (project) | — | Detect unreferenced internal signals |
|
||||
| [`unused-waiver`](#unused-waiver) | on | — | Remove ineffective suppressions |
|
||||
| [`wire-reg-mixup`](#wire-reg-mixup) | on | — | Prefer `logic` to `reg` in SystemVerilog |
|
||||
| Rule | Severity | Default | Fix | Purpose |
|
||||
|---|:---:|:---:|:---:|---|
|
||||
| [`always-comb-blocking`](#always-comb-blocking) | warning | on | — | Use `=` inside `always_comb` |
|
||||
| [`always-ff-non-blocking`](#always-ff-non-blocking) | warning | on | — | Use `<=` inside `always_ff` |
|
||||
| [`case-missing-default`](#case-missing-default) | warning | on | — | Give every case a default branch |
|
||||
| [`duplicate-declaration`](#duplicate-declaration) | error | on | — | Declare each name once per scope |
|
||||
| [`empty-item`](#empty-item) | style | on | safe | Drop a `;` that stands where an item belongs |
|
||||
| [`enum-name-style`](#enum-name-style) | style | on | — | Name enum typedefs with `_e` or `_t` |
|
||||
| [`explicit-function-task-parameter-type`](#explicit-function-task-parameter-type) | warning | on | — | Type every function and task argument |
|
||||
| [`explicit-parameter-storage-type`](#explicit-parameter-storage-type) | style | on | — | Declare parameter storage types |
|
||||
| [`forbid-defparam`](#forbid-defparam) | warning | on | — | Override at the instantiation, not with `defparam` |
|
||||
| [`forbid-negative-array-dim`](#forbid-negative-array-dim) | warning | on | — | Keep negative literals out of dimensions |
|
||||
| [`incomplete-assignment`](#incomplete-assignment) | warning | on | — | Assign on every path of an `always_comb` |
|
||||
| [`instance-shadowing`](#instance-shadowing) | warning | on | — | Do not hide an enclosing declaration |
|
||||
| [`invalid-system-task-function`](#invalid-system-task-function) | warning | on | — | Avoid deprecated and non-reproducible system tasks |
|
||||
| [`mismatched-labels`](#mismatched-labels) | error | on | — | Make an end label name its own block |
|
||||
| [`module-filename`](#module-filename) | style | on | — | Match one-module files to module names |
|
||||
| [`module-name-style`](#module-name-style) | style | off | — | Use lower_snake_case module names |
|
||||
| [`module-parameter`](#module-parameter) | warning | on | — | Override more than one parameter by name |
|
||||
| [`module-port`](#module-port) | warning | on | — | Connect more than one port by name |
|
||||
| [`multiply-driven`](#multiply-driven) | error | on (project) | — | Give variables one driver |
|
||||
| [`no-tabs`](#no-tabs) | style | on | safe | Use spaces outside string literals |
|
||||
| [`no-trailing-whitespace`](#no-trailing-whitespace) | style | on | safe | Remove end-of-line whitespace |
|
||||
| [`packed-dimensions-range-ordering`](#packed-dimensions-range-ordering) | warning | on | — | Write a packed dimension `[N-1:0]` |
|
||||
| [`parameter-name-style`](#parameter-name-style) | style | on | — | Use CamelCase or ALL_CAPS parameters |
|
||||
| [`plusarg-assignment`](#plusarg-assignment) | warning | on | — | Read a plusarg with `$value$plusargs` |
|
||||
| [`struct-union-name-style`](#struct-union-name-style) | style | on | — | Name aggregate typedefs with `_t` |
|
||||
| [`suspicious-semicolon`](#suspicious-semicolon) | warning | on | — | No `if (x);` or `while (x);` |
|
||||
| [`truncated-numeric-literal`](#truncated-numeric-literal) | warning | on | — | Keep a sized literal inside its width |
|
||||
| [`undeclared-identifier`](#undeclared-identifier) | error | on (project) | — | Use a name something declares |
|
||||
| [`undersized-binary-literal`](#undersized-binary-literal) | warning | on | safe | Write every bit of a sized binary literal |
|
||||
| [`undriven-net`](#undriven-net) | warning | on (project) | — | Drive signals that are read |
|
||||
| [`unknown-parameter`](#unknown-parameter) | error | on (project) | — | Override only parameters the module declares |
|
||||
| [`unknown-port`](#unknown-port) | error | on (project) | — | Connect only ports the module declares |
|
||||
| [`unused-signal`](#unused-signal) | warning | on (project) | — | Detect unreferenced internal signals |
|
||||
| [`unused-waiver`](#unused-waiver) | style | on | — | Remove ineffective suppressions |
|
||||
| [`void-cast`](#void-cast) | warning | on | — | Cast to `void` only what a call returns |
|
||||
| [`wire-reg-mixup`](#wire-reg-mixup) | error | on | — | Prefer `logic` to `reg` in SystemVerilog |
|
||||
|
||||
## always-comb-blocking
|
||||
|
||||
@@ -94,3 +119,79 @@ Reports malformed, unknown, or ineffective waiver comments when their target rul
|
||||
## wire-reg-mixup
|
||||
|
||||
Reports `reg` in `.sv` and `.svh` files and recommends `logic`. Verilog `.v`/`.vh` files and unnamed stdin are exempt; `wire` remains valid and is never flagged.
|
||||
|
||||
## duplicate-declaration
|
||||
|
||||
Reports a name a scope binds twice — two signals, two parameters, two typedefs, two instances. It is silent whenever the second declaration might be legal: a **port** on either side (a non-ANSI port is completed by its body declarations, all legally), a function, task, class, constraint, covergroup, property, sequence, modport or clocking name (each has a prototype-plus-definition or forward-declaration form), an enum **name range** (`Gpr[0:2]` declares a run of members under one written identifier), a `generate` scope, a pair separated by a conditional-compilation directive, the file scope, and any file that did not fully parse. Measured on opentitan: 18 findings before those exclusions, all of them phantoms from one 454-error UVM file, and 0 after.
|
||||
|
||||
## explicit-function-task-parameter-type
|
||||
|
||||
Reports a task or function formal with no storage type, which the language makes a one-bit `logic` (IEEE 1800 §13.3). Only the argument that *opens* a declaration is judged — a continuation (`f(input int a, b)`) inherits — and a DPI import's unnamed formal is not this rule's subject. Verible's `explicit-function-task-parameter-type`, same default.
|
||||
|
||||
## forbid-defparam
|
||||
|
||||
Reports `defparam`, deprecated since IEEE 1800-2009 and rejected outright by several synthesis tools. The `#(.NAME(value))` override at the instantiation says the same thing where the instance is. Verible's `forbid-defparam`, same default.
|
||||
|
||||
## forbid-negative-array-dim
|
||||
|
||||
Reports a written negative literal inside a dimension, packed or unpacked — the shape `[WIDTH-1:0]` collapses to when `WIDTH` comes out zero. Only a literal is judged; an expression that would evaluate negative needs parameter values lucisv does not have. Verible ships this off; lucisv turns it on, because a negative literal spelled out in a dimension has no legitimate reading.
|
||||
|
||||
## incomplete-assignment
|
||||
|
||||
Reports a variable an `always_comb` writes under an `if` with no `else`, or in some arms of a `default`-less `case`, and nowhere unconditionally before — a latch inferred where none was wanted. Conservative by construction: it reads only the top level of the block, treats a partial write and an every-arm `if`/`else` or `case` as coverage, and never reports a name the block declares for itself. No Verible equivalent. Measured on opentitan: 3 findings before those exclusions, all false, 0 after; 3 on lucisv's corpus, all real latches in `common_cells/src/deprecated`.
|
||||
|
||||
## instance-shadowing
|
||||
|
||||
Reports a declaration that hides one from an enclosing scope of the same design unit — the block-local `count` that quietly changes what every `count` in the block means. Only data and instances are judged (a subroutine argument named after a signal is idiomatic), and only within one unit. Verible ships this off; lucisv turns it on.
|
||||
|
||||
## invalid-system-task-function
|
||||
|
||||
Reports `$random`, `$srandom`, the `$dist_*` family and `$psprintf`, and names the replacement. The random family all draw from one global generator, so a call added anywhere reshuffles every other stream and a failing seed stops reproducing; `$psprintf` is a vendor spelling of `$sformatf`. Verible's `invalid-system-task-function`, same list, same default.
|
||||
|
||||
## mismatched-labels
|
||||
|
||||
Reports an end label that does not name the block it closes, and an `end : name` on a block that has none — both compile errors (IEEE 1800 §9.3.4). Every construct that may carry a footer label is checked with one answer: module, interface, program, package, class, function, task, `begin`, `fork`/`join`, generate block, clocking block, covergroup, property and sequence. Verible ships this off; lucisv turns it on and files it as an error.
|
||||
|
||||
## module-parameter
|
||||
|
||||
Reports more than one positional parameter override, which binds by order and silently changes what every instance elaborates to when a parameter is added or two are swapped. Verible's `module-parameter`, same default.
|
||||
|
||||
## module-port
|
||||
|
||||
Reports more than one positional port connection, for the same reason. A single-port instance has no order to get wrong and is left alone. Verible's `module-port`, same default.
|
||||
|
||||
## packed-dimensions-range-ordering
|
||||
|
||||
Reports a packed dimension that counts upwards (`[0:7]`, `[0:WIDTH-1]`), where bit 0 is the most significant one and every concatenation with an ordinary `[7:0]` vector silently reverses. Unpacked arrays are not judged — an ascending array is normal — and two symbolic bounds lucisv cannot compare are left alone. Verible's `packed-dimensions-range-ordering`, same default.
|
||||
|
||||
## plusarg-assignment
|
||||
|
||||
Reports `$test$plusargs`, which matches by *prefix* — `+foobar` makes `$test$plusargs("foo")` true — and asks for `$value$plusargs`, which matches the whole name and hands back the value. Verible's `plusarg-assignment`, same default.
|
||||
|
||||
## suspicious-semicolon
|
||||
|
||||
Reports `if (x);`, `for (…);`, `while (…);` and their relatives, where the `;` is the whole body and whatever is indented under it runs unconditionally. A deliberately empty body is `begin end` and is not reported. Verible ships this off; lucisv turns it on, because the finding is a typo rather than a matter of taste.
|
||||
|
||||
## truncated-numeric-literal
|
||||
|
||||
Reports a sized literal whose digits need more bits than it declares (`4'hFFF`), which most simulators truncate silently. Leading zeros do not count, and a literal whose digits are all `x`/`z` (`3'hz`) is left alone — those spell an unknown of that width. Verible's `truncated-numeric-literal`, same default.
|
||||
|
||||
## undeclared-identifier
|
||||
|
||||
Reports a name this file does not declare, that no external unit it names could supply, and that **no other file in the project writes down at all**. Every clause is an exclusion, and they are what make an error-class rule about names safe: no project behind the run means no opinion, and so do a name any macro, directive or attribute in the file writes down, a file that did not fully parse, and an `` `include``d fragment with no unit of its own. Measured on opentitan `hw/` and on lucisv's corpus: the same five findings, all real implicit nets in one ibex formal file. No Verible equivalent.
|
||||
|
||||
## undersized-binary-literal
|
||||
|
||||
Reports a sized binary literal that writes fewer digits than its width (`8'b1`), and its safe fix writes the extension the language would have applied — `0` for a literal starting with `0` or `1`, the unknown itself for one starting with `x` or `z`. A literal whose value is zero is exempt, matching Verible's `lint_zero` default. Verible's `undersized-binary-literal`, same bases, same defaults.
|
||||
|
||||
## unknown-parameter
|
||||
|
||||
Reports a `#(.NAME(…))` override naming a parameter the instantiated module does not declare — including a `localparam`, which is not overridable at all. It is silent whenever the project cannot answer: no project, an unindexed module, one declared twice with different headers, one whose header carries a compiler directive, a scope-qualified instantiation. Measured on opentitan: 4 findings, spot-checked true. No Verible equivalent.
|
||||
|
||||
## unknown-port
|
||||
|
||||
Reports a `.name(…)` connection naming a port the instantiated module does not declare — the port rename that reached three of four instantiations. Same silences as `unknown-parameter`; `.*` names nothing and is not judged. Measured on opentitan: 40 findings, spot-checked true, all in pre-silicon testbenches out of step with their RTL. No Verible equivalent.
|
||||
|
||||
## void-cast
|
||||
|
||||
Reports `void'(…)` around something that is not a call, where there is no return value to discard — the missing call, or the cast left over from an edit. Verible's `void-cast` forbids a *named list* of calls instead, so the two do not overlap; the named-call form is wave 2's business. Only a cast standing as a statement is judged.
|
||||
Reference in new issue
Block a user