Expand description
The code-quality analyzer: render a payload, ask the LLM, turn the response into findings — and never report an unanalyzed file as clean.
The analyzer enforces these contracts:
- No language, no analysis. drep has no opinion on a file type it does not claim, and silently returning an empty result is the correct behavior — not a failure. The CLI surfaces “no language” by simply not including the file in the work set.
- Empty hunks → empty result, no LLM call.
- Build the payload with
payload::render.None→ empty result. - Cache first. A hit is parsed exactly as a
Completeresponse would be, and the duplicate is silent — the caller’s view is identical. The explicitly live pass after cache-only preflight bypasses cache, because only a fresh provider response may consume a remediation round. - Concurrency. A limiter slot is acquired before the LLM call and held for the duration. A cache hit must not acquire a slot: the slot represents in-flight HTTP work, and a cache read is not in-flight.
Ok(Extracted::Complete)→ parse, store in the cache.Ok(Extracted::Truncated)→ parse the partial result AND mark the file failed. Never cache a truncated response — caching it makes one truncation permanent for the whole TTL, and this layer does not know about--fail-on(a caller deciding otherwise would makefailed_filesdepend on a CLI flag, which is the wrong layering).Err(LlmError::*)→ no findings, file infailed_fileswith the specific LLM layer that failed.
The five rules around out-of-range lines, missing fields, unknown
severities, and issues itself being absent are at the boundary between
“model misreported” and “we could not understand the response”. The first
is a finding we drop; the others are file-level failures, because a
file we did not fully understand must never be reported clean.
Structs§
- Code
Quality Analyzer - The code-quality analyzer.