Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.1.2 #20

Merged
merged 3 commits into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 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.1.1",
"version": "1.1.2",
"rules": [
{
"id": "dv-rule-annotations-001",
Expand Down Expand Up @@ -126,7 +126,7 @@
"codes": {
"dv-er-multi-start-001": {
"description": "Multiple start points or floating node(s) found",
"message": "Node % could be one of multiple start points, or floating",
"message": "Flow has multiple start points or a floating node",
"type": "error",
"recommendation": "The '%' node is either disconnected or has multiple starting points. Ensure that the node is correctly connected and has only one starting point.",
"code": "dv-er-multi-start-001"
Expand All @@ -141,21 +141,21 @@
"codes": {
"dv-bp-node-001": {
"description": "All nodes should have a title",
"message": "Missing nodeTitle on node (% - %)",
"message": "Missing node title",
"type": "best-practice",
"recommendation": "The (% %) node is missing a title. For optimal clarity, add a descriptive title.",
"code": "dv-bp-node-001"
},
"dv-bp-node-002": {
"description": "All success/error JSON nodes should proper colors",
"message": "Incorrect node color [%] - %",
"message": "Incorrect node color",
"type": "best-practice",
"recommendation": "The <%> is not using the correct color. To ensure consistency, use the recommended color: [%].",
"recommendation": "The (% %) is not using the correct color. To ensure consistency, use the recommended color: [%].",
"code": "dv-bp-node-002"
},
"dv-bp-node-003": {
"description": "All nodes should have a description",
"message": "Missing Node Description on node (% - %)",
"message": "Missing node description",
"type": "best-practice",
"recommendation": "The (% %) node is missing a description. For optimal clarity, add a meaningful description.",
"code": "dv-bp-node-003"
Expand All @@ -177,9 +177,9 @@
"codes": {
"dv-er-node-001": {
"description": "Disabled Node Found",
"message": "Disabled node % found",
"message": "Disabled node found",
"type": "error",
"recommendation": "A disabled '%' node has been found. Consider removing it from the flow.",
"recommendation": "A disabled (% %) node has been found. Consider removing it from the flow.",
"code": "dv-er-node-001"
},
"dv-er-node-002": {
Expand Down Expand Up @@ -214,21 +214,21 @@
"codes": {
"dv-er-subflow-001": {
"description": "Subflow names mismatched",
"message": "Incorrect or Missing Subflow in (%)",
"message": "Incorrect or missing subflow",
"type": "error",
"recommendation": "There is an incorrect or missing subflow in the (%) flow. Ensure that the appropriate subflow is selected and that the names match within the configuration.",
"code": "dv-er-subflow-001"
},
"dv-er-subflow-002": {
"description": "Circular SubFlow Found",
"message": "Circular SubFlow Dependency Found - '%' points back to '%' via subflow",
"message": "Circular subflow dependency found",
"type": "error",
"recommendation": "In this subflow, '%' points back to '%', which can cause import and export errors. Configure the subflow to return to the parent flow.",
"code": "dv-er-subflow-002"
},
"dv-er-subflow-003": {
"description": "Missing Input schema values",
"message": "Input Schema values for '%' subflow is not configured.",
"message": "Subflow input schema missing",
"type": "error",
"recommendation": "The input schema values for the '%' subflow are not currently configured. Configure the schema in the subflow.",
"code": "dv-er-subflow-003"
Expand All @@ -243,14 +243,14 @@
"codes": {
"dv-er-teleport-001": {
"description": "Unused Teleport Found",
"message": "Teleport '%' found, but never used",
"message": "Unused teleport node found",
"type": "error",
"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",
"message": "Teleport schema mismatch",
"type": "error",
"recommendation": "Update the JSON to align with the Teleport node schema, ensuring that the '%' attribute is properly defined.",
"code": "dv-er-teleport-002"
Expand All @@ -265,14 +265,14 @@
"codes": {
"dv-er-variable-001": {
"description": "Unused Variable Found",
"message": "Variable '%' found, but never used",
"message": "Unused Variable Found",
"type": "error",
"recommendation": "The '%' variable has been found but is not utilized in the flow. Consider removing the unused variable.",
"code": "dv-er-variable-001"
},
"dv-er-variable-002": {
"description": "Variable '%' used, but never defined in a Variable connector",
"message": "Variable '%' used, but never defined in a Variable connector",
"description": "Undefined variable found",
"message": "Undefined variable found",
"type": "error",
"recommendation": "The '%' variable is not defined within a variable connector, which may lead to unexpected behavior. Define the variable appropriately.",
"code": "dv-er-variable-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.1.1",
"version": "1.1.2",
"description": "Collection of base rules used to lint DaVinci flows.",
"main": "RulePack.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions rules/dv-rule-multi-start-001/MultiStartRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MultiStartRule extends LintRule {

this.addCode("dv-er-multi-start-001", {
description: "Multiple start points or floating node(s) found",
message: "Node % could be one of multiple start points, or floating",
message: "Flow has multiple start points or a floating node",
type: "error",
recommendation:
"The '%' node is either disconnected or has multiple starting points. Ensure that the node is correctly connected and has only one starting point.",
Expand Down Expand Up @@ -48,8 +48,8 @@ class MultiStartRule extends LintRule {
notTargets.forEach((node) =>
this.addError("dv-er-multi-start-001", {
flowId: flow.flowId,
messageArgs: [`${node.nodeId} (${node.nodeType})`],
recommendationArgs: [`${node.nodeId} (${node.nodeType})`],
nodeId: node.nodeId,
})
);
}
Expand Down
12 changes: 6 additions & 6 deletions rules/dv-rule-multi-start-001/tests/MultiStartRule.expect.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
{
"flowId": "3de5ba439a95765a5a08242546d963d8",
"code": "dv-er-multi-start-001",
"message": "Node v9172ugldd (httpConnector) could be one of multiple start points, or floating",
"message": "Flow has multiple start points or a floating node",
"type": "error",
"recommendation": "The 'v9172ugldd (httpConnector)' node is either disconnected or has multiple starting points. Ensure that the node is correctly connected and has only one starting point."
},
{
"flowId": "3de5ba439a95765a5a08242546d963d8",
"code": "dv-er-multi-start-001",
"message": "Node 20n6fhhgqz (httpConnector) could be one of multiple start points, or floating",
"message": "Flow has multiple start points or a floating node",
"type": "error",
"recommendation": "The '20n6fhhgqz (httpConnector)' node is either disconnected or has multiple starting points. Ensure that the node is correctly connected and has only one starting point."
},
{
"flowId": "3de5ba439a95765a5a08242546d963d8",
"code": "dv-er-multi-start-001",
"message": "Node ilgr9525d6 (httpConnector) could be one of multiple start points, or floating",
"message": "Flow has multiple start points or a floating node",
"type": "error",
"recommendation": "The 'ilgr9525d6 (httpConnector)' node is either disconnected or has multiple starting points. Ensure that the node is correctly connected and has only one starting point."
}
Expand All @@ -48,21 +48,21 @@
{
"flowId": "3de5ba439a95765a5a08242546d963d8",
"code": "dv-er-multi-start-001",
"message": "Node v9172ugldd (httpConnector) could be one of multiple start points, or floating",
"message": "Flow has multiple start points or a floating node",
"type": "error",
"recommendation": "The 'v9172ugldd (httpConnector)' node is either disconnected or has multiple starting points. Ensure that the node is correctly connected and has only one starting point."
},
{
"flowId": "3de5ba439a95765a5a08242546d963d8",
"code": "dv-er-multi-start-001",
"message": "Node 20n6fhhgqz (httpConnector) could be one of multiple start points, or floating",
"message": "Flow has multiple start points or a floating node",
"type": "error",
"recommendation": "The '20n6fhhgqz (httpConnector)' node is either disconnected or has multiple starting points. Ensure that the node is correctly connected and has only one starting point."
},
{
"flowId": "3de5ba439a95765a5a08242546d963d8",
"code": "dv-er-multi-start-001",
"message": "Node ilgr9525d6 (httpConnector) could be one of multiple start points, or floating",
"message": "Flow has multiple start points or a floating node",
"type": "error",
"recommendation": "The 'ilgr9525d6 (httpConnector)' node is either disconnected or has multiple starting points. Ensure that the node is correctly connected and has only one starting point."
}
Expand Down
25 changes: 10 additions & 15 deletions rules/dv-rule-node-001/NodeRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ class NodeRule extends LintRule {

this.addCode("dv-bp-node-001", {
description: "All nodes should have a title",
message: "Missing nodeTitle on node (% - %)",
message: "Missing node title",
type: "best-practice",
recommendation: "The (% %) node is missing a title. For optimal clarity, add a descriptive title.",
});
this.addCode("dv-bp-node-002", {
description: "All success/error JSON nodes should proper colors",
message: "Incorrect node color [%] - %",
message: "Incorrect node color",
type: "best-practice",
recommendation: "The <%> is not using the correct color. To ensure consistency, use the recommended color: [%].",
recommendation: "The (% %) is not using the correct color. To ensure consistency, use the recommended color: [%].",
});
this.addCode("dv-bp-node-003", {
description: "All nodes should have a description",
message: "Missing Node Description on node (% - %)",
message: "Missing node description",
type: "best-practice",
recommendation: "The (% %) node is missing a description. For optimal clarity, add a meaningful description.",
});
Expand All @@ -42,33 +42,32 @@ class NodeRule extends LintRule {

runRule() {
try {
const ignoreNodeTypes = ["nodeConnector", "functionsConnector"];
for (const flow of this.allFlows) {
flow?.graphData?.elements?.nodes?.forEach((node) => {
const { data } = node;

// Check for node title
if (
data.nodeType === "CONNECTION" &&
!data.properties?.nodeTitle?.value &&
!(data.capabilityName === 'goToNode' || data.capabilityName === 'returnBackToCallingNode')
!(data.capabilityName === 'goToNode' || data.capabilityName === 'returnBackToCallingNode') &&
!data.properties?.nodeTitle?.value
) {
this.addError("dv-bp-node-001", {
flowId: flow.flowId,
messageArgs: [data.id, data.name],
recommendationArgs: [data.id, data.name],
nodeId: data.id,
});
}

// Check for node description
if (
!ignoreNodeTypes.includes(data.connectorId) &&
data.nodeType === "CONNECTION" &&
!data.properties?.nodeDescription?.value &&
!(data.capabilityName === 'goToNode' || data.capabilityName === 'returnBackToCallingNode')
!data.properties?.nodeDescription?.value
) {
this.addError("dv-bp-node-003", {
flowId: flow.flowId,
messageArgs: [data.id, data.name],
recommendationArgs: [data.id, data.name],
nodeId: data.id,
});
Expand All @@ -88,11 +87,7 @@ class NodeRule extends LintRule {
) {
this.addError("dv-bp-node-002", {
flowId: flow.flowId,
messageArgs: [
data.properties?.backgroundColor?.value.toLowerCase() || '',
`${data.name} (${data.id}) - ${data.capabilityName}`,
],
recommendationArgs: [`${data.name} (${data.id}) - ${data.capabilityName}`, backgroundColor[connectorCapability]],
recommendationArgs: [data.id, data.name, backgroundColor[connectorCapability]],
nodeId: data.id,
});
}
Expand Down
6 changes: 3 additions & 3 deletions rules/dv-rule-node-001/tests/IgnoreRules.expect.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@
{
"flowId": "08c45a026b2f5779afca6d437dce2f49",
"code": "dv-bp-node-003",
"message": "Missing Node Description on node (osyiff3qqw - Variables)",
"message": "Missing node description",
"nodeId": "osyiff3qqw",
"recommendation": "The (osyiff3qqw Variables) node is missing a description. For optimal clarity, add a meaningful description.",
"type": "best-practice"
},
{
"flowId": "08c45a026b2f5779afca6d437dce2f49",
"code": "dv-bp-node-001",
"message": "Missing nodeTitle on node (61te8qo77t - HTTP)",
"message": "Missing node title",
"nodeId": "61te8qo77t",
"recommendation": "The (61te8qo77t HTTP) node is missing a title. For optimal clarity, add a descriptive title.",
"type": "best-practice"
},
{
"flowId": "08c45a026b2f5779afca6d437dce2f49",
"code": "dv-bp-node-003",
"message": "Missing Node Description on node (61te8qo77t - HTTP)",
"message": "Missing node description",
"nodeId": "61te8qo77t",
"recommendation": "The (61te8qo77t HTTP) node is missing a description. For optimal clarity, add a meaningful description.",
"type": "best-practice"
Expand Down
32 changes: 8 additions & 24 deletions rules/dv-rule-node-001/tests/NodeRule.expect.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
{
"name": "PingOne DaVinci Linter",
"pass": false,
"errorCount": 3,
"errorCount": 2,
"rulePackResults": [
{
"pass": false,
"errorCount": 3,
"errorCount": 2,
"lintResults": [
{
"flowId": "47360733f8216ad35114e9a787ca83e0",
"flowName": "Starter Flow",
"pass": false,
"errorCount": 3,
"errorCount": 2,
"errors": [
{
"flowId": "47360733f8216ad35114e9a787ca83e0",
"code": "dv-bp-node-003",
"message": "Missing Node Description on node (4zjizi23c6 - Node)",
"nodeId": "4zjizi23c6",
"recommendation": "The (4zjizi23c6 Node) node is missing a description. For optimal clarity, add a meaningful description.",
"type": "best-practice"
},
{
"flowId": "47360733f8216ad35114e9a787ca83e0",
"code": "dv-bp-node-001",
"message": "Missing nodeTitle on node (13xqy80afe - Http)",
"message": "Missing node title",
"type": "best-practice",
"recommendation": "The (13xqy80afe Http) node is missing a title. For optimal clarity, add a descriptive title.",
"nodeId": "13xqy80afe"
},
{
"flowId": "47360733f8216ad35114e9a787ca83e0",
"code": "dv-bp-node-003",
"message": "Missing Node Description on node (13xqy80afe - Http)",
"message": "Missing node description",
"nodeId": "13xqy80afe",
"recommendation": "The (13xqy80afe Http) node is missing a description. For optimal clarity, add a meaningful description.",
"type": "best-practice"
Expand All @@ -46,28 +38,20 @@
"ruleId": "dv-rule-node-001",
"ruleDescription": "Ensure nodes have names/titles",
"pass": false,
"errorCount": 3,
"errorCount": 2,
"errors": [
{
"flowId": "47360733f8216ad35114e9a787ca83e0",
"code": "dv-bp-node-003",
"message": "Missing Node Description on node (4zjizi23c6 - Node)",
"nodeId": "4zjizi23c6",
"recommendation": "The (4zjizi23c6 Node) node is missing a description. For optimal clarity, add a meaningful description.",
"type": "best-practice"
},
{
"flowId": "47360733f8216ad35114e9a787ca83e0",
"code": "dv-bp-node-001",
"message": "Missing nodeTitle on node (13xqy80afe - Http)",
"message": "Missing node title",
"type": "best-practice",
"recommendation": "The (13xqy80afe Http) node is missing a title. For optimal clarity, add a descriptive title.",
"nodeId": "13xqy80afe"
},
{
"flowId": "47360733f8216ad35114e9a787ca83e0",
"code": "dv-bp-node-003",
"message": "Missing Node Description on node (13xqy80afe - Http)",
"message": "Missing node description",
"nodeId": "13xqy80afe",
"recommendation": "The (13xqy80afe Http) node is missing a description. For optimal clarity, add a meaningful description.",
"type": "best-practice"
Expand Down
Loading
Loading