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
@@ -15,7 +15,9 @@ lucisv check --output-format json rtl/
|
||||
|
||||
## Selecting rules
|
||||
|
||||
`--select` replaces the default set with a comma-separated list. It can be repeated. `--ignore` then removes rules from the selected or default set. Semantic rules such as `unused-signal`, `undriven-net`, and `multiply-driven` are opt-in because a single-file view cannot see all hierarchy interactions.
|
||||
`--select` replaces the default set with a comma-separated list. It can be repeated. `--ignore` then removes rules from the selected or default set. Both can also be written in `lucisv.toml` under a `[lint]` table (`select = [...]`, `ignore = [...]`), which a command-line flag overrides key by key, and in an editor as `lucisv.lint.select` / `lucisv.lint.ignore`.
|
||||
|
||||
The semantic rules — `unused-signal`, `undriven-net`, `multiply-driven` — run by default wherever lucisv can see the other files of your project (`lucisv check rtl/`, or the language server), because it can then tell that another file reads a signal through a hierarchical path. Over a **single file** or a stdin buffer there is nothing to ask, so they are off and must be `--select`ed.
|
||||
|
||||
## Fixes
|
||||
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
---
|
||||
title: Lint rules
|
||||
description: Complete reference for all sixteen lucisv lint rules, their defaults, fixes, and rationale.
|
||||
description: Complete reference for all seventeen lucisv lint rules, their defaults, fixes, and rationale.
|
||||
---
|
||||
|
||||
<span class="badge">16 rules indexed</span>
|
||||
|
||||
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) | off | — | Give variables one driver |
|
||||
| [`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) | off | — | Drive signals that are read |
|
||||
| [`unused-signal`](#unused-signal) | off | — | Detect unreferenced internal signals |
|
||||
| [`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 |
|
||||
|
||||
@@ -36,6 +39,10 @@ Reports blocking assignments inside `always_ff`. Immediate updates can create si
|
||||
|
||||
Reports `case`, `casex`, and `casez` statements without `default`, including `unique` and `priority` cases. The correct default action is a design decision.
|
||||
|
||||
## empty-item
|
||||
|
||||
Reports a lone `;` where an item belongs — after `endgenerate`, after a generate block's `end`, after `endmodule`, or anywhere else in a module, package, interface, program or class body. It is a legal *null item* (IEEE 1800-2017 A.1.4) that does nothing, almost always a semicolon carried over from a statement context; slang reports the same shape as `-Wempty-member`. Its safe fix deletes the `;`, and the line with it when nothing else stood there; a comment on that line is kept.
|
||||
|
||||
## enum-name-style
|
||||
|
||||
Requires `typedef enum` names to match lower_snake_case ending in `_e` or `_t`. Anonymous enums and escaped identifiers are exempt.
|
||||
@@ -54,7 +61,7 @@ Requires lower_snake_case module names. It is opt-in because naming policy is pr
|
||||
|
||||
## multiply-driven
|
||||
|
||||
Reports SystemVerilog variables written by multiple sources. Nets are intentionally excluded, as are partial writes, generated alternatives, preprocessor alternatives, initializers, initial blocks, and function/task bodies where the analysis cannot prove a conflict.
|
||||
Reports SystemVerilog variables written by multiple sources. Nets are intentionally excluded, as are partial writes, generated alternatives, preprocessor alternatives, initializers, initial blocks, and function/task bodies where the analysis cannot prove a conflict. It never consults the project census — nothing another file does can take an in-file driver away — but it shares the other two rules' default: on wherever there is a project, off for a single file.
|
||||
|
||||
## no-tabs
|
||||
|
||||
@@ -74,11 +81,11 @@ Requires `typedef struct` and `typedef union` names to use lower_snake_case endi
|
||||
|
||||
## undriven-net
|
||||
|
||||
Reports internal signals that are read but never driven. It stays silent for ports, instance/gate connections, task arguments, macros, directives, verbatim or unparsed regions, wildcard connections, and declarations with initializers to avoid false positives.
|
||||
Reports internal signals that are read but never driven. It stays silent for ports, instance/gate connections, task arguments, macros, directives, verbatim or unparsed regions, wildcard connections, and declarations with initializers to avoid false positives — and, over a project, for any name another file writes down, which may be driving it through a hierarchical assignment or a testbench `force`.
|
||||
|
||||
## unused-signal
|
||||
|
||||
Reports internal nets or variables with no use. Ports, intentionally unused names, and names mentioned anywhere in raw tokens are excluded. The rule is opt-in because cross-file hierarchy can establish uses a single-file analysis cannot see.
|
||||
Reports internal nets or variables with no use. Ports, intentionally unused names, and names mentioned anywhere in raw tokens are excluded — and, over a project, any name another file writes down, since cross-file hierarchy can establish uses a single-file analysis cannot see. That is why the rule runs by default over a directory and stays off for one file.
|
||||
|
||||
## unused-waiver
|
||||
|
||||
|
||||
Reference in new issue
Block a user