MCPcopy Create free account
hub / github.com/CodeSentryAI/lockbud / report_stats

Function report_stats

src/callbacks.rs:214–257  ·  view source on GitHub ↗
(crate_name: &str, reports: &[Report])

Source from the content-addressed store, hash-verified

212 }
213 }
214 }
215}
216
217fn filter_std_reports(reports: Vec<Report>) -> Vec<Report> {
218 reports
219 .into_iter()
220 .filter(|report| !report_is_from_std(report))
221 .collect()
222}
223
224fn report_is_from_std(report: &Report) -> bool {
225 match report {
226 Report::AtomicityViolation(content) => {
227 is_std_location(&content.diagnosis.atomic_reader)
228 || is_std_location(&content.diagnosis.atomic_writer)
229 || is_std_location(&content.diagnosis.fn_name)
230 }
231 Report::InvalidFree(content) | Report::UseAfterFree(content) => {
232 is_std_location(&content.diagnosis)
233 }
234 _ => false,
235 }
236}
237
238fn is_std_location(s: &str) -> bool {
239 s.contains("/library/std/")
240 || s.contains("/library/core/")
241 || s.contains("/library/alloc/")
242 || s.starts_with("library/std/")
243 || s.starts_with("library/core/")
244 || s.starts_with("library/alloc/")
245 || s.starts_with("std::")
246 || s.starts_with("core::")
247 || s.starts_with("alloc::")
248}
249
250fn report_stats(crate_name: &str, reports: &[Report]) -> String {
251 let (
252 mut doublelock_probably,
253 mut doublelock_possibly,
254 mut conflictlock_probably,
255 mut conflictlock_possibly,
256 mut condvar_deadlock_probably,
257 mut condvar_deadlock_possibly,
258 mut atomicity_violation_possibly,
259 mut invalid_free_possibly,
260 mut use_after_free_possibly,

Callers 1

analyze_with_lockbudMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected