MCPcopy Create free account
hub / github.com/SourceCode-AI/aura / analyze_changes

Method analyze_changes

aura/diff.py:190–233  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

188 raise ValueError(f"FS type mismatch: {str(a_path)}, {str(b_path)}")
189
190 def analyze_changes(self):
191 locations = {}
192
193 for d in self.diffs:
194 # Files are exactly same, skip analysis
195 if d.a_scan is not None and d.b_scan is not None and d.a_scan.md5 == d.b_scan.md5:
196 continue
197
198 if d.a_scan:
199 d.a_scan.metadata["source"] = "diff"
200 locations[d.a_scan] = {}
201
202 if d.b_scan:
203 d.b_scan.metadata["source"] = "diff"
204 locations[d.b_scan] = {}
205
206 detections = tuple(Analyzer.run(locations.keys()))
207 diff_refs = {}
208 orphans = []
209
210 loc_refs = {}
211
212 for d in detections:
213 loc = d.scan_location
214
215 while loc:
216 if loc in locations:
217 loc_refs.setdefault(loc, []).append(d)
218 diff_refs[d] = loc # TODO: check if this is used and if not then remove
219 break
220
221 loc = loc.parent
222 else:
223 orphans.append(d)
224
225 for diff in self.diffs:
226 a_detections = []
227 b_detections = []
228 if diff.a_scan:
229 a_detections = loc_refs.get(diff.a_scan, [])
230 if diff.b_scan:
231 b_detections = loc_refs.get(diff.b_scan, [])
232
233 diff.add_detections(a_detections, b_detections)
234
235 def _diff_dirs(self, a_path: ScanLocation, b_path: ScanLocation):
236 a_files = list(a_path.list_recursive())

Callers 2

test_diffs_analyzedFunction · 0.95
data_diffFunction · 0.95

Calls 3

getMethod · 0.80
add_detectionsMethod · 0.80
runMethod · 0.45

Tested by 1

test_diffs_analyzedFunction · 0.76