Skip to content

Commit

Permalink
Release 1.0.3 (#5)
Browse files Browse the repository at this point in the history
* bump version to 1.0.3

* Fix eslint errors

* CLOUD-439 - Return error objects, rather than error messages
  • Loading branch information
tsigle authored Oct 17, 2024
1 parent 7d83180 commit f2b5b58
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/LintRulePack.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ class LintRulePack {
ruleResponse.errorCount += response.errorCount;

response.errors.forEach((err) => {
ruleResponse.errors.push(err.message);
ruleResponse.errors.push(err);
});
}

Expand Down
4 changes: 2 additions & 2 deletions lib/TestLinter.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ class TestLinter {
const testExpect = require(flow.replace(".json", ".expect.json"));

test(`Running rule ${rule.id} with ${path.basename(
flow
flow,
)}`, () => {
expect(
this.linter.lintFlow(testInput, {
includeRules: rule.id,
})
}),
).toMatchObject(testExpect);
});
});
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ping-identity/dvlint",
"version": "1.0.2",
"version": "1.0.3",
"description": "PingOne DaVinci Flow Linter",
"homepage": "https://library.pingidentity.com/page/davinci-linter-cli",
"main": "lib/index.js",
Expand Down
7 changes: 5 additions & 2 deletions test/rules/example-rule/ExampleRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ExampleRule extends LintRule {
runRule() {
try {
const dvFlow = this.mainFlow;
const someErrorCondition = false;
const someErrorCondition = true;

// Variation where this rule is ignored in any subflows
// const { allFlows } = this;
Expand All @@ -29,7 +29,10 @@ class ExampleRule extends LintRule {
// }

if (someErrorCondition) {
this.addError("example-error", { messageArgs: [dvFlow.flowId] });
this.addError("example-error", {
messageArgs: [dvFlow.flowId],
nodeId: "n1234",
});
}
} catch (err) {
this.addError("generic-error", { messageArgs: [`${err}`] });
Expand Down
36 changes: 26 additions & 10 deletions test/rules/example-rule/tests/Example.expect.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,45 @@
{
"name": "PingOne DaVinci Linter",
"pass": true,
"errorCount": 0,
"pass": false,
"errorCount": 1,
"rulePackResults": [
{
"name": "@ping-identity/dvlint",
"pass": true,
"errorCount": 0,
"pass": false,
"errorCount": 1,
"lintResults": [
{
"flowId": "2291498df43a63457abad5d2d1fa4df9",
"flowName": "dv-rule-general-001",
"pass": true,
"errorCount": 0,
"errors": [],
"pass": false,
"errorCount": 1,
"errors": [
{
"code": "example-error",
"message": "Example Rule of flow '2291498df43a63457abad5d2d1fa4df9'",
"nodeId": "n1234",
"recommendation": "We recommend this example.",
"type": "best-practice"
}
],
"rulesApplied": [
"example-rule"
],
"ruleResults": [
{
"ruleId": "example-rule",
"ruleDescription": "Example Rule",
"pass": true,
"errorCount": 0,
"errors": []
"pass": false,
"errorCount": 1,
"errors": [
{
"code": "example-error",
"message": "Example Rule of flow '2291498df43a63457abad5d2d1fa4df9'",
"nodeId": "n1234",
"recommendation": "We recommend this example.",
"type": "best-practice"
}
]
}
],
"rulesIgnored": []
Expand Down

0 comments on commit f2b5b58

Please sign in to comment.