node-sarif-builder
Advanced tools
Comparing version 0.1.2-alpha202201102231.0 to 0.1.2-alpha202201102239.0
@@ -57,4 +57,5 @@ "use strict"; | ||
sarifRunBuilder.addRule(createInitSarifRuleBuilder()); | ||
const sarifResultBuilder = createInitSarifResultBuilder(); | ||
sarifRunBuilder.addResult(sarifResultBuilder); | ||
sarifRunBuilder.addRule(createInitSarifRuleBuilder2()); | ||
sarifRunBuilder.addResult(createInitSarifResultBuilder()); | ||
sarifRunBuilder.addResult(createInitSarifResultBuilder2()); | ||
sarifBuilder.addRun(sarifRunBuilder); | ||
@@ -66,5 +67,5 @@ const outputFile = path.join(os.tmpdir(), 'testSarifBuilder-' + Math.random() + '.sarif'); | ||
t.assert(((_a = outputSarifObj === null || outputSarifObj === void 0 ? void 0 : outputSarifObj.runs) === null || _a === void 0 ? void 0 : _a.length) > 0, 'No runs found in generated SARIF log'); | ||
t.assert(((_d = (_c = (_b = outputSarifObj === null || outputSarifObj === void 0 ? void 0 : outputSarifObj.runs[0].tool) === null || _b === void 0 ? void 0 : _b.driver) === null || _c === void 0 ? void 0 : _c.rules) === null || _d === void 0 ? void 0 : _d.length) > 0, 'No rules found in generated SARIF log'); | ||
t.assert(((_d = (_c = (_b = outputSarifObj === null || outputSarifObj === void 0 ? void 0 : outputSarifObj.runs[0].tool) === null || _b === void 0 ? void 0 : _b.driver) === null || _c === void 0 ? void 0 : _c.rules) === null || _d === void 0 ? void 0 : _d.length) > 1, 'No rules found in generated SARIF log'); | ||
t.assert((outputSarifObj === null || outputSarifObj === void 0 ? void 0 : outputSarifObj.runs[0].artifacts.length) > 0, 'No artifacts found in generated SARIF log'); | ||
t.assert(((_e = outputSarifObj === null || outputSarifObj === void 0 ? void 0 : outputSarifObj.runs[0].results) === null || _e === void 0 ? void 0 : _e.length) > 0, 'No results found in generated SARIF log'); | ||
t.assert(((_e = outputSarifObj === null || outputSarifObj === void 0 ? void 0 : outputSarifObj.runs[0].results) === null || _e === void 0 ? void 0 : _e.length) > 1, 'No results found in generated SARIF log'); | ||
t.assert((outputSarifObj === null || outputSarifObj === void 0 ? void 0 : outputSarifObj.runs[0].results[0].ruleIndex) !== null, 'Result rule index should be set'); | ||
@@ -99,2 +100,13 @@ t.assert(((_j = (_h = (_g = (_f = outputSarifObj === null || outputSarifObj === void 0 ? void 0 : outputSarifObj.runs[0].results[0]) === null || _f === void 0 ? void 0 : _f.locations[0]) === null || _g === void 0 ? void 0 : _g.physicalLocation) === null || _h === void 0 ? void 0 : _h.artifactLocation) === null || _j === void 0 ? void 0 : _j.index) !== null, 'Result artifact index should be set'); | ||
} | ||
function createInitSarifResultBuilder2() { | ||
const sarifResultBuilder = new sarif_result_builder_1.SarifResultBuilder(); | ||
sarifResultBuilder.initSimple({ | ||
level: 'warning', | ||
messageText: 'Nooo no any !', | ||
ruleId: 'NoAny', | ||
fileUri: 'src/urf/wesh.js', | ||
startLine: 8, | ||
}); | ||
return sarifResultBuilder; | ||
} | ||
function createInitSarifWrongResultBuilder() { | ||
@@ -121,1 +133,10 @@ const sarifResultBuilder = new sarif_result_builder_1.SarifResultBuilder(); | ||
} | ||
function createInitSarifRuleBuilder2() { | ||
const sarifRuleBuilder = new sarif_rule_builder_1.SarifRuleBuilder(); | ||
sarifRuleBuilder.initSimple({ | ||
ruleId: 'NoAny', | ||
shortDescriptionText: 'Nooo no no, any are not good !', | ||
helpUri: 'https://codenarc.org/codenarc-rules-basic.html#NoAny' | ||
}); | ||
return sarifRuleBuilder; | ||
} |
{ | ||
"name": "node-sarif-builder", | ||
"version": "0.1.2-alpha202201102231.0", | ||
"version": "0.1.2-alpha202201102239.0", | ||
"description": "Module to help building SARIF log files", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -83,4 +83,5 @@ import * as os from 'os'; | ||
sarifRunBuilder.addRule(createInitSarifRuleBuilder()); | ||
const sarifResultBuilder = createInitSarifResultBuilder(); | ||
sarifRunBuilder.addResult(sarifResultBuilder); | ||
sarifRunBuilder.addRule(createInitSarifRuleBuilder2()); | ||
sarifRunBuilder.addResult(createInitSarifResultBuilder()); | ||
sarifRunBuilder.addResult(createInitSarifResultBuilder2()); | ||
sarifBuilder.addRun(sarifRunBuilder); | ||
@@ -99,3 +100,3 @@ const outputFile = path.join( | ||
t.assert( | ||
outputSarifObj?.runs[0].tool?.driver?.rules?.length > 0, | ||
outputSarifObj?.runs[0].tool?.driver?.rules?.length > 1, | ||
'No rules found in generated SARIF log' | ||
@@ -108,3 +109,3 @@ ); | ||
t.assert( | ||
outputSarifObj?.runs[0].results?.length > 0, | ||
outputSarifObj?.runs[0].results?.length > 1, | ||
'No results found in generated SARIF log' | ||
@@ -153,2 +154,14 @@ ); | ||
function createInitSarifResultBuilder2() { | ||
const sarifResultBuilder = new SarifResultBuilder(); | ||
sarifResultBuilder.initSimple({ | ||
level: 'warning', | ||
messageText: 'Nooo no any !', | ||
ruleId: 'NoAny', | ||
fileUri: 'src/urf/wesh.js', | ||
startLine: 8, | ||
}); | ||
return sarifResultBuilder; | ||
} | ||
function createInitSarifWrongResultBuilder() { | ||
@@ -175,2 +188,12 @@ const sarifResultBuilder = new SarifResultBuilder(); | ||
return sarifRuleBuilder; | ||
} | ||
function createInitSarifRuleBuilder2() { | ||
const sarifRuleBuilder = new SarifRuleBuilder(); | ||
sarifRuleBuilder.initSimple({ | ||
ruleId: 'NoAny', | ||
shortDescriptionText: 'Nooo no no, any are not good !', | ||
helpUri: 'https://codenarc.org/codenarc-rules-basic.html#NoAny' | ||
}); | ||
return sarifRuleBuilder; | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
281603
1823