in frontend/src/zero_coverage_report.js [130:198]
export async function zeroCoverageDisplay(data, dir) {
hide("output");
hide("history");
message(
"loading",
"Loading zero coverage report for " + (dir || "mozilla-central"),
);
while (dir.endsWith("/")) {
dir = dir.substring(0, dir.length - 1);
}
dir += "/";
if (dir === "/") {
dir = "";
}
let files = data.files.filter((file) => file.name.startsWith(dir));
// TODO: Do this in the backend directly!
files.forEach((file) => {
file.path = file.name;
});
files = await filterThirdParty(files);
files = filterLanguages(files);
files = filterHeaders(files);
files = filterCompletelyUncovered(files);
files = filterLastPushDate(files);
const map = new Map();
for (const file of files) {
let rest = file.path.substring(dir.lastIndexOf("/") + 1);
if (rest.includes("/")) {
rest = rest.substring(0, rest.indexOf("/"));
if (map.has(rest)) {
cumStats(map.get(rest), file);
} else {
map.set(rest, getBaseStats(file, 1));
}
} else {
if (map.has(rest)) {
console.warn(rest + " is already in map.");
}
map.set(rest, getBaseStats(file, 0));
}
}
const revision = data.hg_revision;
const context = {
current_dir: dir,
entries: sortEntries(Array.from(map.entries())),
entry_url() {
const path = dir + this.dir;
if (this.stats.children !== 0) {
return buildRoute({
view: "zero",
path,
});
}
// Fully reset the url when moving back to file view
return `#view=file&revision=${revision}&path=${path}`;
},
navbar: buildNavbar(dir),
total: files.length,
};
hide("message");
render("zerocoverage", context, "output");
}