MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / inspect

Function inspect

libatomic/src/review/impact.rs:18–81  ·  view source on GitHub ↗
(
    repo: &Repository,
    report: &IncrementalReport,
)

Source from the content-addressed store, hash-verified

16use super::incremental::IncrementalReport;
17
18pub(super) fn inspect(
19 repo: &Repository,
20 report: &IncrementalReport,
21) -> (Vec<ImpactReport>, Vec<SubmittedFinding>) {
22 let (mut results, mut findings) = (Vec::new(), Vec::new());
23 let mut parser = ParserRegistry::new();
24 for change in report.changes.iter().filter(|change| {
25 change.selected_root
26 && change
27 .paths
28 .iter()
29 .any(|path| !atomic_repository::is_vault_path(path))
30 }) {
31 let mut result = ImpactReport {
32 change: change.hash.clone(),
33 code_changed: true,
34 ..Default::default()
35 };
36 let paths: Vec<_> = change
37 .paths
38 .iter()
39 .filter(|path| !atomic_repository::is_vault_path(path))
40 .cloned()
41 .collect();
42 if !paths.iter().any(|path| atomic_semantic::is_supported(path)) {
43 result.gaps.push("No supported source in selected paths; non-code/runtime configuration effects require separate inspection".into());
44 results.push(result);
45 continue;
46 }
47 if results.len() >= 4 {
48 result.gaps.push(
49 "Impact snapshot budget reached (4 selected changes); remaining roots not analyzed"
50 .into(),
51 );
52 results.push(result);
53 continue;
54 }
55 let hash = Hash::from_base32(change.hash.as_bytes()).expect("resolved selected hash");
56 match (
57 repo.semantic_view_at_change(&hash, false),
58 repo.semantic_view_at_change(&hash, true),
59 ) {
60 (Ok(before_view), Ok(after_view)) => {
61 result = inspect_views(&before_view, &after_view, &paths, &mut parser);
62 result.change = hash.to_base32();
63 }
64 (before, after) => {
65 if let Err(error) = before {
66 result
67 .gaps
68 .push(format!("Before snapshot unavailable: {error}"));
69 }
70 if let Err(error) = after {
71 result
72 .gaps
73 .push(format!("After snapshot unavailable: {error}"));
74 }
75 }

Callers 3

buildFunction · 0.70
parseFunction · 0.70
inspect_reviewsMethod · 0.50

Calls 13

is_supportedFunction · 0.85
inspect_viewsFunction · 0.85
contract_findingsFunction · 0.85
extendMethod · 0.80
is_vault_pathFunction · 0.50
iterMethod · 0.45
cloneMethod · 0.45
collectMethod · 0.45
pushMethod · 0.45
lenMethod · 0.45
as_bytesMethod · 0.45

Tested by

no test coverage detected