Skip to content

Commit

Permalink
NodeId added in Subflow rule :circular dependency (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
msingh-developer authored Feb 4, 2025
1 parent 2c7c66a commit dd79b20
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"description": "Circular SubFlow Found",
"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.",
"recommendation": "The main flow and subflow reference each other, creating a circular dependency loop. Modify the flow structure to ensure subflows do not point back to parent flows, preventing execution deadlocks.",
"code": "dv-er-subflow-002"
},
"dv-er-subflow-003": {
Expand Down Expand Up @@ -266,7 +266,7 @@
"dv-er-variable-001": {
"description": "Unused Variable Found",
"message": "Unused Variable Found",
"type": "error",
"type": "best-practice",
"recommendation": "The '%' variable has been found but is not utilized in the flow. Consider removing the unused variable.",
"code": "dv-er-variable-001"
},
Expand Down
14 changes: 10 additions & 4 deletions rules/dv-rule-subflow-001/SubflowRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DVRule extends LintRule {
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.",
"The main flow and subflow reference each other, creating a circular dependency loop. Modify the flow structure to ensure subflows do not point back to parent flows, preventing execution deadlocks.",
});
this.addCode("dv-er-subflow-003", {
description: "Missing Input schema values",
Expand Down Expand Up @@ -69,9 +69,15 @@ class DVRule extends LintRule {
targetFlow.flowId
)
) {
this.addError("dv-er-subflow-002", {
flowId: subflow.flowId,
recommendationArgs: [subflow.name, targetFlow.name],
subflow?.detail?.graphData?.elements?.nodes?.forEach(node => {
if (node.data.nodeType === 'CONNECTION' && node.data.connectorId === 'flowConnector') {
if (node.data.properties.subFlowId?.value?.value === targetFlow.flowId) {
this.addError("dv-er-subflow-002", {
flowId: subflow.flowId,
nodeId: node.data.id
});
}
}
});
}

Expand Down
4 changes: 2 additions & 2 deletions rules/dv-rule-subflow-001/tests/SubflowRule2.expect.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"flowId": "e33c447380e79c7f622953e0057080a8",
"message": "Circular subflow dependency found",
"type": "error",
"recommendation": "In this subflow, 'TLS Main' points back to 'TLS Subflow', which can cause import and export errors. Configure the subflow to return to the parent flow."
"recommendation": "The main flow and subflow reference each other, creating a circular dependency loop. Modify the flow structure to ensure subflows do not point back to parent flows, preventing execution deadlocks."
}
],
"rulesApplied": [
Expand All @@ -36,7 +36,7 @@
"flowId": "e33c447380e79c7f622953e0057080a8",
"message": "Circular subflow dependency found",
"type": "error",
"recommendation": "In this subflow, 'TLS Main' points back to 'TLS Subflow', which can cause import and export errors. Configure the subflow to return to the parent flow."
"recommendation": "The main flow and subflow reference each other, creating a circular dependency loop. Modify the flow structure to ensure subflows do not point back to parent flows, preventing execution deadlocks."
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion rules/dv-rule-variables-001/VariableRule.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DVRule extends LintRule {
this.addCode("dv-er-variable-001", {
description: "Unused Variable Found",
message: "Unused Variable Found",
type: "error",
type: "best-practice",
recommendation:
"The '%' variable has been found but is not utilized in the flow. Consider removing the unused variable.",
});
Expand Down
4 changes: 2 additions & 2 deletions rules/dv-rule-variables-001/tests/VariableRule.expect.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"message": "Unused Variable Found",
"nodeId": "899qlenqr0",
"recommendation": "The '{{global.flow.variables.notUsed}}' variable has been found but is not utilized in the flow. Consider removing the unused variable.",
"type": "error"
"type": "best-practice"
},
{
"code": "dv-er-variable-002",
Expand All @@ -46,7 +46,7 @@
"message": "Unused Variable Found",
"nodeId": "899qlenqr0",
"recommendation": "The '{{global.flow.variables.notUsed}}' variable has been found but is not utilized in the flow. Consider removing the unused variable.",
"type": "error"
"type": "best-practice"
},
{
"code": "dv-er-variable-002",
Expand Down

0 comments on commit dd79b20

Please sign in to comment.