Skip to content

LSP: lint engine, rules, profiles, waivers and autofix (specs/lsp/lint.t27) #12257

Closed

Description

@gHashTag

The lint engine behind the editor's warnings: a registry of rules, each with an id, a severity, a rationale page and (where possible) an automatic fix; profiles that turn groups on and off; and waivers written next to the code they excuse. Verible has 61 rules with exactly this shape; Pyright's basic, standard and strict modes are the dial. t27c lint is the backend and this module must agree with it, not replace it. Part of the LSP epic, Refs #12209 (wave 2, beyond the standard). Only .t27: no code in any other language, not even scratch probes or a loader; see skill only-t27.

Depends on specs/lsp/diagnostics.t27 (delivery) and specs/lsp/code_actions.t27 (fixes).

Prior art:

Boundary

  • specs/lsp/lint.t27

User Scenarios

  • Given a rule unused-constant is in the registry, when a spec has a private constant nobody reads, then a warning with code unused-constant appears on its name, with codeDescription.href of the rule page and a quick fix that removes it.
  • Given the line above a finding holds ; lint:allow(unused-constant) kept for the ABI, when diagnostics run, then the finding is suppressed, and a waiver that suppresses nothing is itself reported as unused-waiver.
  • Given the profile strict, when the user switches to relaxed, then the rules marked strict-only stop firing and the rest keep their severity.
  • Given the rule list is generated, when the docs page is built, then every rule has an id, a one-line rationale, a bad example, a good example and the fix status.
  • Given the same spec, when t27c lint and this module both run, then they report the same ids at the same ranges.

Requirements

  • FR-001: The module MUST hold the registry as data (id, default severity, profiles, rationale, example pair, fix name or none) with the engine as pure functions over the snapshot and the registry.
  • FR-002: The module MUST support profiles relaxed, standard and strict and per-rule overrides from specs/lsp/config.t27.
  • FR-003: Waivers MUST be a comment of the exact form ; lint:allow(<id>[, <id>]) <reason>, MUST require a non-empty reason, and an unused or reasonless waiver MUST be reported.
  • FR-004: Findings MUST be identical to t27c lint for the same file; a test compares them on 20 specs, and a rule the compiler lacks is marked server-only in the registry.
  • FR-005: The rule documentation page MUST be generated from the registry; no rule text lives anywhere else.

Success Criteria

  • At least 40 tests in specs/lsp/lint.t27 pass, run on the lab with t27c test-report (exit 0), at least 1 positive and 1 negative test per rule and 1 per profile.
  • On the lab the agreement test passes on 20 named specs; the command and the list are pasted in the issue.
  • git diff --name-only master lists only specs/lsp/lint.t27 and generated files named in the issue (0 hand-written files in other languages).

Activity

  1. gHashTag commented on Nov 17, 2026

    @gHashTag
    CollaboratorAuthor

    LSP spec created (typecheck OK, tests pass).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/specs.t27 spec files and conformanceenhancementNew feature or requestspec

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions