Module: SpecGuard::RSpec::Linter

Defined in:
lib/specguard/rspec/linter.rb

Overview

The shared verdict shape both renderers and the exit code derive from.

Where this sits after SPGD-867 (the cutover)

This used to be a class that APPLIED the schema to Findings the Ruby scanner had produced. That Ruby hand-rolled validation arm is gone: specguard-lint validates through the validate-intent binary and only the binary (ValidatorBackend), and the formatter's half (AnnotationLookup) asks the same binary. What survives is the one thing both sides of the seam still share — Result, the single shape the reporter and the exit code are both derived from, so "what was printed" and "what we exited with" cannot drift apart.

What counts as a failure

Three things make an annotation malformed, reaching the same verdict from different directions:

* the payload could not be captured off the line at all
(`Finding::KIND_EXTRACTION`) — a typo'd annotation;
* it was captured but is not JSON even after normalization
(`Finding::KIND_PARSE`);
* it parsed but violates the schema.

All three are "an annotation is malformed", which the contract fixes at exit 1. A missing annotation is not among them — "lint, don't require" (SPGD-12 §1): a file with no @intent: at all is clean.

Finding::KIND_READ — a spec file that could not be opened or is not valid UTF-8 — is also reported as a failure, and therefore also exits 1. That matches validate-intent, which classifies it separately (its own read kind) and still reports it as FAIL with exit 1.

Finding::KIND_UNREACHABLE — an annotation that is well-formed in isolation but stacked above another comment-form @intent: line, so the one-line lookback (SPGD-12 §2) never claims it — is also reported as a failure, and therefore also exits 1. Nothing about it is malformed; the contract is dead metadata, counted by the linter and discarded by extraction, and the structural pass that flags it (SPGD-900) reports it loudly rather than letting it pass as clean.

Defined Under Namespace

Classes: Result