Change from metric to rule
The SARIF that we are interpreting has moved away from using `metric` to the more general term, `rule`. We need to adapt our baseline lines of code counting to use `rule` as well.
This commit is contained in:
parent
8e3540bb01
commit
a2312a0bf3
6 changed files with 30 additions and 30 deletions
|
|
@ -44,23 +44,23 @@ test("status report fields and search path setting", async (t) => {
|
|||
sarifFile,
|
||||
JSON.stringify({
|
||||
runs: [
|
||||
// variant 1 uses metricId
|
||||
// variant 1 uses ruleId
|
||||
{
|
||||
properties: {
|
||||
metricResults: [
|
||||
{
|
||||
metricId: `${language}/summary/lines-of-code`,
|
||||
ruleId: `${language}/summary/lines-of-code`,
|
||||
value: 123,
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
// variant 2 uses metric.id
|
||||
// variant 2 uses rule.id
|
||||
{
|
||||
properties: {
|
||||
metricResults: [
|
||||
{
|
||||
metric: {
|
||||
rule: {
|
||||
id: `${language}/summary/lines-of-code`,
|
||||
},
|
||||
value: 123,
|
||||
|
|
@ -166,21 +166,21 @@ test("status report fields and search path setting", async (t) => {
|
|||
const sarif = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
||||
t.deepEqual(sarif.runs[0].properties.metricResults, [
|
||||
{
|
||||
metricId: `${lang}/summary/lines-of-code`,
|
||||
ruleId: `${lang}/summary/lines-of-code`,
|
||||
value: 123,
|
||||
baseline: lineCount,
|
||||
},
|
||||
]);
|
||||
t.deepEqual(sarif.runs[1].properties.metricResults, [
|
||||
{
|
||||
metric: {
|
||||
rule: {
|
||||
id: `${lang}/summary/lines-of-code`,
|
||||
},
|
||||
value: 123,
|
||||
baseline: lineCount,
|
||||
},
|
||||
]);
|
||||
// when the metric doesn't exists, it should not be added
|
||||
// when the rule doesn't exists, it should not be added
|
||||
t.deepEqual(sarif.runs[2].properties.metricResults, []);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue