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

Function collect_requests

libatomic/src/review/html.rs:110–163  ·  view source on GitHub ↗
(
    graph: &ReviewGraph,
    regions: &[presentation::Region],
)

Source from the content-addressed store, hash-verified

108}
109
110fn collect_requests(
111 graph: &ReviewGraph,
112 regions: &[presentation::Region],
113) -> BTreeMap<(String, String), Request> {
114 let mut requests = BTreeMap::<(String, String), Request>::new();
115 for region in regions {
116 let request = requests
117 .entry((region.change.clone(), region.path.clone()))
118 .or_default();
119 request.findings |= !region.findings.is_empty();
120 if !region.findings.is_empty() || !region.impact.is_empty() {
121 request.known.insert(region.side.clone());
122 }
123 }
124 for node in graph.nodes.iter().filter(|node| node.kind == "metric") {
125 let (Some(change), Some(path)) = (
126 node.properties["change"].as_str(),
127 node.properties["path"].as_str(),
128 ) else {
129 continue;
130 };
131 let request = requests.entry((change.into(), path.into())).or_default();
132 for side in ["before", "after"] {
133 let value = &node.properties["observation"][side];
134 if value["status"] == "measured"
135 && presentation::metric_location(node, side).0.is_some()
136 {
137 request.known.insert(side.into());
138 }
139 if value["status"] == "not_applicable"
140 && value["reason"] == "File is absent in this revision"
141 {
142 request.absent.insert(side.into());
143 }
144 }
145 }
146 // Explicit source locations also cover supplied findings without metrics.
147 for finding in &graph.findings {
148 for location in &finding.finding.locations {
149 requests
150 .entry((finding.finding.change.clone(), location.path.clone()))
151 .or_default()
152 .known
153 .insert(
154 match location.side {
155 SourceSide::Before => "before",
156 SourceSide::After => "after",
157 }
158 .into(),
159 );
160 }
161 }
162 requests
163}
164
165fn sources(
166 repo: &Repository,

Callers 1

sourcesFunction · 0.85

Calls 6

metric_locationFunction · 0.85
cloneMethod · 0.45
is_emptyMethod · 0.45
insertMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected