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

Function analyze_change

libatomic/src/review/analysis.rs:39–146  ·  view source on GitHub ↗
(
    repo: &Repository,
    change: &Change,
    hash: &Hash,
    paths: &[String],
    selected: bool,
    on_current_view: bool,
    registry: &mut ParserRegistry,
)

Source from the content-addressed store, hash-verified

37}
38
39pub(super) fn analyze_change(
40 repo: &Repository,
41 change: &Change,
42 hash: &Hash,
43 paths: &[String],
44 selected: bool,
45 on_current_view: bool,
46 registry: &mut ParserRegistry,
47) -> AnalysisReport {
48 let mut report = empty_report();
49 let change_id = hash.to_base32();
50 let mut metric_changes = Vec::new();
51 let mut metric_bytes = ExtractionConfig::default().max_total_bytes;
52 for path in paths {
53 if atomic_repository::is_vault_path(path) {
54 if selected {
55 report.excluded_metadata_paths.push(path.clone());
56 }
57 continue;
58 }
59 let skip = if !selected {
60 Some("Dependency context only; not a selected review root")
61 } else if !on_current_view {
62 Some("Off current view; exact before/after content not inspected")
63 } else if Language::detect(path).is_none() {
64 Some("Unsupported language; no structural or anti-slop rules executed")
65 } else {
66 None
67 };
68 if let Some(reason) = skip {
69 checks(&mut report, &change_id, path, CheckStatus::Skipped, reason);
70 if selected {
71 metric_changes.push(FileChange {
72 path: path.clone(),
73 before: Source::Unavailable(reason.into()),
74 after: Source::Unavailable(reason.into()),
75 });
76 }
77 continue;
78 }
79 match repo.get_file_content_after_change(path, hash) {
80 Ok(Some(after)) => {
81 let before = repo.get_file_content_before_change(path, hash);
82 let added = change.file_ops().iter().any(|ops| {
83 ops.path() == path && matches!(ops.trunk_op(), Some(TrunkOp::Create { .. }))
84 });
85 inspect_content(
86 &mut report,
87 registry,
88 &change_id,
89 path,
90 before
91 .as_ref()
92 .map(|value| value.as_deref())
93 .map_err(|error| error.to_string()),
94 &after,
95 added,
96 );

Callers 1

resolve_with_sessionFunction · 0.85

Calls 15

empty_reportFunction · 0.85
checksFunction · 0.85
inspect_contentFunction · 0.85
metric_sourceFunction · 0.85
extract_changesFunction · 0.85
is_noneMethod · 0.80
as_refMethod · 0.80
is_vault_pathFunction · 0.50
to_base32Method · 0.45
pushMethod · 0.45

Tested by

no test coverage detected