pub struct AnalysisResult {
pub findings: Vec<Finding>,
pub failed_files: BTreeMap<PathBuf, FailureReason>,
pub dropped_out_of_range: usize,
}Expand description
What one analysis pass produced.
findings and failed_files are independent axes: a file can contribute
findings AND be unanalyzed (a truncated response gives a partial list).
Reporting the findings while forgetting the failure is the exact bug this
type exists to prevent.
Fields§
§findings: Vec<Finding>Findings the analyzer could attribute to a real line of code.
failed_files: BTreeMap<PathBuf, FailureReason>Files that could not be fully analyzed, with the reason. A BTreeMap
because two passes over the same file set must UNION, never sum —
summing counts one unreachable endpoint twice.
dropped_out_of_range: usizeFindings discarded because their line was not in the payload’s
valid_lines. Counted rather than silently dropped, so the drop is
observable.
Implementations§
Source§impl AnalysisResult
impl AnalysisResult
Sourcepub fn failed(path: PathBuf, reason: FailureReason) -> Self
pub fn failed(path: PathBuf, reason: FailureReason) -> Self
One file, one failure, no findings.
The shape was hand-assembled at four call sites - default(), insert,
return - each of which independently had to know that findings and
dropped_out_of_range stay at their defaults. Forgetting the insert at
any one of them reports an unanalyzed file as clean, which is the single
failure this whole type exists to prevent, so it gets a constructor.
Sourcepub fn merge(&mut self, other: AnalysisResult)
pub fn merge(&mut self, other: AnalysisResult)
Fold other into self: findings concatenate, failed_files
unions, dropped_out_of_range sums.
The merge semantics let a caller combine per-file and per-layer results without losing the failure signal.
On a key collision in failed_files, the first reason wins. A
file failing twice is still one failure, and the two reasons are not
meaningfully combinable - the first one is at least specific to the
file, while a hypothetical last-wins policy would let a later
analyzer overwrite a more informative first reason with a generic
one.
Sourcepub fn has_failures(&self) -> bool
pub fn has_failures(&self) -> bool
True when any file went unanalyzed.
The caller maps this to process exit 2: “could not analyze” is distinct from both “clean” (exit 0) and “found issues” (exit 1), because a gate that cannot distinguish them rubber-stamps the day the LLM endpoint goes down.
Trait Implementations§
Source§impl Clone for AnalysisResult
impl Clone for AnalysisResult
Source§fn clone(&self) -> AnalysisResult
fn clone(&self) -> AnalysisResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AnalysisResult
impl Debug for AnalysisResult
Source§impl Default for AnalysisResult
impl Default for AnalysisResult
Source§fn default() -> AnalysisResult
fn default() -> AnalysisResult
impl Eq for AnalysisResult
Source§impl PartialEq for AnalysisResult
impl PartialEq for AnalysisResult
impl StructuralPartialEq for AnalysisResult
Auto Trait Implementations§
impl Freeze for AnalysisResult
impl RefUnwindSafe for AnalysisResult
impl Send for AnalysisResult
impl Sync for AnalysisResult
impl Unpin for AnalysisResult
impl UnsafeUnpin for AnalysisResult
impl UnwindSafe for AnalysisResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.