Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start parsing the chunks file with serde #31

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
insert all datapoints
  • Loading branch information
Swatinem committed Nov 19, 2024
commit 70fa498befb2fc9ca49875bb7b66c37442dc9fad
21 changes: 18 additions & 3 deletions core/src/parsers/pyreport/chunks_serde.rs
Original file line number Diff line number Diff line change
@@ -69,6 +69,7 @@ where
}

let mut ctx = ParseCtx::new(builder, report_json.files, report_json.sessions);
ctx.labels_index = labels_index;

let mut report_lines = vec![];

@@ -92,9 +93,23 @@ where
})
.collect();

let datapoints = line
.5
.map(|dps| dps.into_iter().map(|dp| (dp.0, dp.into())).collect());
let datapoints: Option<HashMap<_, _>> = line.5.map(|dps| {
dps.into_iter()
.map(|dp| (dp.0, types::CoverageDatapoint::from(dp)))
.collect()
});

if let Some(datapoints) = &datapoints {
for datapoint in datapoints.values() {
for label in &datapoint.labels {
if !ctx.labels_index.contains_key(label) {
let context = ctx.db.report_builder.insert_context(label)?;
ctx.labels_index.insert(label.into(), context.id);
}
}
}
}

let mut report_line = ReportLine {
line_no,
coverage: line.0,