lightning-flow-scanner-core
Advanced tools
Comparing version 1.0.17 to 1.0.18
@@ -23,28 +23,29 @@ "use strict"; | ||
indexesToProcess = indexesToProcess.filter(index => !processedLoopElementIndexes.includes(index)); | ||
if (indexesToProcess.length > 0) { | ||
for (const [index, element] of flowElements.entries()) { | ||
if (indexesToProcess.includes(index)) { | ||
const connectors = []; | ||
for (const connector of element.connectors) { | ||
if (connector.reference) { | ||
connectors.push(connector); | ||
} | ||
if (indexesToProcess.length <= 0 || (indexesToProcess.length == 1 && indexesToProcess[0] == -1)) { | ||
break; | ||
} | ||
for (const [index, element] of flowElements.entries()) { | ||
if (indexesToProcess.includes(index)) { | ||
const connectors = []; | ||
for (const connector of element.connectors) { | ||
if (connector.reference) { | ||
connectors.push(connector); | ||
} | ||
if (dmlStatementTypes.includes(element.subtype)) { | ||
dmlInLoopIndexes.push(index); | ||
} | ||
if (connectors.length > 0) { | ||
const elementsByReferences = flowElements.filter(element => connectors.map(c => c.reference).includes(element.name)); | ||
for (const nextElement of elementsByReferences) { | ||
const nextIndex = flowElements.findIndex(element => nextElement.name === element.name); | ||
if ('loops' === nextElement.subtype) { | ||
reachedEndOfLoop = true; | ||
} | ||
else if (!processedLoopElementIndexes.includes(nextIndex)) { | ||
indexesToProcess.push(nextIndex); | ||
} | ||
} | ||
if (dmlStatementTypes.includes(element.subtype)) { | ||
dmlInLoopIndexes.push(index); | ||
} | ||
if (connectors.length > 0) { | ||
const elementsByReferences = flowElements.filter(element => connectors.map(c => c.reference).includes(element.name)); | ||
for (const nextElement of elementsByReferences) { | ||
const nextIndex = flowElements.findIndex(element => nextElement.name === element.name); | ||
if ('loops' === nextElement.subtype) { | ||
reachedEndOfLoop = true; | ||
} | ||
else if (!processedLoopElementIndexes.includes(nextIndex)) { | ||
indexesToProcess.push(nextIndex); | ||
} | ||
} | ||
processedLoopElementIndexes.push(index); | ||
} | ||
processedLoopElementIndexes.push(index); | ||
} | ||
@@ -51,0 +52,0 @@ } |
{ | ||
"name": "lightning-flow-scanner-core", | ||
"version": "1.0.17", | ||
"version": "1.0.18", | ||
"main": "out/**", | ||
@@ -5,0 +5,0 @@ "types": "out/index.d.ts", |
@@ -1,15 +0,16 @@ | ||
# Lightning Flow Scanner(Core) | ||
### _Used in both the VSCode extension as well as SFDX plugin with the same name._ | ||
# Lightning Flow Scanner(Rule Engine) | ||
## Rules Included: | ||
### _The core contains the rule engine used in both the [VSCode extension](https://marketplace.visualstudio.com/items?itemName=ForceConfigControl.lightningflowscanner&ssr=false#review-details) and the [SFDX plugin](https://www.npmjs.com/package/lightning-flow-scanner)._ | ||
DML statements in a loop, | ||
Duplicate DML operations, | ||
Hardcoded Ids, | ||
Missing flow description, | ||
Missing error handlers, | ||
Missing null handlers, | ||
Unconnected elements(auto-fix), | ||
Unused variables(auto-fix) | ||
## Available Rules: | ||
* DML statements in a loop | ||
* Duplicate DML operations | ||
* Hardcoded Ids | ||
* Missing flow description | ||
* Missing error handlers | ||
* Missing null handlers | ||
* Unconnected elements(fixable) | ||
* Unused variables(fixable) | ||
## Functions | ||
@@ -16,0 +17,0 @@ |
@@ -28,27 +28,28 @@ import {IRuleDefinition} from '../interfaces/IRuleDefinition'; | ||
indexesToProcess = indexesToProcess.filter(index => !processedLoopElementIndexes.includes(index)); | ||
if (indexesToProcess.length > 0) { | ||
for (const [index, element] of flowElements.entries()) { | ||
if (indexesToProcess.includes(index)) { | ||
const connectors = []; | ||
for (const connector of element.connectors) { | ||
if (connector.reference) { | ||
connectors.push(connector); | ||
} | ||
if(indexesToProcess.length <= 0 || (indexesToProcess.length == 1 && indexesToProcess[0] == -1)){ | ||
break; | ||
} | ||
for (const [index, element] of flowElements.entries()) { | ||
if (indexesToProcess.includes(index)) { | ||
const connectors = []; | ||
for (const connector of element.connectors) { | ||
if (connector.reference) { | ||
connectors.push(connector); | ||
} | ||
if (dmlStatementTypes.includes(element.subtype)) { | ||
dmlInLoopIndexes.push(index); | ||
} | ||
if (connectors.length > 0) { | ||
const elementsByReferences = flowElements.filter(element => connectors.map(c => c.reference).includes(element.name)); | ||
for (const nextElement of elementsByReferences) { | ||
const nextIndex = flowElements.findIndex(element => nextElement.name === element.name); | ||
if ('loops' === nextElement.subtype) { | ||
reachedEndOfLoop = true; | ||
} else if (!processedLoopElementIndexes.includes(nextIndex)) { | ||
indexesToProcess.push(nextIndex); | ||
} | ||
} | ||
if (dmlStatementTypes.includes(element.subtype)) { | ||
dmlInLoopIndexes.push(index); | ||
} | ||
if (connectors.length > 0) { | ||
const elementsByReferences = flowElements.filter(element => connectors.map(c => c.reference).includes(element.name)); | ||
for (const nextElement of elementsByReferences) { | ||
const nextIndex = flowElements.findIndex(element => nextElement.name === element.name); | ||
if ('loops' === nextElement.subtype) { | ||
reachedEndOfLoop = true; | ||
} else if (!processedLoopElementIndexes.includes(nextIndex)) { | ||
indexesToProcess.push(nextIndex); | ||
} | ||
} | ||
processedLoopElementIndexes.push(index); | ||
} | ||
processedLoopElementIndexes.push(index); | ||
} | ||
@@ -55,0 +56,0 @@ } |
Sorry, the diff of this file is not supported yet
739380
28729
30