Skip to content

Commit

Permalink
Release 1.0.7 (#12)
Browse files Browse the repository at this point in the history
* added missing recommendedArgs

* Update rules.json

---------

Co-authored-by: Manish Singh <[email protected]>
Co-authored-by: GitHub Action <[email protected]>
Co-authored-by: msingh-developer <[email protected]>
  • Loading branch information
4 people authored Nov 20, 2024
1 parent 489ccb9 commit 0fabf15
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 20 deletions.
6 changes: 3 additions & 3 deletions docs/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"name": "@ping-identity/dvlint-base-rule-pack",
"description": "Collection of base rules used to lint DaVinci flows.",
"version": "1.0.6",
"version": "1.0.7",
"rules": [
{
"id": "dv-rule-annotations-001",
Expand Down Expand Up @@ -245,14 +245,14 @@
"description": "Unused Teleport Found",
"message": "Teleport '%' found, but never used",
"type": "error",
"recommendation": "A '%' teleport start node has been found, but is not being used. Consider removing it from the flow.",
"recommendation": "<%> is not being used. Consider removing it from the flow.",
"code": "dv-er-teleport-001"
},
"dv-er-teleport-002": {
"description": "Teleport schema mismatch",
"message": "Teleport schema mismatch. Attribute '%' found, but not defined",
"type": "error",
"recommendation": "Update the JSON to align with the Teleport node schema, ensuring that the '%' attribute is properly defined..",
"recommendation": "Update the JSON to align with the Teleport node schema, ensuring that the '%' attribute is properly defined.",
"code": "dv-er-teleport-002"
}
},
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-base-rule-pack",
"version": "1.0.6",
"version": "1.0.7",
"description": "Collection of base rules used to lint DaVinci flows.",
"main": "RulePack.js",
"scripts": {
Expand Down
9 changes: 5 additions & 4 deletions rules/dv-rule-teleport-001/TeleportRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ class TeleportRule extends LintRule {
description: "Unused Teleport Found",
message: "Teleport '%' found, but never used",
type: "error",
recommendation:
"A '%' teleport start node has been found, but is not being used. Consider removing it from the flow.",
recommendation: "<%> is not being used. Consider removing it from the flow.",
});
this.addCode("dv-er-teleport-002", {
description: "Teleport schema mismatch",
message:
"Teleport schema mismatch. Attribute '%' found, but not defined",
type: "error",
recommendation: "Update the JSON to align with the Teleport node schema, ensuring that the '%' attribute is properly defined..",
recommendation: "Update the JSON to align with the Teleport node schema, ensuring that the '%' attribute is properly defined.",
});
}

Expand Down Expand Up @@ -50,7 +49,8 @@ class TeleportRule extends LintRule {
Object.entries(startNodes).forEach(([startNodeId, startNodeTitle]) => {
if (!gotoNodes.includes(startNodeId)) {
this.addError("dv-er-teleport-001", {
messageArgs: [`${startNodeTitle} (${startNodeId})`],
messageArgs: [`${startNodeTitle || ''} (${startNodeId})`],
recommendationArgs: [startNodeId],
nodeId: startNodeId,
});
} else {
Expand Down Expand Up @@ -83,6 +83,7 @@ class TeleportRule extends LintRule {
) {
this.addError("dv-er-teleport-002", {
messageArgs: [attrName],
recommendationArgs: [attrName],
nodeId: gotoNode.data.id,
});

Expand Down
4 changes: 2 additions & 2 deletions rules/dv-rule-teleport-001/tests/TeleportRule.expect.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"code": "dv-er-teleport-001",
"message": "Teleport 'UNUSED (8ln2qk7de5)' found, but never used",
"type": "error",
"recommendation": "A '%' teleport start node has been found, but is not being used. Consider removing it from the flow."
"recommendation": "<8ln2qk7de5> is not being used. Consider removing it from the flow."
}
],
"rulesApplied": [
Expand All @@ -34,7 +34,7 @@
"code": "dv-er-teleport-001",
"message": "Teleport 'UNUSED (8ln2qk7de5)' found, but never used",
"type": "error",
"recommendation": "A '%' teleport start node has been found, but is not being used. Consider removing it from the flow."
"recommendation": "<8ln2qk7de5> is not being used. Consider removing it from the flow."
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"code": "dv-er-teleport-002",
"message": "Teleport schema mismatch. Attribute 'userid' found, but not defined",
"nodeId": "2shaj7vbbu",
"recommendation": "Update the JSON to align with the Teleport node schema, ensuring that the '%' attribute is properly defined..",
"recommendation": "Update the JSON to align with the Teleport node schema, ensuring that the 'userid' attribute is properly defined.",
"type": "error"
}
],
Expand All @@ -35,7 +35,7 @@
"code": "dv-er-teleport-002",
"message": "Teleport schema mismatch. Attribute 'userid' found, but not defined",
"type": "error",
"recommendation": "Update the JSON to align with the Teleport node schema, ensuring that the '%' attribute is properly defined.."
"recommendation": "Update the JSON to align with the Teleport node schema, ensuring that the 'userid' attribute is properly defined."
}
]
}
Expand Down
4 changes: 2 additions & 2 deletions rules/dv-rule-variables-001/VariableRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ class DVRule extends LintRule {

usedVarRefs?.forEach((m) => {
if (!flowVarRefs.has(m)) {
this.addError("dv-er-variable-002", { messageArgs: [m] });
this.addError("dv-er-variable-002", { messageArgs: [m], recommendationArgs: [m] });
}
});

flowVars?.forEach((v) => {
if (!usedVarRefs.has(v.ref)) {
this.addError("dv-er-variable-001", { messageArgs: [v.ref] });
this.addError("dv-er-variable-001", { messageArgs: [v.ref], recommendationArgs: [v.ref] });
}
});
} catch (err) {
Expand Down
8 changes: 4 additions & 4 deletions rules/dv-rule-variables-001/tests/VariableRule.expect.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
{
"code": "dv-er-variable-002",
"message": "Variable '{{global.flow.variables.notFound}}' used, but never defined in a Variable connector",
"recommendation": "The '%' variable is not defined within a variable connector, which may lead to unexpected behavior. Define the variable appropriately.",
"recommendation": "The '{{global.flow.variables.notFound}}' variable is not defined within a variable connector, which may lead to unexpected behavior. Define the variable appropriately.",
"type": "error"
},
{
"code": "dv-er-variable-001",
"message": "Variable '{{global.flow.variables.notUsed}}' found, but never used",
"recommendation": "The '%' variable has been found but is not utilized in the flow. Consider removing the unused variable.",
"recommendation": "The '{{global.flow.variables.notUsed}}' variable has been found but is not utilized in the flow. Consider removing the unused variable.",
"type": "error"
}
],
Expand All @@ -40,13 +40,13 @@
"code": "dv-er-variable-002",
"message": "Variable '{{global.flow.variables.notFound}}' used, but never defined in a Variable connector",
"type": "error",
"recommendation": "The '%' variable is not defined within a variable connector, which may lead to unexpected behavior. Define the variable appropriately."
"recommendation": "The '{{global.flow.variables.notFound}}' variable is not defined within a variable connector, which may lead to unexpected behavior. Define the variable appropriately."
},
{
"code": "dv-er-variable-001",
"message": "Variable '{{global.flow.variables.notUsed}}' found, but never used",
"type": "error",
"recommendation": "The '%' variable has been found but is not utilized in the flow. Consider removing the unused variable."
"recommendation": "The '{{global.flow.variables.notUsed}}' variable has been found but is not utilized in the flow. Consider removing the unused variable."
}
]
}
Expand Down

0 comments on commit 0fabf15

Please sign in to comment.