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:
lucioandClaude Fable 5 committed 2026-09-03 17:49:03 -07:00
1 parent 965c4ee25a
commit cebeff45b4
70 files changed
+6855 -127

No files matched your search

+122 -21
View File
@@ -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&nbsp;(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&nbsp;(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&nbsp;(project) | — | Drive signals that are read |
| [`unused-signal`](#unused-signal) | on&nbsp;(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&nbsp;(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&nbsp;(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&nbsp;(project) | — | Drive signals that are read |
| [`unknown-parameter`](#unknown-parameter) | error | on&nbsp;(project) | — | Override only parameters the module declares |
| [`unknown-port`](#unknown-port) | error | on&nbsp;(project) | — | Connect only ports the module declares |
| [`unused-signal`](#unused-signal) | warning | on&nbsp;(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.