Merge branch 'main' into daverlo/categoryInput
This commit is contained in:
commit
a1176686f1
37 changed files with 6427 additions and 113 deletions
|
|
@ -152,7 +152,7 @@ export async function runQueries(
|
|||
// config.paths specifies external directories. the current
|
||||
// directory is included in the analysis by default. Replicate
|
||||
// that here.
|
||||
["**"].concat(config.paths || []),
|
||||
config.paths,
|
||||
config.pathsIgnore,
|
||||
config.languages,
|
||||
logger
|
||||
|
|
@ -299,16 +299,16 @@ async function injectLinesOfCode(
|
|||
const sarif = JSON.parse(fs.readFileSync(sarifFile, "utf8"));
|
||||
if (Array.isArray(sarif.runs)) {
|
||||
for (const run of sarif.runs) {
|
||||
const metricId = `${language}/summary/lines-of-code`;
|
||||
const ruleId = `${language}/summary/lines-of-code`;
|
||||
run.properties = run.properties || {};
|
||||
run.properties.metricResults = run.properties.metricResults || [];
|
||||
const metric = run.properties.metricResults.find(
|
||||
// the metric id can be in either of two places
|
||||
(m) => m.metricId === metricId || m.metric?.id === metricId
|
||||
const rule = run.properties.metricResults.find(
|
||||
// the rule id can be in either of two places
|
||||
(r) => r.ruleId === ruleId || r.rule?.id === ruleId
|
||||
);
|
||||
// only add the baseline value if the metric already exists
|
||||
if (metric) {
|
||||
metric.baseline = lineCounts[language];
|
||||
// only add the baseline value if the rule already exists
|
||||
if (rule) {
|
||||
rule.baseline = lineCounts[language];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue