Every tracked file that can carry a comment (880 of them) now opens with "Author: Guoliang Chen, a Senior Digital Design Engineer" and closes with "Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com", in the file's own comment syntax. No behaviour change: the diff outside the version bump and changelogs is comment lines only. - tools/stamp_author.py: writes the lines; idempotent, `--check` lists what is missing. Headers go under a shebang and under Markdown front matter. - Left alone: test fixtures, cases and snapshots (byte-exact inputs), JSON and JSONL, logs, images, lockfiles, docs/site/dist (regenerated) and the LICENSE files (already carry the copyright line). - tools/linux_check.sh: --help reads its header from line 3, now that the author line sits under the shebang. - tools/gates.sh green on this tree: 5 545 tests, corpus 814/6 as before. Co-Authored-By: Claude Mythos 5.2 <[email protected]>
580 lines
40 KiB
Markdown
580 lines
40 KiB
Markdown
<!-- Author: Guoliang Chen, a Senior Digital Design Engineer -->
|
||
|
||
# linter expansion, wave 3 — the remaining Verible rules
|
||
|
||
## Goal
|
||
|
||
TODO §35. The rules Verible publishes that lucisv did not have: nineteen new
|
||
files on the §33/§34 pattern (severity, Verible name/description/default
|
||
cited in the rule's own `doc`, options through `OptionSpec`, true positives
|
||
and near-misses in unit tests, a `.lint` case, corpus + opentitan counts with
|
||
ten findings classified), plus the two reconciliations §35 asked for —
|
||
Verible's *forbidden-symbol* list folded into `invalid-system-task-function`
|
||
as a `symbols` option rather than shipped as a second rule that would fire
|
||
twice on `$psprintf`, and Verible's forbidden-call half of `void-cast` added
|
||
to lucisv's existing rule as a `forbidden_calls` option. The registry goes
|
||
from 54 rules to **73**, which is every rule in Verible's published list
|
||
except `forbid-implicit-declarations`. Plus §34's open LOW: a checked-in
|
||
`tests/e2e.rs` case for `lucisv.lint.options` over the wire.
|
||
|
||
## Assumptions
|
||
|
||
- **Verible is the reference, read during the round.** Every rule's `doc`
|
||
quotes its Verible equivalent's one-line description and states its
|
||
enabled-by-default flag, both read from
|
||
<https://chipsalliance.github.io/verible/lint.html> and — where the
|
||
published page is too thin to implement from — from the rule's own source
|
||
and test files under
|
||
`verible/verilog/analysis/checkers/` on 2026-09-04. Each deviation is
|
||
listed in the work log and named in the rule's own `doc`.
|
||
- **`forbidden-symbol` is not a Verible rule.** It is the name of the *source
|
||
file* (`forbidden-symbol-rule.cc`) in which Verible implements
|
||
`invalid-system-task-function`; that file's descriptor registers the name
|
||
`"invalid-system-task-function"` and its map is the ten `$psprintf` /
|
||
`$random` / `$srandom` / `$dist_*` entries lucisv already shipped. Shipping
|
||
a second rule would have meant two findings on every `$psprintf`, which is
|
||
what §35 forbade; the list is the `symbols` option instead. Verified by
|
||
reading the file, not from memory.
|
||
- **A parser that refuses a construct still lets a rule report it.** lucisv's
|
||
parser rejects a module-scope `begin … end` and a bare `begin` inside a
|
||
`generate` region (both are illegal or legacy), leaving an `ItemKind::Error`
|
||
leaf whose first token is `begin`. `module-begin-block` and
|
||
`v2001-generate-begin` read that leaf. The finding is exact — no legal item
|
||
in either scope starts with that keyword — but error recovery unwinds out of
|
||
the enclosing unit, so a file with one of these reports little else. Filed
|
||
as a parser gap in `docs/coverage_gaps.md`; see Handshakes.
|
||
- **A `.svh` fragment is judged as the file it is, not as the class it is
|
||
included into.** The two lifetime rules report methods in a fragment that
|
||
only becomes a class body after `` `include``. Verible, which also lints one
|
||
file at a time, reports the same. 39 of the two rules' 101 opentitan
|
||
findings are that shape.
|
||
- **Where an option list replaces a Verible constant, the default is
|
||
Verible's constant.** `forbidden-macro.macros` = `["uvm_warning"]`,
|
||
`void-cast.forbidden_calls` = `["uvm_hdl_read", "randomize"]`,
|
||
`invalid-system-task-function.symbols` = the ten names — so a run that
|
||
configures nothing behaves exactly as Verible does. `dff-name-style`'s four
|
||
options are Verible's, with its comma-separated strings written as lists
|
||
(which is how every other lucisv list option is spelled) and its
|
||
`waive_lhs_regex` default `(?i)mem.*` rewritten `[mM][eE][mM].*`, because
|
||
`crates/vlog_linter/src/regex.rs` implements no inline flags and refuses
|
||
`(?…)` by name.
|
||
|
||
## Handshakes
|
||
|
||
- **Consumed** — `vlog_parser::ast` (unchanged: `FunctionDecl::scope`,
|
||
`RawText`, `Genvar`, `GenerateRegion`, `StmtKind::Disable`,
|
||
`ExprKind::Ternary`/`Scope`/`Call` are all read as they stand),
|
||
`vlog_parser::token` (a macro invocation is one `Ident` starting with a
|
||
backtick; a directive is one `Directive` to end of line — both facts are now
|
||
read in one place, `crate::preproc`), `vlog_linter::options` and
|
||
`LintContext::option_*` from §34, unchanged.
|
||
- **Promised (new inside `vlog_linter`, all `pub(crate)`)** —
|
||
`visit::ItemScope` + `visit::walk_items_scoped` (the enclosing *declaration*
|
||
of an item), `exprs::walk_exprs` (every expression of a file),
|
||
`preproc::{macro_name, directive_word, directive_operand}`. No public API of
|
||
the crate changed; `Rule` and `OptionSpec` are exactly §34's.
|
||
- **Promised (user-visible)** — nineteen new rule names, and two new option
|
||
keys on rules that already existed: `invalid-system-task-function.symbols`
|
||
and `void-cast.forbidden_calls`. Both default to the behaviour 0.38.0
|
||
shipped, and `invalid-system-task-function`'s finding list is **byte-identical**
|
||
to 0.38.0's on both trees (measured below).
|
||
- **Files touched outside `vlog_linter`, each minimal and named by §35:**
|
||
- `editors/vscode/package.json` — regenerated by
|
||
`cargo run -p vlog_linter --example vscode_lint_settings`; nothing
|
||
hand-edited. The drift test in `lucisv_server` proves it.
|
||
- `crates/lucisv_server/tests/e2e.rs` — one new test, §35's own item.
|
||
- `README.md`, `docs/site/src/content/docs/reference/rules.md`,
|
||
`docs/coverage_gaps.md`, `TODO.md` — documentation, §35's own items.
|
||
- **Handshake request to the parser (not made as an edit):** recover a
|
||
module-scope `begin … end` and a bare `begin` inside a `generate` region as
|
||
an unnamed generate block instead of an error leaf, so the *rest* of the
|
||
unit survives. Both rules would then read a tree, and every other rule would
|
||
keep working on such a file. Recorded in `docs/coverage_gaps.md`'s linter
|
||
addendum; no `vlog_parser` file was touched by this lane.
|
||
- **Not changed, deliberately** — `vlog_formatter`, `verify.rs`,
|
||
`vlog_parser` (`git diff` over all three is empty); the formatter's corpus
|
||
output is byte-identical to 0.38.0.
|
||
|
||
## Status / TODO
|
||
|
||
- [x] 35.1 the nineteen rules, each with unit tests, a `.lint` case and
|
||
corpus + opentitan counts
|
||
- [x] 35.2 `void-cast`'s `forbidden_calls`; `forbidden-macro`'s `macros`;
|
||
`invalid-system-task-function` reconciled with Verible's
|
||
`forbidden-symbol` (one rule, one `symbols` option — the decision and
|
||
its evidence are in Assumptions)
|
||
- [x] 35.3 a checked-in `tests/e2e.rs` case for `lucisv.lint.options`
|
||
- [x] 35.4 docs: README "Linting" rows, the docs-site rules page, the
|
||
`coverage_gaps.md` linter addendum, `package.json` regenerated
|
||
- [x] Gates (guarded): fmt, clippy 0, `cargo test --workspace` 3 695/48,
|
||
corpus 814/820, `--stdout` byte-identity 0 differing, vsix smoke,
|
||
opentitan census + timing
|
||
- [ ] QA
|
||
|
||
## The rules, measured
|
||
|
||
Counts are `lucisv check --select <rule> --no-config` over the 860-file corpus
|
||
and over `~/repo/opentitan/hw` (10 k files, read-only), with the release
|
||
binary of this branch. "V" is Verible's default for the same rule; lucisv
|
||
matches it for all nineteen. Ten findings per rule were read where there are
|
||
ten; where there are fewer, all of them were.
|
||
|
||
| Rule | Sev | Default (V→here) | Verible equivalent | Options (default) | Corpus | opentitan | Findings read |
|
||
|---|---|---|---|---|---|---|---|
|
||
| `module-begin-block` | style | on→on | same | — | 0 | 0 | **0 on either tree** — no real file writes a sequential block at module scope, which is what makes it illegal. Pinned by unit tests and a `.lint` case, and confirmed firing through the release binary on a crafted file |
|
||
| `legacy-generate-region` | style | off→off | same | — | 6 | 3 | 9 true (all there are): `picorv32.v` ×3, `picorv32/scripts/{quartus,vivado}/system.v`, `common_cells/src/deprecated/generic_LFSR_8bit.sv`, `aes/pre_dv/…/tlul_delayer.sv`, `ascon/pre_dv/…/ascon_sim.sv`, `pulp_riscv_dbg/sva/dm_top_sva.sv`. Every one is Verilog-2001-era or vendored code — which is exactly why the rule ships off |
|
||
| `legacy-genvar-declaration` | style | off→off | same | — | 0 | 1 | 1 true (all there is): `pulp_riscv_dbg/sva/dm_top_sva.sv:55` writes `genvar i;` above the `for` that uses it — the same file `legacy-generate-region` flags one line earlier |
|
||
| `v2001-generate-begin` | style | on→on | same | — | 0 | 0 | **0 on either tree.** Pinned by unit tests and a `.lint` case, and confirmed firing through the release binary on a crafted file |
|
||
| `explicit-function-lifetime` | style | on→on | same | — | 29 | 32 | 10 read, all true: `.svh` fragments included into *modules* (`prim_util_memload.svh`, `prim_util_get_scramble_params.svh` — there a function really is static by default) and `pre_dv` program bodies. **The out-of-body exemption is what made this number honest**: before it, 948 of 960 findings across this rule and its twin were `function cls::f(…)` definitions, which are class methods |
|
||
| `explicit-task-lifetime` | style | on→on | same | — | 47 | 69 | 10 read: 2 true (`prim_util_memload.svh`'s `simutil_memload`, a `pre_dv` program task), 8 **needs judgment** — `cip_base_vseq__*.svh`, fragments `` `include``d *inside* a class body, where lucisv (and Verible, which also lints per file) cannot see the class. All in `dv/`, outside opentitan's lint filesets |
|
||
| `positive-meaning-parameter-name` | style | on→on | same | — | 0 | 0 | **0 on either tree** — neither codebase names a parameter `disable*`. Pinned by unit tests (four spellings, four near-misses) and a `.lint` case; confirmed firing through the release binary |
|
||
| `suggest-parentheses` | style | on→on | same | — | 0 | 0 | **0 on either tree** — `a ? b ? c : d : e` is written by nobody; people parenthesize. Pinned by unit tests (including three-deep) and a `.lint` case with its safe fix; confirmed firing through the release binary |
|
||
| `unpacked-dimensions-range-ordering` | style | on→on | same | — | 11 | 7 | 10 read, all true: `logic […] FIFO_REGISTERS[DATA_DEPTH-1:0]`, `payload_t data_fifo [DutNumInp-1:0][DutNumOut-1:0][$]`, `uint length[NUM_PATTGEN_CHANNELS-1:0]` — real descending arrays. The mirror image of `packed-dimensions-range-ordering`, and the two never both fire on one dimension |
|
||
| `uvm-macro-semicolon` | warning | off→off | same | — | 22 | 214 | 10 read, all true: `` `uvm_fatal(…); `` in the ibex cosim monitors, `` `uvm_create_obj(…); `` throughout `hw/dv/sv`. All in `dv/`+`vendor/`. Off, as Verible ships it — the `;` is inert in almost every one of them |
|
||
| `create-object-name-match` | warning | on→on | same | — | 1 | 4 | 5 true (all there are): `irq_single_seq_h` created as `irq_raise_single_seq_h`, `m_csrng_agent_cfg` created as `m_csrng_genbits_agent_cfg`, `item` as `sba_req`, `xbar_vseq` as `xbar_stress_all_vseq`. Every one is a config-db path that will not match what the reader expects |
|
||
| `numeric-format-string-style` | style | off→off | same | — | 4 | 6 | 6 true (all there are): `"host_delay = 0x%0d "` ×4 in `push_pull_item.sv` (a decimal printed behind a hex prefix) and `"'d%3d"` in `spid_upload_tb.sv`. Off, as Verible ships it |
|
||
| `macro-string-concatenation` | warning | off→off | same | — | 2 | 10 | 10 true: `` `define _ACCESS_CHECKS `` in `mem_bkdr_util.sv` writes `` "addr 0x%0h not ``_DW``-bit aligned" `` — a plain string, so the two backticks reach the output — and the alert-handler `vseq`s do the same. Off, as Verible ships it |
|
||
| `disable-statement` | warning | off→off | same | — | 0 | 4 | 4 true (all there are): `disable sar_simple_thread` / `sar_burst_thread` in `hmac_base_vseq.sv` and two in `lc_ctrl_smoke_vseq.sv`, every one naming a `fork : label`, which is the exact construct the rule exists for. Off, as Verible ships it |
|
||
| `forbidden-macro` | warning | on→on | `forbidden-macro` | `macros` (`["uvm_warning"]`) | 1 | 1 | 1 true on each tree (all there are): `riscv_instr_cov.svh:434` in `google_riscv-dv`, vendored into both. Verible hard-codes the list; here it is an option |
|
||
| `endif-comment` | style | off→off | same | safe fix | 398 | 706 | 10 read, all true: `common_cells/include/common_cells/assertions.svh` (`// UVM`, `// XSIM`, `// SYNTHESIS`), `bus_params_pkg.sv` (`// BUS_AW`, `// BUS_DW`, …). Off, as Verible ships it; the fix names the condition the `` `ifdef `` opened |
|
||
| `forbid-line-continuations` | style | on→on | same | — | 0 | 0 | **0 on either tree** — no file in either breaks a string with `\`. Pinned by unit tests and confirmed firing through the release binary; the `.lint` case pins the negative direction (a multi-line `` `define `` is never reported), because a marker cannot be written inside a multi-line string |
|
||
| `dff-name-style` | style | off→off | same | `input` (`["next","n","d"]`), `output` (`["reg","r","ff","q"]`), `waive_ifs_with_conditions` (Verible's four), `waive_lhs_regex` (`"[mM][eE][mM].*"`) | 385 | 2 233 | 10 read, all true *as the rule reads it*: `init`/`stalls` in `common_cells/formal/*`, `gpio_p2d`, `spi_device_sck_o` in `hw/dv/dpi/*` — registers not named `_q`. Neither codebase follows the `_q`/`_d` convention, which is why the rule ships off; a project that does gets a real check |
|
||
| `proper-parameter-declaration` | style | off→off | same | `package_allow_parameter` (false), `package_allow_localparam` (true) | 716 | 13 992 | 10 read, all true: `parameter` in package bodies (`bus_params_pkg.sv`, `alert_esc_agent_pkg.sv`) and in module bodies (`cdc_2phase_clearable_tb.sv`). opentitan writes `parameter` in packages everywhere, which the Verible default `package_allow_parameter = false` reports; one option accepts it. Off, as Verible ships it |
|
||
|
||
Two options on rules that already existed:
|
||
|
||
| Rule | Option (default) | Corpus | opentitan | Findings read |
|
||
|---|---|---|---|---|
|
||
| `void-cast` | `forbidden_calls` (`["uvm_hdl_read", "randomize"]`) | 0 → **3** | 0 → **3** | 6 true (all there are): `void'(randomize())` in `id_queue_tb.sv` ×2, `stream_register_tb.sv`, `entropy_src_env_cfg.sv`, `entropy_src_tb.sv`, and `void'(uvm_hdl_read(…))` in `hmac_directed_vseq.sv`. Every one discards a result that says whether the operation worked |
|
||
| `invalid-system-task-function` | `symbols` (the ten names) | 8 → 8 | 23 → 23 | **byte-identical to 0.38.0** on both trees, stdout and stderr — the option's default reproduces the hard-coded list exactly |
|
||
|
||
**Why a Verible-default rule fires inside opentitan at all.** opentitan lints
|
||
its `hw/ip/*/rtl` filesets with
|
||
`hw/lint/tools/veriblelint/lowrisc-styleguide.rules.verible_lint`, which was
|
||
read for this round: it sets `line-length=length:100`,
|
||
`explicit-parameter-storage-type=exempt_type:string`,
|
||
`parameter-name-style=localparam_style:CamelCase|ALL_CAPS` and disables
|
||
`typedef-structs-unions` — and says **nothing** about any of §35's rules. So
|
||
Verible on opentitan's own filesets would report the same findings the five
|
||
default-on rules with non-zero counts produce here. It does not, in practice,
|
||
because those filesets are `rtl/` only: of the 116 new default-on findings on
|
||
`hw/`, **8 are under an `rtl/` path** — five of them in `hw/ip/prim/rtl/`
|
||
`.svh` fragments (`prim_util_memload.svh`, `prim_util_get_scramble_params.svh`,
|
||
which are simulation-only helpers `` `include``d into a module and are
|
||
genuinely static there), three in `pre_dv`/`pre_sca` testbench `rtl/`
|
||
directories — and the other 108 are in `dv/`, `pre_dv/`, `sva/`, `dpi/` and
|
||
`vendor/`, which opentitan's dvsim lint does not cover. That is the whole
|
||
explanation — no reading of a rule differs from Verible's.
|
||
|
||
**The census.** The default set now reports **1 169** findings on opentitan
|
||
`hw/` against 0.38.0's 1 053, and **8 524** on the corpus against 8 432. Both
|
||
deltas are exactly the new default-on work:
|
||
|
||
```
|
||
opentitan 32 + 69 + 7 + 4 + 1 + 3 = 116 (= 1169 − 1053)
|
||
corpus 29 + 47 + 11 + 1 + 1 + 3 = 92 (= 8524 − 8432)
|
||
```
|
||
|
||
— `explicit-task-lifetime`, `explicit-function-lifetime`,
|
||
`unpacked-dimensions-range-ordering`, `create-object-name-match`,
|
||
`forbidden-macro`, and `void-cast`'s new named-call half. The other four
|
||
default-on rules (`module-begin-block`, `v2001-generate-begin`,
|
||
`positive-meaning-parameter-name`, `suggest-parentheses` and
|
||
`forbid-line-continuations` — five of them) contribute nothing on either
|
||
tree.
|
||
|
||
## Work log
|
||
|
||
### 2026-09-04 — dev (Opus 5)
|
||
|
||
**35.1, the nineteen rules.** Written in §35's order: the two `forbidden-*`
|
||
list rules first (which is where the `forbidden-symbol` reconciliation had to
|
||
be settled), then the Style rules, then the Warning rules.
|
||
|
||
Three shared readers were added inside the crate rather than duplicated
|
||
across rules, each one sentence long:
|
||
|
||
- `visit::walk_items_scoped` + `visit::ItemScope` — the enclosing
|
||
*declaration* of an item (file, module, package, class), with generate
|
||
constructs passing the scope through. Read by both lifetime rules and by
|
||
`proper-parameter-declaration`.
|
||
- `exprs.rs` — `walk_exprs`, every expression of a file: the roots (a
|
||
continuous or procedural assignment, a declaration initialiser, a
|
||
condition, a call argument, an instantiation's connections, a generate
|
||
header, an expression statement, a parameter port's default) and a descent
|
||
through every composite `ExprKind`. Only `suggest-parentheses` needs it
|
||
today, and it needs *all* of it — a rule that judged expression shape from
|
||
a partial walk would be silently blind.
|
||
- `preproc.rs` — `macro_name`, `directive_word`, `directive_operand`. Four
|
||
rules read the lexer's two preprocessor token shapes; reading them in one
|
||
place is what stops the four disagreeing about where a name ends.
|
||
|
||
**Decisions and deviations, for the lead:**
|
||
|
||
- **`forbidden-symbol` ships as an option, not a rule.** Verible's
|
||
`forbidden-symbol-rule.cc` registers the descriptor name
|
||
`"invalid-system-task-function"` — the two names §35 listed separately are
|
||
one rule under its file name. lucisv keeps the one rule and gives it
|
||
`symbols`; the rule's `doc` says so in as many words, so nobody
|
||
re-derives it. Finding list byte-identical to 0.38.0's.
|
||
- **`void-cast` now checks both halves in one rule.** lucisv's original
|
||
question (the operand must be a call) and Verible's (a named list of calls
|
||
must not be discarded). They cannot both fire on one statement — the first
|
||
wants any call, the second a particular one — so a `void'(randomize())` is
|
||
reported once. Option name `forbidden_calls` is lucisv's; Verible has none.
|
||
- **`module-begin-block` and `v2001-generate-begin` read an error leaf.** The
|
||
parser refuses both constructs; the rules read the `ItemKind::Error` whose
|
||
first token is `begin`, one at module scope and one inside a
|
||
`GenerateRegion`. `begin_block()` is written once (in
|
||
`module_begin_block.rs`) and shared, so the two cannot disagree about what
|
||
a stray `begin` looks like. The parser gap is a Handshake request, not an
|
||
edit.
|
||
- **Both lifetime rules exempt an out-of-body definition**, which is wider
|
||
than Verible. `function cls::f(…); … endfunction` is lexically outside the
|
||
class and Verible reports it; it *is* a class method, and its lifetime is
|
||
already automatic. The first opentitan census, before the exemption, was
|
||
948 findings of exactly that shape out of 960 — a census-driven fix of the
|
||
kind §34's `generate-label` produced. `FunctionDecl::scope` /
|
||
`TaskDecl::scope` is non-empty for exactly those declarations.
|
||
- **`disable-statement` also accepts a task or function name.** `disable
|
||
task_name` is legal (IEEE 1800 §9.6.2) and Verible reports it; reporting it
|
||
would be a false positive on a rule whose point is "write `disable fork`".
|
||
Named in the rule's `doc`.
|
||
- **`suggest-parentheses` implements Verible's shape and no more.** §35
|
||
mentioned "or a mixed-precedence expression"; Verible's rule is only the
|
||
nested-true-clause one (`suggest-parentheses-rule.cc`: the true-case child,
|
||
unwrapped, is itself a condition expression), and a rule that guessed at
|
||
operator combinations would report far more than it explained. Its safe fix
|
||
inserts two characters and changes no token.
|
||
- **`dff-name-style`'s `waive_lhs_regex` default is `[mM][eE][mM].*`**, not
|
||
Verible's `(?i)mem.*`: lucisv's pattern engine refuses `(?…)` by name
|
||
(§34's rework), and the rewritten pattern accepts the same names. Its three
|
||
list options are Verible's comma-separated strings written as lists.
|
||
Conditions are compared with whitespace squeezed out, so `!rst_ni` and
|
||
`! rst_ni` are one waiver.
|
||
- **`endif-comment`'s fix is offered only where there is no comment at all.**
|
||
A comment that names something else is reported without one: rewriting
|
||
somebody's words is not a repair.
|
||
- **`numeric-format-string-style` was implemented from Verible's own test
|
||
file**, whose accepted and rejected literal lists are reproduced verbatim
|
||
as two unit tests (13 accepted, 10 rejected). A specifier with no prefix is
|
||
always accepted; only a mismatched prefix, and any prefix before a decimal
|
||
specifier, are reported.
|
||
- **`forbid-line-continuations` has no positive `.lint` case.** The finding
|
||
lands on the *first* line of a multi-line string and the harness attaches a
|
||
marker to the line above it, which is inside the string. Pinned by unit
|
||
tests instead — the same situation `posix-eof` is in, and the case file says
|
||
so while pinning the negative direction (a multi-line `` `define `` is never
|
||
reported).
|
||
- **Three existing test fixtures named `explicit-function-lifetime` as a rule
|
||
lucisv does not have** (`lib.rs`'s waiver test, `waivers.lint`) or wrote a
|
||
lifetime-less subroutine (`empty_item.lint`), and one `.lint` case wrote
|
||
`void'(obj.randomize() with …)` as a clean void cast. All four now name
|
||
`forbid-implicit-declarations` — Verible's one remaining unimplemented rule
|
||
— or say `automatic`, or call something else. Noted because they are §34
|
||
files.
|
||
|
||
**35.2** — the two option additions, above.
|
||
|
||
**35.3** — `tests/e2e.rs` gained
|
||
`the_lint_options_setting_changes_what_is_published_and_a_bad_entry_is_logged`:
|
||
a `lucisv.toml` with `[lint.line-length] length = 40` flags a 47-column line;
|
||
`lucisv.lint.options` with `length: 200` clears it mid-session (the editor
|
||
beats the toml, key by key); a typo'd `lenght` is refused, logged as exactly
|
||
one `window/logMessage` naming the setting and ending "ignored", and dropped —
|
||
so the `lucisv.toml` value stands again and the finding comes back. That is
|
||
§34's open LOW closed with the behaviour its QA verified by hand twice.
|
||
|
||
**35.4** — `README.md` (19 rows, verified against `--rules-doc`'s 73 names by
|
||
diff), the docs-site rules page (badge 54 → 73, 19 table rows and 19 sections,
|
||
headers diffed against `--rules-doc` — identical sets),
|
||
`docs/coverage_gaps.md`'s linter addendum (the Verible-coverage claim, the
|
||
parser gap, the fragment boundary, the `forbidden-symbol` note), and
|
||
`editors/vscode/package.json` regenerated by the generator. No setting was
|
||
added, so `editors/vscode/README.md` is unchanged — its "54 rules in all"
|
||
line is inside the *0.38.0 highlights* section and is historical.
|
||
|
||
## Measurements
|
||
|
||
All runs under `tools/guard.sh`; **no guard kill at any point**.
|
||
|
||
- **`cargo test --workspace`**: **3 695 passed, 0 failed, 42 ignored** over
|
||
**48** test binaries (baseline 3 564 / 48 / 42) — +131 tests, no binary
|
||
added or removed. The `.lint` table went from 246 to **275** cases.
|
||
- **fmt**: `cargo fmt -p vlog_linter`, `cargo fmt -p lucisv_server`.
|
||
**clippy**: `cargo clippy --all-targets --workspace`, **0 warnings**, and no
|
||
new `#[allow]` anywhere in the diff.
|
||
- **Corpus gate**: `{"passing":814,"total":820,"pct":99.3}` — the same six
|
||
known failures, unchanged.
|
||
- **Formatter byte-identity**: `lucisv format --stdout` over all 860 corpus
|
||
files, this build vs `~/.cache/lucisv-baselines/lucisv-0.38.0`:
|
||
**0 differ**. `git diff` over `vlog_formatter`, `vlog_parser` and
|
||
`verify.rs` is empty.
|
||
- **`invalid-system-task-function` identity**: `check --select
|
||
invalid-system-task-function --no-config`, this build vs 0.38.0 — corpus
|
||
**8 findings**, opentitan **23 findings**, stdout and stderr byte-identical
|
||
on both trees.
|
||
- **opentitan `check` census**: default set **1 169** findings against
|
||
0.38.0's **1 053**; corpus **8 524** against **8 432**. The arithmetic is
|
||
above and balances exactly.
|
||
- **opentitan `check` timing** (three interleaved runs each, timed inside the
|
||
guard): 0.38.0 **0.86 / 0.84 / 0.84 s**, this build **0.86 / 0.86 / 0.85 s**
|
||
— no measurable difference, though the new build runs ten more default-on
|
||
rules.
|
||
- **vsix smoke**: `node editors/vscode/smoke.js target/debug/lucisv-server` —
|
||
OK, 20 messages.
|
||
- **opentitan tree after the round**: `git -C ~/repo/opentitan status
|
||
--porcelain` shows only the three pre-existing modifications
|
||
(`hw/ip/aes/dv/tb/tb.sv`, `hw/top_darjeeling/ip/ast/rtl/ast.sv`,
|
||
`hw/top_earlgrey/ip/ast/rtl/ast.sv`). Every opentitan run was
|
||
`lucisv check` and read-only.
|
||
|
||
## QA log
|
||
|
||
### 2026-09-04 — QA (Sonnet 5)
|
||
|
||
Verified in the `lint-3` worktree only, everything guarded, opentitan
|
||
read-only. Scratch under `.../scratchpad/qa-35/`.
|
||
|
||
**1. Gates, all reproduced independently.** `cargo fmt --all -- --check`
|
||
clean. `cargo clippy --all-targets --workspace`: 0 warnings; `git diff
|
||
b1b3cad` shows no new `#[allow]` anywhere (grepped the whole diff, not just
|
||
the new files). `cargo test --workspace --no-fail-fast` (full log, not
|
||
tail-truncated, so every binary's `test result:` line was summed): **3 695
|
||
passed / 0 failed / 42 ignored / 48 binaries** — exact match, no guard kill.
|
||
`git diff --stat b1b3cad -- crates/vlog_formatter crates/vlog_parser`: empty.
|
||
Corpus gate (own build of `scripts/score.sh target/release/lucisv`, main
|
||
tree's `corpus/`, read-only): `{"passing":814,"total":820,"pct":99.3}`, same
|
||
five failure categories (2 invalid-or-fragment, 1 directive-split, 1
|
||
macro-items, 1 not-verilog, 1 other). `--stdout` byte-identity over all 860
|
||
corpus files, this build vs `~/.cache/lucisv-baselines/lucisv-0.38.0`: **0
|
||
differ**. vsix smoke: `node editors/vscode/smoke.js target/release/lucisv-server`
|
||
— OK, 20 messages. Changed-file set: `git diff --stat b1b3cad` (15 tracked
|
||
files) plus the 20 untracked additions (19 rule files + the feature README)
|
||
match §35's ownership list exactly — nothing touched outside `vlog_linter`,
|
||
the two disclosed doc/toggle files, and the checked-in e2e test; the new
|
||
`the_lint_options_setting_changes_what_is_published_and_a_bad_entry_is_logged`
|
||
test in `crates/lucisv_server/tests/e2e.rs` was confirmed present in the run
|
||
(`ok`, line 1797 of the full log).
|
||
|
||
**2. `forbidden-symbol` reconciliation.** Read Verible's actual
|
||
`forbidden-symbol-rule.cc` (`verible/verilog/analysis/checkers/`, GitHub
|
||
API-fetched, not from memory): its C++ class is `ForbiddenSystemTaskFunctionRule`
|
||
but the descriptor name it registers is `"invalid-system-task-function"`
|
||
under topic `"forbidden-system-functions"`, and its hard-coded map is exactly
|
||
the ten names lucisv ships (`$psprintf`→`$sformatf`, `$random`→`$urandom`,
|
||
`$srandom`→`process::self().srandom()`, the six `$dist_*`→`$urandom`) —
|
||
confirms the dev's claim word for word. CLI: `$psprintf` fires exactly once
|
||
with defaults; `[lint.invalid-system-task-function] symbols = ["$foo"]`
|
||
makes `$foo` fire and `$psprintf` stop firing (verified both directions).
|
||
Finding-list byte-identity, this build vs 0.38.0, `--select
|
||
invalid-system-task-function --no-config`: corpus **8** findings, opentitan
|
||
**23** findings, `diff` empty on both trees both ways. `git -C
|
||
~/repo/opentitan status --porcelain` before/after: only the three
|
||
pre-existing files — read-only held.
|
||
|
||
**3. The nineteen rules, adversarially.** Read all 19 rule source files in
|
||
full (not just the diff) plus `exprs.rs` and `preproc.rs`; every rule's own
|
||
unit-test block already exercises true positive / near-miss / edge shapes
|
||
(macro text, fragments, class bodies, generate scopes) matching what its
|
||
`doc` claims — no gap between doc and code found in any of the 19. Targeted,
|
||
independent CLI/CLI-toml/LSP probes on top of reading:
|
||
|
||
- `module-begin-block` / `v2001-generate-begin`: crafted a module-scope
|
||
`begin…end` and a bare `begin` in a `generate` region. Each fires exactly
|
||
once, span is exactly the 5-character `begin` keyword (confirmed via
|
||
`--output-format json` `range`), and no other rule misfires on the file
|
||
(only the incidental `module-filename` mismatch from my own test
|
||
filename). Confirmed via Verible's actual source
|
||
(`module-begin-block-rule.cc`, `v2001-generate-begin-rule.cc`) that both
|
||
are real Verible rule names with exactly the cited descriptions, both
|
||
enabled by default, and that `v2001-generate-begin`'s matcher
|
||
(`NodekGenerateRegion(HasGenerateBlock())`) does not distinguish a labelled
|
||
from an unlabelled block — so the rule's own test using `begin : b` is
|
||
correct, not a bug.
|
||
- **Lifetime exemption**: `class c; extern function int f(); endclass
|
||
function c::f(); return 0; endfunction` (out-of-body definition) is
|
||
**silent**; a bare `function int f(); return 0; endfunction` at module
|
||
scope **fires**. Both confirmed live via the CLI, matching the doc and the
|
||
948/960 census claim.
|
||
- `disable-statement`: a fork label, a task name and an undeclared name in
|
||
one file — CLI confirms `disable threads` (fork label) and `disable
|
||
somewhere_else` (undeclared) fire, `disable t` (task) is silent. Read
|
||
Verible's real `disable-statement-rule.cc`: it matches only `kSeqBlock`
|
||
labels and does **not** special-case a task/function name, so lucisv's
|
||
"wider than Verible" claim (avoiding a false positive on the
|
||
IEEE-1800-legal `disable task_name`) is a genuine, correctly-cited
|
||
deviation, not an invented one.
|
||
- `suggest-parentheses`: confirmed the rule's scope is deliberately narrow by
|
||
reading Verible's actual `suggest-parentheses-rule.cc` — it contains a
|
||
literal `// TODO: evaluate other types of expressions` and only matches a
|
||
`kConditionExpression` nested in another's true-clause, nothing about
|
||
mixed-precedence operators. So `a + b << c`, `a & b | c`, `!a == b` and a
|
||
five-operator chain (`a | b & c ^ d << e >> f`) correctly produce **no**
|
||
finding (exit 0, confirmed) — this is lucisv matching Verible's real
|
||
scope, not an incomplete implementation. On the true-positive shape `a ? b
|
||
? c : d : e`: `--fix` on a hand-written file parses (`lucisv --check`
|
||
exit 0 after the fix), is idempotent through the formatter (a `lucisv
|
||
format` pass afterward makes zero changes), and re-linting the fixed file
|
||
is clean. Truth-tabled `a ? (b ? c : d) : e` against the unparenthesized
|
||
original for all 32 combinations of 5 boolean inputs in Python: **0
|
||
mismatches** — the fix is semantically inert by construction (parens make
|
||
explicit what right-associativity already meant).
|
||
- `endif-comment`: `--fix` on a hand-written file with a bare and a
|
||
`` `ifndef``/`` `else`` pair both parses and is idempotent (a `lucisv
|
||
format` pass afterward is a no-op on a second run), and the fixed
|
||
diagnostics clear. **One LOW finding**: the fix's insertion
|
||
(`crates/vlog_linter/src/rules/endif_comment.rs:102`,
|
||
`format!(" // {name}")`) writes **two** spaces before the comment, but
|
||
lucisv's formatter's canonical trailing-comment spacing is **one** space
|
||
(confirmed against `crates/vlog_formatter/src/fence.rs`'s own test
|
||
fixtures, e.g. `"wire a; // note"`) — so `lucisv --check` on a
|
||
freshly-`--fix`ed file reports "would reformat" immediately, and only
|
||
settles after one `lucisv format` pass. Not a correctness bug: the file
|
||
still parses, the eventual output is semantically identical and
|
||
idempotent, and `Applicability::Safe` is documented as "preserves meaning
|
||
and intent" only, not "already formatter-clean" — but it is a real,
|
||
fixable inconsistency (one character) worth a follow-up so a `--fix` run
|
||
does not leave a file that immediately fails `--check`.
|
||
- Option-bearing rules, **CLI toml** (all five): `invalid-system-task-
|
||
function.symbols` (above); `dff-name-style`'s four options set together
|
||
(`input`, `output`, `waive_ifs_with_conditions`, `waive_lhs_regex`) turn a
|
||
file with three otherwise-reportable shapes fully clean; `forbidden-
|
||
macro.macros = ["my_macro"]` fires only `my_macro`, not the default
|
||
`uvm_warning`; `void-cast.forbidden_calls = ["my_risky_call"]` fires only
|
||
that name, not `randomize`; `proper-parameter-declaration`'s two booleans
|
||
confirmed via its own unit tests (`package_allow_parameter`,
|
||
`package_allow_localparam`, both directions) plus a live check below.
|
||
**LSP editor object**, a standalone Python script speaking framed
|
||
JSON-RPC at the real `lucisv-server` binary (same technique
|
||
linter-expansion-2's QA used, since no other checked-in e2e case touches
|
||
these three): `forbidden-macro.macros` replaced live — the pre-push
|
||
publish flags `` `uvm_warning ``, the post-push publish (`macros:
|
||
["my_macro"]`) flags `` `my_macro `` instead, on the same file; `void-
|
||
cast.forbidden_calls` emptied live — pre-push 1 finding, post-push 0;
|
||
`proper-parameter-declaration.package_allow_parameter` — pre-push 0 (rule
|
||
is off by default, confirmed correct, not a bug), post-select-push 1,
|
||
post-option-push 0. All three behaved exactly as configured, no crash, no
|
||
stray diagnostic.
|
||
- `void-cast`'s two halves never double-fire: confirmed via its own unit
|
||
test (`the_two_halves_never_both_fire_on_one_statement`) and via the CLI
|
||
toml probe above (`my_risky_call` reported once).
|
||
|
||
**4. Opentitan census, re-derived independently.** Own build's default-set
|
||
`check --no-config` over `hw/`: **1 169** findings; 0.38.0's: **1 053**
|
||
(re-run myself, not taken from the README). Corpus: **8 524** vs 0.38.0's
|
||
**8 432** (also re-run). Delta arithmetic reproduced exactly: opentitan
|
||
32+69+7+4+1+3=116=1169−1053, corpus 29+47+11+1+1+3=92=8524−8432, checked
|
||
per-rule with a `--select <rule>` sweep over all nineteen rules on both
|
||
trees — **every one of the 19 rows in the README's table matches my own
|
||
count exactly** (module-begin-block 0/0, legacy-generate-region 6/3,
|
||
legacy-genvar-declaration 0/1, v2001-generate-begin 0/0,
|
||
explicit-function-lifetime 29/32, explicit-task-lifetime 47/69,
|
||
positive-meaning-parameter-name 0/0, suggest-parentheses 0/0,
|
||
unpacked-dimensions-range-ordering 11/7, uvm-macro-semicolon 22/214,
|
||
create-object-name-match 1/4, numeric-format-string-style 4/6,
|
||
macro-string-concatenation 2/10, disable-statement 0/4, forbidden-macro
|
||
1/1, endif-comment 398/706, forbid-line-continuations 0/0, dff-name-style
|
||
385/2233, proper-parameter-declaration 716/13992), plus `void-cast` 0→3 on
|
||
both trees. `git -C ~/repo/opentitan status --porcelain` checked before and
|
||
after every sweep: only the three pre-existing files, every run read-only.
|
||
|
||
Five findings classified for each of the five named rules:
|
||
- `explicit-task-lifetime`: read 5 of opentitan's 69 —
|
||
`cip_base_vseq__sec_cm_fi.svh` tasks (`run_sec_cm_fi_vseq`,
|
||
`pre_run_sec_cm_fi_vseq`, `post_run_sec_cm_fi_vseq`,
|
||
`check_sec_cm_fi_resp`, `test_sec_cm_fi`), all `.svh` fragments
|
||
`` `include``d into a class body — matches the README's "needs judgment"
|
||
bucket exactly (lucisv, like Verible, cannot see the class from the
|
||
fragment's own scope).
|
||
- `suggest-parentheses`: 0 on opentitan — matches the README, nothing to
|
||
classify.
|
||
- `unpacked-dimensions-range-ordering`: read 5 of 7 —
|
||
`pattgen_agent_cfg.sv:15`, `kmac_reduced_tb.sv:338` and `:354`,
|
||
`ram_1p.v:24`, `pattgen_scoreboard.sv:22`, all genuine descending unpacked
|
||
ranges — true positives, matches the README's characterization.
|
||
- `create-object-name-match`: read all 4 (all there are) —
|
||
`edn_env_cfg.sv` (`m_csrng_genbits_agent_cfg`/`m_csrng_agent_cfg`),
|
||
`rv_dm_buffered_enable_vseq.sv` (`sba_req`/`item`),
|
||
`xbar_stress_all_with_rand_reset_vseq.sv`
|
||
(`xbar_stress_all_vseq`/`xbar_vseq`), `core_ibex_vseq.sv`
|
||
(`irq_single_seq_h`/`irq_raise_single_seq_h`) — exactly the four the
|
||
README names, all true positives.
|
||
- `forbid-line-continuations`: 0 on opentitan — matches the README, nothing
|
||
to classify.
|
||
|
||
No misclassification found in any finding read. Timing, three interleaved
|
||
runs each (`/usr/bin/time -p` inside the guard, default-set `check
|
||
--no-config` over `hw/`): 0.38.0 **0.85 / 0.86 / 0.83 s**, this build
|
||
**0.87 / 0.91 / 0.84 s** — within noise of the README's own numbers, no
|
||
regression over 10%.
|
||
|
||
**5. Docs.** `lucisv check --rules-doc`: **73** `## ` sections. README.md's
|
||
"Linting" table: 73 rule rows (excluded the three-row severity legend after
|
||
first miscounting it, same trap linter-expansion-2's QA hit) — diffed
|
||
against `--rules-doc`'s name set: **identical**. `docs/site/src/content/
|
||
docs/reference/rules.md`: 73 `## ` headers, diffed against `--rules-doc`:
|
||
**identical**. `editors/vscode/package.json`: 73
|
||
`lucisv.lint.rules.<name>` toggles, diffed against `--rules-doc`:
|
||
**identical** — and the drift test is not vacuous: in a throwaway worktree
|
||
(`git worktree add --detach` from `b1b3cad`, the dev's diff applied with
|
||
`git apply`, untracked files copied over, removed after with `git worktree
|
||
remove --force`), added a `FakeDriftRule` to `registry::all_rules()` with no
|
||
matching `package.json` entry — `cargo test -p lucisv_server
|
||
the_vscode_lint_toggles_match_the_registry` **FAILED** as expected, naming
|
||
`fake-drift-rule` in the registry side only. `git worktree list` afterward:
|
||
back to the original two worktrees. `docs/coverage_gaps.md`'s "Linter
|
||
addendum (2026-09-04, TODO §35)" section reads true against the shipped
|
||
code: the 73/74-rule count, the parser-gap note for the two `begin`-reading
|
||
rules, the `.svh`-fragment boundary, and the `forbidden-symbol` note all
|
||
match what I verified above. TODO §35's checkboxes match this README's
|
||
Status/TODO (35.1–35.4 and Gates ticked, QA still open pending this entry).
|
||
The four renamed §34 fixtures (`crates/vlog_linter/src/lib.rs`'s two waiver
|
||
tests, `tests/cases/waivers.lint`, `tests/cases/empty_item.lint`,
|
||
`tests/cases/statements.lint`) now name `forbid-implicit-declarations` (the
|
||
one Verible rule lucisv still lacks) or write `automatic`/a different call,
|
||
and all ran green in the full workspace test log
|
||
(`a_verible_waiver_for_a_rule_lucisv_does_not_have_is_ignored ... ok`).
|
||
|
||
**Verdict: PASS.** One LOW finding: `endif-comment`'s safe fix inserts two
|
||
spaces before its trailing comment where lucisv's formatter's canonical
|
||
style is one, so a freshly-`--fix`ed file needs one `lucisv format` pass to
|
||
be `--check`-clean (`crates/vlog_linter/src/rules/endif_comment.rs:102`).
|
||
Harmless — parses, idempotent, semantically identical, and
|
||
`Applicability::Safe` never promised formatter-clean output — but worth the
|
||
one-character fix in a follow-up. Everything else verified clean: all
|
||
gates reproduced independently and matching exactly; the `forbidden-symbol`
|
||
reconciliation confirmed against Verible's actual source, not the dev's
|
||
citation of it; all nineteen rules read in full and adversarially probed,
|
||
including two rules' scope-narrowing decisions (`suggest-parentheses`,
|
||
`disable-statement`) independently confirmed against Verible's own source
|
||
rather than taken on the dev's word; the lifetime exemption and the two
|
||
error-leaf rules' isolation confirmed live; every option-bearing rule
|
||
exercised through the CLI toml, and three of them through a live LSP
|
||
session with the editor's value observed to win; the opentitan and corpus
|
||
censuses re-derived independently and matching the README's table and
|
||
arithmetic exactly, five findings apiece classified for the five named
|
||
rules with no misclassification; the docs, the drift test's teeth, and the
|
||
renamed §34 fixtures all confirmed.
|
||
|
||
## Review
|
||
|
||
**2026-09-04 — lead.** Accepted. With this wave every rule in Verible's
|
||
published list is in lucisv except the one that needs a compiler, and
|
||
the round's best decision was reading Verible's source rather than its
|
||
table: `forbidden-symbol` is the file name of `invalid-system-task-
|
||
function`, so it is an option, not a second rule that would have fired
|
||
twice on `$psprintf`. The census-driven narrowing of the lifetime rules
|
||
(948 of 960 findings were out-of-body definitions) is the right kind of
|
||
divergence, written down; the two rules that fire on an error leaf are
|
||
honest about the parser's limit and file it (`docs/topo.md` §2.9-25).
|
||
QA read the nineteen files, verified two scope decisions against
|
||
Verible's own source, truth-tabled the parenthesizing fix, and drove
|
||
the options through both doors. The one LOW — the `endif-comment` fix
|
||
wrote two spaces where the formatter writes one — fixed at review with
|
||
its two expectations. Ships in 0.39.0. The linter now stands at 73
|
||
rules with severities, toggles and options; what remains for it is
|
||
measurement in use, not more rules.
|
||
|
||
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->
|