@flow-scanner/lightning-flow-scanner-core 6.16.2 → 6.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (508) hide show
  1. package/.husky/pre-commit +1 -0
  2. package/.husky/pre-push +1 -0
  3. package/.prettierignore +5 -0
  4. package/.swcrc +26 -0
  5. package/.turbo/turbo-build.log +17 -0
  6. package/.turbo/turbo-test.log +144 -0
  7. package/.turbo/turbo-vite$colon$dist.log +21 -0
  8. package/coverage/coverage-final.json +63 -0
  9. package/coverage/lcov-report/base.css +224 -0
  10. package/coverage/lcov-report/block-navigation.js +87 -0
  11. package/coverage/lcov-report/favicon.png +0 -0
  12. package/coverage/lcov-report/index.html +236 -0
  13. package/coverage/lcov-report/prettify.css +1 -0
  14. package/coverage/lcov-report/prettify.js +2 -0
  15. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  16. package/coverage/lcov-report/sorter.js +210 -0
  17. package/coverage/lcov-report/src/index.html +116 -0
  18. package/coverage/lcov-report/src/index.ts.html +238 -0
  19. package/coverage/lcov-report/src/main/adapters/RegexAdapter.ts.html +118 -0
  20. package/coverage/lcov-report/src/main/adapters/index.html +116 -0
  21. package/coverage/lcov-report/src/main/config/NodeIcons.ts.html +376 -0
  22. package/coverage/lcov-report/src/main/config/RuleRegistry.ts.html +646 -0
  23. package/coverage/lcov-report/src/main/config/VariableIcons.ts.html +253 -0
  24. package/coverage/lcov-report/src/main/config/index.html +146 -0
  25. package/coverage/lcov-report/src/main/enums/MetaType.ts.html +100 -0
  26. package/coverage/lcov-report/src/main/enums/MetadataType.ts.html +103 -0
  27. package/coverage/lcov-report/src/main/enums/MetadataTypes.ts.html +100 -0
  28. package/coverage/lcov-report/src/main/enums/index.html +116 -0
  29. package/coverage/lcov-report/src/main/interfaces/IRulesConfig.ts.html +133 -0
  30. package/coverage/lcov-report/src/main/interfaces/index.html +116 -0
  31. package/coverage/lcov-report/src/main/internals/index.html +116 -0
  32. package/coverage/lcov-report/src/main/internals/internals.ts.html +190 -0
  33. package/coverage/lcov-report/src/main/libs/BuildFlow.ts.html +127 -0
  34. package/coverage/lcov-report/src/main/libs/Compiler.ts.html +241 -0
  35. package/coverage/lcov-report/src/main/libs/ConvertFlowNodes.ts.html +97 -0
  36. package/coverage/lcov-report/src/main/libs/DynamicRule.ts.html +118 -0
  37. package/coverage/lcov-report/src/main/libs/ExportDetails.ts.html +256 -0
  38. package/coverage/lcov-report/src/main/libs/ExportDiagram.ts.html +331 -0
  39. package/coverage/lcov-report/src/main/libs/ExportSarif.ts.html +358 -0
  40. package/coverage/lcov-report/src/main/libs/FixFlows.ts.html +265 -0
  41. package/coverage/lcov-report/src/main/libs/GenerateMarkdown.ts.html +331 -0
  42. package/coverage/lcov-report/src/main/libs/GetRuleDefinitions.ts.html +274 -0
  43. package/coverage/lcov-report/src/main/libs/ParseFlows.ts.html +184 -0
  44. package/coverage/lcov-report/src/main/libs/RuleDocumentation.ts.html +190 -0
  45. package/coverage/lcov-report/src/main/libs/ScanFlows.ts.html +508 -0
  46. package/coverage/lcov-report/src/main/libs/exportAsDetails.ts.html +160 -0
  47. package/coverage/lcov-report/src/main/libs/exportAsSarif.ts.html +346 -0
  48. package/coverage/lcov-report/src/main/libs/index.html +251 -0
  49. package/coverage/lcov-report/src/main/models/FlatViolation.ts.html +106 -0
  50. package/coverage/lcov-report/src/main/models/Flow.ts.html +1057 -0
  51. package/coverage/lcov-report/src/main/models/FlowAttribute.ts.html +115 -0
  52. package/coverage/lcov-report/src/main/models/FlowElement.ts.html +133 -0
  53. package/coverage/lcov-report/src/main/models/FlowElementConnector.ts.html +169 -0
  54. package/coverage/lcov-report/src/main/models/FlowGraph.ts.html +1672 -0
  55. package/coverage/lcov-report/src/main/models/FlowMetadata.ts.html +106 -0
  56. package/coverage/lcov-report/src/main/models/FlowNode.ts.html +1252 -0
  57. package/coverage/lcov-report/src/main/models/FlowResource.ts.html +106 -0
  58. package/coverage/lcov-report/src/main/models/FlowType.ts.html +244 -0
  59. package/coverage/lcov-report/src/main/models/FlowVariable.ts.html +553 -0
  60. package/coverage/lcov-report/src/main/models/LoopRuleCommon.ts.html +235 -0
  61. package/coverage/lcov-report/src/main/models/ParsedFlow.ts.html +121 -0
  62. package/coverage/lcov-report/src/main/models/RuleCommon.ts.html +442 -0
  63. package/coverage/lcov-report/src/main/models/RuleResult.ts.html +172 -0
  64. package/coverage/lcov-report/src/main/models/ScanResult.ts.html +121 -0
  65. package/coverage/lcov-report/src/main/models/Violation.ts.html +316 -0
  66. package/coverage/lcov-report/src/main/models/index.html +341 -0
  67. package/coverage/lcov-report/src/main/rules/APIVersion.ts.html +361 -0
  68. package/coverage/lcov-report/src/main/rules/ActionCallsInLoop.ts.html +157 -0
  69. package/coverage/lcov-report/src/main/rules/AutoLayout.ts.html +220 -0
  70. package/coverage/lcov-report/src/main/rules/CopyAPIName.ts.html +175 -0
  71. package/coverage/lcov-report/src/main/rules/CyclomaticComplexity.ts.html +292 -0
  72. package/coverage/lcov-report/src/main/rules/DMLStatementInLoop.ts.html +163 -0
  73. package/coverage/lcov-report/src/main/rules/DuplicateDMLOperation.ts.html +334 -0
  74. package/coverage/lcov-report/src/main/rules/FlowDescription.ts.html +184 -0
  75. package/coverage/lcov-report/src/main/rules/FlowName.ts.html +229 -0
  76. package/coverage/lcov-report/src/main/rules/GetRecordAllFields.ts.html +280 -0
  77. package/coverage/lcov-report/src/main/rules/HardcodedId.ts.html +238 -0
  78. package/coverage/lcov-report/src/main/rules/HardcodedSecret.ts.html +238 -0
  79. package/coverage/lcov-report/src/main/rules/HardcodedUrl.ts.html +247 -0
  80. package/coverage/lcov-report/src/main/rules/InactiveFlow.ts.html +184 -0
  81. package/coverage/lcov-report/src/main/rules/MissingFaultPath.ts.html +397 -0
  82. package/coverage/lcov-report/src/main/rules/MissingFilterRecordTrigger.ts.html +229 -0
  83. package/coverage/lcov-report/src/main/rules/MissingMetadataDescription.ts.html +211 -0
  84. package/coverage/lcov-report/src/main/rules/MissingNullHandler.ts.html +460 -0
  85. package/coverage/lcov-report/src/main/rules/MissingRecordTriggerFilter.ts.html +235 -0
  86. package/coverage/lcov-report/src/main/rules/ProcessBuilder.ts.html +190 -0
  87. package/coverage/lcov-report/src/main/rules/RecordIdAsString.ts.html +274 -0
  88. package/coverage/lcov-report/src/main/rules/RecursiveAfterUpdate.ts.html +364 -0
  89. package/coverage/lcov-report/src/main/rules/SOQLQueryInLoop.ts.html +160 -0
  90. package/coverage/lcov-report/src/main/rules/SameRecordFieldUpdates.ts.html +283 -0
  91. package/coverage/lcov-report/src/main/rules/TransformInsteadOfLoop.ts.html +250 -0
  92. package/coverage/lcov-report/src/main/rules/TriggerOrder.ts.html +238 -0
  93. package/coverage/lcov-report/src/main/rules/UnconnectedElement.ts.html +178 -0
  94. package/coverage/lcov-report/src/main/rules/UnsafeRunningContext.ts.html +226 -0
  95. package/coverage/lcov-report/src/main/rules/UnusedVariable.ts.html +283 -0
  96. package/coverage/lcov-report/src/main/rules/index.html +521 -0
  97. package/coverage/lcov-report/src/main/store/DefaultRuleStore.ts.html +265 -0
  98. package/coverage/lcov-report/src/main/store/RuleRegistry.ts.html +118 -0
  99. package/coverage/lcov-report/src/main/store/index.html +116 -0
  100. package/coverage/lcov.info +6261 -0
  101. package/eslint.config.mjs +36 -0
  102. package/jest.config.cjs +32 -0
  103. package/jest.env-setup.js +101 -0
  104. package/lint-staged.config.mjs +8 -0
  105. package/out/main/config/RegexAdapter.d.ts +32 -0
  106. package/out/main/config/RegexAdapter.js +86 -0
  107. package/{main → out/main}/config/RuleRegistry.js +2 -0
  108. package/out/main/rules/FlowName.d.ts +15 -0
  109. package/{main → out/main}/rules/FlowName.js +24 -11
  110. package/out/main/rules/HardcodedId.d.ts +13 -0
  111. package/{main → out/main}/rules/HardcodedId.js +23 -4
  112. package/out/main/rules/HardcodedSecret.d.ts +13 -0
  113. package/out/main/rules/HardcodedSecret.js +101 -0
  114. package/{main → out/main}/rules/HardcodedUrl.d.ts +6 -0
  115. package/{main → out/main}/rules/HardcodedUrl.js +23 -5
  116. package/package.json +58 -8
  117. package/prettier.config.mjs +5 -0
  118. package/src/index.ts +52 -0
  119. package/src/main/config/NodeIcons.ts +98 -0
  120. package/src/main/config/RegexAdapter.ts +98 -0
  121. package/src/main/config/RuleRegistry.ts +188 -0
  122. package/src/main/config/VariableIcons.ts +57 -0
  123. package/src/main/enums/MetadataTypes.ts +6 -0
  124. package/src/main/interfaces/IExceptions.ts +6 -0
  125. package/src/main/interfaces/IRuleConfig.ts +6 -0
  126. package/src/main/interfaces/IRuleDefinition.ts +15 -0
  127. package/src/main/interfaces/IRuleOptions.ts +5 -0
  128. package/src/main/interfaces/IRulesConfig.ts +17 -0
  129. package/src/main/internals/internals.ts +35 -0
  130. package/src/main/libs/BuildFlow.ts +14 -0
  131. package/src/main/libs/Compiler.ts +53 -0
  132. package/src/main/libs/ExportDetails.ts +58 -0
  133. package/src/main/libs/ExportDiagram.ts +83 -0
  134. package/src/main/libs/ExportSarif.ts +92 -0
  135. package/src/main/libs/FixFlows.ts +61 -0
  136. package/src/main/libs/GetRuleDefinitions.ts +64 -0
  137. package/src/main/libs/ParseFlows.ts +34 -0
  138. package/src/main/libs/RuleDocumentation.ts +35 -0
  139. package/src/main/libs/ScanFlows.ts +142 -0
  140. package/src/main/models/FlatViolation.ts +16 -0
  141. package/src/main/models/Flow.ts +325 -0
  142. package/src/main/models/FlowAttribute.ts +11 -0
  143. package/src/main/models/FlowElement.ts +16 -0
  144. package/src/main/models/FlowElementConnector.ts +28 -0
  145. package/src/main/models/FlowGraph.ts +530 -0
  146. package/src/main/models/FlowMetadata.ts +8 -0
  147. package/src/main/models/FlowNode.ts +390 -0
  148. package/src/main/models/FlowResource.ts +8 -0
  149. package/src/main/models/FlowType.ts +53 -0
  150. package/src/main/models/FlowVariable.ts +157 -0
  151. package/src/main/models/LoopRuleCommon.ts +51 -0
  152. package/src/main/models/ParsedFlow.ts +13 -0
  153. package/src/main/models/RuleCommon.ts +120 -0
  154. package/src/main/models/RuleInfo.ts +54 -0
  155. package/src/main/models/RuleResult.ts +29 -0
  156. package/src/main/models/ScanResult.ts +12 -0
  157. package/src/main/models/Violation.ts +78 -0
  158. package/src/main/rules/APIVersion.ts +93 -0
  159. package/src/main/rules/ActionCallsInLoop.ts +25 -0
  160. package/src/main/rules/AutoLayout.ts +46 -0
  161. package/src/main/rules/CopyAPIName.ts +31 -0
  162. package/src/main/rules/CyclomaticComplexity.ts +70 -0
  163. package/src/main/rules/DMLStatementInLoop.ts +26 -0
  164. package/src/main/rules/DuplicateDMLOperation.ts +83 -0
  165. package/src/main/rules/FlowDescription.ts +34 -0
  166. package/src/main/rules/FlowName.ts +49 -0
  167. package/src/main/rules/GetRecordAllFields.ts +65 -0
  168. package/src/main/rules/HardcodedId.ts +51 -0
  169. package/src/main/rules/HardcodedSecret.ts +51 -0
  170. package/src/main/rules/HardcodedUrl.ts +54 -0
  171. package/src/main/rules/InactiveFlow.ts +33 -0
  172. package/src/main/rules/MissingFaultPath.ts +105 -0
  173. package/src/main/rules/MissingMetadataDescription.ts +42 -0
  174. package/src/main/rules/MissingNullHandler.ts +126 -0
  175. package/src/main/rules/MissingRecordTriggerFilter.ts +51 -0
  176. package/src/main/rules/ProcessBuilder.ts +35 -0
  177. package/src/main/rules/RecordIdAsString.ts +64 -0
  178. package/src/main/rules/RecursiveAfterUpdate.ts +94 -0
  179. package/src/main/rules/SOQLQueryInLoop.ts +26 -0
  180. package/src/main/rules/SameRecordFieldUpdates.ts +66 -0
  181. package/src/main/rules/TransformInsteadOfLoop.ts +56 -0
  182. package/src/main/rules/TriggerOrder.ts +51 -0
  183. package/src/main/rules/UnconnectedElement.ts +32 -0
  184. package/src/main/rules/UnsafeRunningContext.ts +47 -0
  185. package/src/main/rules/UnusedVariable.ts +66 -0
  186. package/stryker.config.mjs +23 -0
  187. package/tests/APIVersion.test.ts +87 -0
  188. package/tests/AutoLayout.test.ts +41 -0
  189. package/tests/Config.test.ts +122 -0
  190. package/tests/ConfigBetaMode.test.ts +26 -0
  191. package/tests/CopyAPIName.test.ts +45 -0
  192. package/tests/CyclomaticComplexity.test.ts +125 -0
  193. package/tests/DMLStatementInLoop.test.ts +32 -0
  194. package/tests/DuplicateDMLOperation.test.ts +43 -0
  195. package/tests/EnabledFalse.test.ts +63 -0
  196. package/tests/Exceptions.test.ts +815 -0
  197. package/tests/ExportSarif.test.ts +62 -0
  198. package/tests/FlowDescription.test.ts +44 -0
  199. package/tests/FlowDocumentation.test.ts +74 -0
  200. package/tests/FlowName.test.ts +61 -0
  201. package/tests/GetRecordElementAllFields.test.ts +182 -0
  202. package/tests/HardcodedId.test.ts +16 -0
  203. package/tests/HardcodedSecret.test.ts +32 -0
  204. package/tests/HardcodedUrl.test.ts +253 -0
  205. package/tests/InactiveFlow.test.ts +103 -0
  206. package/tests/MissingFaultPath.test.ts +52 -0
  207. package/tests/MissingMetadataDescription.test.ts +25 -0
  208. package/tests/MissingNullHandler.test.ts +45 -0
  209. package/tests/MissingRecordTriggerFilter.test.ts +54 -0
  210. package/tests/RecordIdAsString.test.ts +60 -0
  211. package/tests/RecursiveAfterUpdate.test.ts +183 -0
  212. package/tests/SOQLQueryInLoop.test.ts +33 -0
  213. package/tests/SameRecordFieldUpdates.test.ts +205 -0
  214. package/tests/SanityTest.test.ts +15 -0
  215. package/tests/TransformInsteadOfLoop.test.ts +33 -0
  216. package/tests/TriggerOrder.test.ts +112 -0
  217. package/tests/UnconnectedElement.test.ts +76 -0
  218. package/tests/UnsafeRunningContext.test.ts +46 -0
  219. package/tests/UnusedVariable.test.ts +59 -0
  220. package/tests/UnusedVariableExceptions.test.ts +87 -0
  221. package/tests/jsonfiles/MissingFaultPath_BeforeSave_Bypass.json +128 -0
  222. package/tests/jsonfiles/MissingFaultPath_WaitConditions.json +102 -0
  223. package/tests/jsonfiles/MissingFaultPath_WaitDate.json +88 -0
  224. package/tests/jsonfiles/MissingFaultPath_WaitDuration.json +90 -0
  225. package/tests/models/Flow.test.ts +107 -0
  226. package/tests/models/LoopRuleCommon.test.ts +246 -0
  227. package/tests/models/RuleCommon.test.ts +41 -0
  228. package/tsconfig.json +28 -0
  229. package/tsconfig.types.json +26 -0
  230. package/types/index.d.ts +27 -0
  231. package/types/index.d.ts.map +1 -0
  232. package/types/main/adapters/RegexAdapter.d.ts +33 -0
  233. package/types/main/adapters/RegexAdapter.d.ts.map +1 -0
  234. package/types/main/config/NodeIcons.d.ts +25 -0
  235. package/types/main/config/NodeIcons.d.ts.map +1 -0
  236. package/types/main/config/RegexAdapter.d.ts +33 -0
  237. package/types/main/config/RegexAdapter.d.ts.map +1 -0
  238. package/types/main/config/RuleRegistry.d.ts +23 -0
  239. package/types/main/config/RuleRegistry.d.ts.map +1 -0
  240. package/types/main/config/VariableIcons.d.ts +26 -0
  241. package/types/main/config/VariableIcons.d.ts.map +1 -0
  242. package/types/main/enums/MetadataTypes.d.ts +7 -0
  243. package/types/main/enums/MetadataTypes.d.ts.map +1 -0
  244. package/types/main/interfaces/IExceptions.d.ts +6 -0
  245. package/types/main/interfaces/IExceptions.d.ts.map +1 -0
  246. package/types/main/interfaces/IRuleConfig.d.ts +7 -0
  247. package/types/main/interfaces/IRuleConfig.d.ts.map +1 -0
  248. package/types/main/interfaces/IRuleDefinition.d.ts +18 -0
  249. package/types/main/interfaces/IRuleDefinition.d.ts.map +1 -0
  250. package/types/main/interfaces/IRuleOptions.d.ts +5 -0
  251. package/types/main/interfaces/IRuleOptions.d.ts.map +1 -0
  252. package/types/main/interfaces/IRulesConfig.d.ts +16 -0
  253. package/types/main/interfaces/IRulesConfig.d.ts.map +1 -0
  254. package/types/main/internals/internals.d.ts +19 -0
  255. package/types/main/internals/internals.d.ts.map +1 -0
  256. package/types/main/libs/BuildFlow.d.ts +2 -0
  257. package/types/main/libs/BuildFlow.d.ts.map +1 -0
  258. package/types/main/libs/Compiler.d.ts +8 -0
  259. package/types/main/libs/Compiler.d.ts.map +1 -0
  260. package/types/main/libs/ConvertFlowNodes.d.ts +2 -0
  261. package/types/main/libs/ConvertFlowNodes.d.ts.map +1 -0
  262. package/types/main/libs/DynamicRule.d.ts +5 -0
  263. package/types/main/libs/DynamicRule.d.ts.map +1 -0
  264. package/types/main/libs/ExportDetails.d.ts +4 -0
  265. package/types/main/libs/ExportDetails.d.ts.map +1 -0
  266. package/types/main/libs/ExportDiagram.d.ts +42 -0
  267. package/types/main/libs/ExportDiagram.d.ts.map +1 -0
  268. package/types/main/libs/ExportSarif.d.ts +3 -0
  269. package/types/main/libs/ExportSarif.d.ts.map +1 -0
  270. package/types/main/libs/FixFlows.d.ts +4 -0
  271. package/types/main/libs/FixFlows.d.ts.map +1 -0
  272. package/types/main/libs/GetRuleDefinitions.d.ts +5 -0
  273. package/types/main/libs/GetRuleDefinitions.d.ts.map +1 -0
  274. package/types/main/libs/ParseFlows.d.ts +3 -0
  275. package/types/main/libs/ParseFlows.d.ts.map +1 -0
  276. package/types/main/libs/RuleDocumentation.d.ts +21 -0
  277. package/types/main/libs/RuleDocumentation.d.ts.map +1 -0
  278. package/types/main/libs/ScanFlows.d.ts +5 -0
  279. package/types/main/libs/ScanFlows.d.ts.map +1 -0
  280. package/types/main/libs/exportAsDetails.d.ts +4 -0
  281. package/types/main/libs/exportAsDetails.d.ts.map +1 -0
  282. package/types/main/libs/exportAsSarif.d.ts +3 -0
  283. package/types/main/libs/exportAsSarif.d.ts.map +1 -0
  284. package/types/main/models/FlatViolation.d.ts +16 -0
  285. package/types/main/models/FlatViolation.d.ts.map +1 -0
  286. package/types/main/models/Flow.d.ts +70 -0
  287. package/types/main/models/Flow.d.ts.map +1 -0
  288. package/types/main/models/FlowAttribute.d.ts +6 -0
  289. package/types/main/models/FlowAttribute.d.ts.map +1 -0
  290. package/types/main/models/FlowElement.d.ts +11 -0
  291. package/types/main/models/FlowElement.d.ts.map +1 -0
  292. package/types/main/models/FlowElementConnector.d.ts +16 -0
  293. package/types/main/models/FlowElementConnector.d.ts.map +1 -0
  294. package/types/main/models/FlowGraph.d.ts +86 -0
  295. package/types/main/models/FlowGraph.d.ts.map +1 -0
  296. package/types/main/models/FlowMetadata.d.ts +5 -0
  297. package/types/main/models/FlowMetadata.d.ts.map +1 -0
  298. package/types/main/models/FlowNode.d.ts +66 -0
  299. package/types/main/models/FlowNode.d.ts.map +1 -0
  300. package/types/main/models/FlowResource.d.ts +5 -0
  301. package/types/main/models/FlowResource.d.ts.map +1 -0
  302. package/types/main/models/FlowType.d.ts +24 -0
  303. package/types/main/models/FlowType.d.ts.map +1 -0
  304. package/types/main/models/FlowVariable.d.ts +64 -0
  305. package/types/main/models/FlowVariable.d.ts.map +1 -0
  306. package/types/main/models/LoopRuleCommon.d.ts +15 -0
  307. package/types/main/models/LoopRuleCommon.d.ts.map +1 -0
  308. package/types/main/models/ParsedFlow.d.ts +8 -0
  309. package/types/main/models/ParsedFlow.d.ts.map +1 -0
  310. package/types/main/models/RuleCommon.d.ts +58 -0
  311. package/types/main/models/RuleCommon.d.ts.map +1 -0
  312. package/types/main/models/RuleInfo.d.ts +50 -0
  313. package/types/main/models/RuleInfo.d.ts.map +1 -0
  314. package/types/main/models/RuleResult.d.ts +15 -0
  315. package/types/main/models/RuleResult.d.ts.map +1 -0
  316. package/types/main/models/ScanResult.d.ts +8 -0
  317. package/types/main/models/ScanResult.d.ts.map +1 -0
  318. package/types/main/models/Violation.d.ts +12 -0
  319. package/types/main/models/Violation.d.ts.map +1 -0
  320. package/{main/rules/FlowName.d.ts → types/main/rules/APIVersion.d.ts} +2 -1
  321. package/types/main/rules/APIVersion.d.ts.map +1 -0
  322. package/types/main/rules/ActionCallsInLoop.d.ts +7 -0
  323. package/types/main/rules/ActionCallsInLoop.d.ts.map +1 -0
  324. package/types/main/rules/AutoLayout.d.ts +8 -0
  325. package/types/main/rules/AutoLayout.d.ts.map +1 -0
  326. package/types/main/rules/CopyAPIName.d.ts +8 -0
  327. package/types/main/rules/CopyAPIName.d.ts.map +1 -0
  328. package/types/main/rules/CyclomaticComplexity.d.ts +12 -0
  329. package/types/main/rules/CyclomaticComplexity.d.ts.map +1 -0
  330. package/types/main/rules/DMLStatementInLoop.d.ts +7 -0
  331. package/types/main/rules/DMLStatementInLoop.d.ts.map +1 -0
  332. package/types/main/rules/DuplicateDMLOperation.d.ts +9 -0
  333. package/types/main/rules/DuplicateDMLOperation.d.ts.map +1 -0
  334. package/{main/rules/HardcodedId.d.ts → types/main/rules/FlowDescription.d.ts} +2 -1
  335. package/types/main/rules/FlowDescription.d.ts.map +1 -0
  336. package/types/main/rules/FlowName.d.ts +16 -0
  337. package/types/main/rules/FlowName.d.ts.map +1 -0
  338. package/types/main/rules/GetRecordAllFields.d.ts +8 -0
  339. package/types/main/rules/GetRecordAllFields.d.ts.map +1 -0
  340. package/types/main/rules/HardcodedId.d.ts +14 -0
  341. package/types/main/rules/HardcodedId.d.ts.map +1 -0
  342. package/types/main/rules/HardcodedSecret.d.ts +14 -0
  343. package/types/main/rules/HardcodedSecret.d.ts.map +1 -0
  344. package/types/main/rules/HardcodedUrl.d.ts +14 -0
  345. package/types/main/rules/HardcodedUrl.d.ts.map +1 -0
  346. package/types/main/rules/InactiveFlow.d.ts +8 -0
  347. package/types/main/rules/InactiveFlow.d.ts.map +1 -0
  348. package/types/main/rules/MissingFaultPath.d.ts +15 -0
  349. package/types/main/rules/MissingFaultPath.d.ts.map +1 -0
  350. package/types/main/rules/MissingFilterRecordTrigger.d.ts +8 -0
  351. package/types/main/rules/MissingFilterRecordTrigger.d.ts.map +1 -0
  352. package/types/main/rules/MissingMetadataDescription.d.ts +8 -0
  353. package/types/main/rules/MissingMetadataDescription.d.ts.map +1 -0
  354. package/types/main/rules/MissingNullHandler.d.ts +8 -0
  355. package/types/main/rules/MissingNullHandler.d.ts.map +1 -0
  356. package/types/main/rules/MissingRecordTriggerFilter.d.ts +8 -0
  357. package/types/main/rules/MissingRecordTriggerFilter.d.ts.map +1 -0
  358. package/types/main/rules/ProcessBuilder.d.ts +8 -0
  359. package/types/main/rules/ProcessBuilder.d.ts.map +1 -0
  360. package/types/main/rules/RecordIdAsString.d.ts +8 -0
  361. package/types/main/rules/RecordIdAsString.d.ts.map +1 -0
  362. package/types/main/rules/RecursiveAfterUpdate.d.ts +9 -0
  363. package/types/main/rules/RecursiveAfterUpdate.d.ts.map +1 -0
  364. package/types/main/rules/SOQLQueryInLoop.d.ts +7 -0
  365. package/types/main/rules/SOQLQueryInLoop.d.ts.map +1 -0
  366. package/types/main/rules/SameRecordFieldUpdates.d.ts +9 -0
  367. package/types/main/rules/SameRecordFieldUpdates.d.ts.map +1 -0
  368. package/types/main/rules/TransformInsteadOfLoop.d.ts +8 -0
  369. package/types/main/rules/TransformInsteadOfLoop.d.ts.map +1 -0
  370. package/types/main/rules/TriggerOrder.d.ts +8 -0
  371. package/types/main/rules/TriggerOrder.d.ts.map +1 -0
  372. package/types/main/rules/UnconnectedElement.d.ts +8 -0
  373. package/types/main/rules/UnconnectedElement.d.ts.map +1 -0
  374. package/types/main/rules/UnsafeRunningContext.d.ts +8 -0
  375. package/types/main/rules/UnsafeRunningContext.d.ts.map +1 -0
  376. package/types/main/rules/UnusedVariable.d.ts +8 -0
  377. package/types/main/rules/UnusedVariable.d.ts.map +1 -0
  378. package/types/main/store/DefaultRuleStore.d.ts +3 -0
  379. package/types/main/store/DefaultRuleStore.d.ts.map +1 -0
  380. package/types/main/store/RuleRegistry.d.ts +23 -0
  381. package/types/main/store/RuleRegistry.d.ts.map +1 -0
  382. package/vite.config.ts +33 -0
  383. package/README.md +0 -635
  384. /package/{index.d.ts → out/index.d.ts} +0 -0
  385. /package/{index.js → out/index.js} +0 -0
  386. /package/{main → out/main}/config/NodeIcons.d.ts +0 -0
  387. /package/{main → out/main}/config/NodeIcons.js +0 -0
  388. /package/{main → out/main}/config/RuleRegistry.d.ts +0 -0
  389. /package/{main → out/main}/config/VariableIcons.d.ts +0 -0
  390. /package/{main → out/main}/config/VariableIcons.js +0 -0
  391. /package/{main → out/main}/enums/MetadataTypes.d.ts +0 -0
  392. /package/{main → out/main}/enums/MetadataTypes.js +0 -0
  393. /package/{main → out/main}/interfaces/IExceptions.d.ts +0 -0
  394. /package/{main → out/main}/interfaces/IExceptions.js +0 -0
  395. /package/{main → out/main}/interfaces/IRuleConfig.d.ts +0 -0
  396. /package/{main → out/main}/interfaces/IRuleConfig.js +0 -0
  397. /package/{main → out/main}/interfaces/IRuleDefinition.d.ts +0 -0
  398. /package/{main → out/main}/interfaces/IRuleDefinition.js +0 -0
  399. /package/{main → out/main}/interfaces/IRuleOptions.d.ts +0 -0
  400. /package/{main → out/main}/interfaces/IRuleOptions.js +0 -0
  401. /package/{main → out/main}/interfaces/IRulesConfig.d.ts +0 -0
  402. /package/{main → out/main}/interfaces/IRulesConfig.js +0 -0
  403. /package/{main → out/main}/internals/internals.d.ts +0 -0
  404. /package/{main → out/main}/internals/internals.js +0 -0
  405. /package/{main → out/main}/libs/BuildFlow.d.ts +0 -0
  406. /package/{main → out/main}/libs/BuildFlow.js +0 -0
  407. /package/{main → out/main}/libs/Compiler.d.ts +0 -0
  408. /package/{main → out/main}/libs/Compiler.js +0 -0
  409. /package/{main → out/main}/libs/ExportDetails.d.ts +0 -0
  410. /package/{main → out/main}/libs/ExportDetails.js +0 -0
  411. /package/{main → out/main}/libs/ExportDiagram.d.ts +0 -0
  412. /package/{main → out/main}/libs/ExportDiagram.js +0 -0
  413. /package/{main → out/main}/libs/ExportSarif.d.ts +0 -0
  414. /package/{main → out/main}/libs/ExportSarif.js +0 -0
  415. /package/{main → out/main}/libs/FixFlows.d.ts +0 -0
  416. /package/{main → out/main}/libs/FixFlows.js +0 -0
  417. /package/{main → out/main}/libs/GetRuleDefinitions.d.ts +0 -0
  418. /package/{main → out/main}/libs/GetRuleDefinitions.js +0 -0
  419. /package/{main → out/main}/libs/ParseFlows.d.ts +0 -0
  420. /package/{main → out/main}/libs/ParseFlows.js +0 -0
  421. /package/{main → out/main}/libs/RuleDocumentation.d.ts +0 -0
  422. /package/{main → out/main}/libs/RuleDocumentation.js +0 -0
  423. /package/{main → out/main}/libs/ScanFlows.d.ts +0 -0
  424. /package/{main → out/main}/libs/ScanFlows.js +0 -0
  425. /package/{main → out/main}/models/FlatViolation.d.ts +0 -0
  426. /package/{main → out/main}/models/FlatViolation.js +0 -0
  427. /package/{main → out/main}/models/Flow.d.ts +0 -0
  428. /package/{main → out/main}/models/Flow.js +0 -0
  429. /package/{main → out/main}/models/FlowAttribute.d.ts +0 -0
  430. /package/{main → out/main}/models/FlowAttribute.js +0 -0
  431. /package/{main → out/main}/models/FlowElement.d.ts +0 -0
  432. /package/{main → out/main}/models/FlowElement.js +0 -0
  433. /package/{main → out/main}/models/FlowElementConnector.d.ts +0 -0
  434. /package/{main → out/main}/models/FlowElementConnector.js +0 -0
  435. /package/{main → out/main}/models/FlowGraph.d.ts +0 -0
  436. /package/{main → out/main}/models/FlowGraph.js +0 -0
  437. /package/{main → out/main}/models/FlowMetadata.d.ts +0 -0
  438. /package/{main → out/main}/models/FlowMetadata.js +0 -0
  439. /package/{main → out/main}/models/FlowNode.d.ts +0 -0
  440. /package/{main → out/main}/models/FlowNode.js +0 -0
  441. /package/{main → out/main}/models/FlowResource.d.ts +0 -0
  442. /package/{main → out/main}/models/FlowResource.js +0 -0
  443. /package/{main → out/main}/models/FlowType.d.ts +0 -0
  444. /package/{main → out/main}/models/FlowType.js +0 -0
  445. /package/{main → out/main}/models/FlowVariable.d.ts +0 -0
  446. /package/{main → out/main}/models/FlowVariable.js +0 -0
  447. /package/{main → out/main}/models/LoopRuleCommon.d.ts +0 -0
  448. /package/{main → out/main}/models/LoopRuleCommon.js +0 -0
  449. /package/{main → out/main}/models/ParsedFlow.d.ts +0 -0
  450. /package/{main → out/main}/models/ParsedFlow.js +0 -0
  451. /package/{main → out/main}/models/RuleCommon.d.ts +0 -0
  452. /package/{main → out/main}/models/RuleCommon.js +0 -0
  453. /package/{main → out/main}/models/RuleInfo.d.ts +0 -0
  454. /package/{main → out/main}/models/RuleInfo.js +0 -0
  455. /package/{main → out/main}/models/RuleResult.d.ts +0 -0
  456. /package/{main → out/main}/models/RuleResult.js +0 -0
  457. /package/{main → out/main}/models/ScanResult.d.ts +0 -0
  458. /package/{main → out/main}/models/ScanResult.js +0 -0
  459. /package/{main → out/main}/models/Violation.d.ts +0 -0
  460. /package/{main → out/main}/models/Violation.js +0 -0
  461. /package/{main → out/main}/rules/APIVersion.d.ts +0 -0
  462. /package/{main → out/main}/rules/APIVersion.js +0 -0
  463. /package/{main → out/main}/rules/ActionCallsInLoop.d.ts +0 -0
  464. /package/{main → out/main}/rules/ActionCallsInLoop.js +0 -0
  465. /package/{main → out/main}/rules/AutoLayout.d.ts +0 -0
  466. /package/{main → out/main}/rules/AutoLayout.js +0 -0
  467. /package/{main → out/main}/rules/CopyAPIName.d.ts +0 -0
  468. /package/{main → out/main}/rules/CopyAPIName.js +0 -0
  469. /package/{main → out/main}/rules/CyclomaticComplexity.d.ts +0 -0
  470. /package/{main → out/main}/rules/CyclomaticComplexity.js +0 -0
  471. /package/{main → out/main}/rules/DMLStatementInLoop.d.ts +0 -0
  472. /package/{main → out/main}/rules/DMLStatementInLoop.js +0 -0
  473. /package/{main → out/main}/rules/DuplicateDMLOperation.d.ts +0 -0
  474. /package/{main → out/main}/rules/DuplicateDMLOperation.js +0 -0
  475. /package/{main → out/main}/rules/FlowDescription.d.ts +0 -0
  476. /package/{main → out/main}/rules/FlowDescription.js +0 -0
  477. /package/{main → out/main}/rules/GetRecordAllFields.d.ts +0 -0
  478. /package/{main → out/main}/rules/GetRecordAllFields.js +0 -0
  479. /package/{main → out/main}/rules/InactiveFlow.d.ts +0 -0
  480. /package/{main → out/main}/rules/InactiveFlow.js +0 -0
  481. /package/{main → out/main}/rules/MissingFaultPath.d.ts +0 -0
  482. /package/{main → out/main}/rules/MissingFaultPath.js +0 -0
  483. /package/{main → out/main}/rules/MissingMetadataDescription.d.ts +0 -0
  484. /package/{main → out/main}/rules/MissingMetadataDescription.js +0 -0
  485. /package/{main → out/main}/rules/MissingNullHandler.d.ts +0 -0
  486. /package/{main → out/main}/rules/MissingNullHandler.js +0 -0
  487. /package/{main → out/main}/rules/MissingRecordTriggerFilter.d.ts +0 -0
  488. /package/{main → out/main}/rules/MissingRecordTriggerFilter.js +0 -0
  489. /package/{main → out/main}/rules/ProcessBuilder.d.ts +0 -0
  490. /package/{main → out/main}/rules/ProcessBuilder.js +0 -0
  491. /package/{main → out/main}/rules/RecordIdAsString.d.ts +0 -0
  492. /package/{main → out/main}/rules/RecordIdAsString.js +0 -0
  493. /package/{main → out/main}/rules/RecursiveAfterUpdate.d.ts +0 -0
  494. /package/{main → out/main}/rules/RecursiveAfterUpdate.js +0 -0
  495. /package/{main → out/main}/rules/SOQLQueryInLoop.d.ts +0 -0
  496. /package/{main → out/main}/rules/SOQLQueryInLoop.js +0 -0
  497. /package/{main → out/main}/rules/SameRecordFieldUpdates.d.ts +0 -0
  498. /package/{main → out/main}/rules/SameRecordFieldUpdates.js +0 -0
  499. /package/{main → out/main}/rules/TransformInsteadOfLoop.d.ts +0 -0
  500. /package/{main → out/main}/rules/TransformInsteadOfLoop.js +0 -0
  501. /package/{main → out/main}/rules/TriggerOrder.d.ts +0 -0
  502. /package/{main → out/main}/rules/TriggerOrder.js +0 -0
  503. /package/{main → out/main}/rules/UnconnectedElement.d.ts +0 -0
  504. /package/{main → out/main}/rules/UnconnectedElement.js +0 -0
  505. /package/{main → out/main}/rules/UnsafeRunningContext.d.ts +0 -0
  506. /package/{main → out/main}/rules/UnsafeRunningContext.js +0 -0
  507. /package/{main → out/main}/rules/UnusedVariable.d.ts +0 -0
  508. /package/{main → out/main}/rules/UnusedVariable.js +0 -0
package/README.md DELETED
@@ -1,635 +0,0 @@
1
- <p align="center">
2
- <a href="https://github.com/Flow-Scanner/lightning-flow-scanner/stargazers">
3
- <img src="https://img.shields.io/github/stars/Flow-Scanner/lightning-flow-scanner?label=Stargazers&style=flat-square" alt="GitHub stars">
4
- </a>
5
- <a href="https://www.npmjs.com/package/@flow-scanner/lightning-flow-scanner-core">
6
- <img src="https://img.shields.io/npm/v/@flow-scanner/lightning-flow-scanner-core?label=Core&style=flat-square" alt="Core version">
7
- </a>
8
- <a href="https://www.npmjs.com/package/lightning-flow-scanner">
9
- <img src="https://img.shields.io/npm/v/lightning-flow-scanner?label=CLI&style=flat-square" alt="CLI version">
10
- </a>
11
- <a href="https://open-vsx.org/extension/ForceConfigControl/lightning-flow-scanner-vsx">
12
- <img src="https://img.shields.io/open-vsx/v/ForceConfigControl/lightning-flow-scanner-vsx?label=VS%20Code&style=flat-square" alt="VS Code version">
13
- </a>
14
- <a href="https://www.npmjs.com/package/lightning-flow-scanner-core">
15
- <img src="https://img.shields.io/npm/dt/lightning-flow-scanner-core?label=Downloads%3Cv6&style=flat-square" alt="Downloads <v6">
16
- </a>
17
- <a href="https://www.npmjs.com/package/@flow-scanner/lightning-flow-scanner-core">
18
- <img src="https://img.shields.io/npm/dt/@flow-scanner/lightning-flow-scanner-core?label=Downloads%3Ev6&style=flat-square" alt="Downloads >v6">
19
- </a>
20
- </p>
21
-
22
- <p align="center">
23
- <a href="https://github.com/Flow-Scanner">
24
- <img src="https://raw.githubusercontent.com/Flow-Scanner/Lightning-Flow-Scanner/main/docs/media/banner.png" alt="Lightning Flow Scanner" width="43%" />
25
- </a>
26
- </p>
27
-
28
- <p align="center"><i>Detect unsafe contexts, queries in loops, hardcoded IDs, and more to optimize Salesforce Flows</i></p>
29
-
30
- ---
31
-
32
- ## Table of contents
33
-
34
- - **[Default Rules](#default-rules)**
35
- - [Problems](#problems)
36
- - [Suggestions](#suggestions)
37
- - [Layout](#layout)
38
- - **[Configuration](#configuration)**
39
- - [Configure Rules](#configure-rules)
40
- - [Define Exceptions](#define-exceptions)
41
- - [Exclude Flows](#exclude-flows)
42
- - [Scan Modes](#scan-modes)
43
- - **[Installation](#installation)**
44
- - [Distributions](#distributions)
45
- - [CICD Templates](#cicd-templates)
46
- - **[Quick Start](#quick-start)**
47
- - **[Development](#development)**
48
-
49
- ---
50
-
51
- ## Default Rules
52
-
53
- <p>📌<strong>Tip:</strong> To link directly to a specific rule, use the full GitHub anchor link format. Example:</p>
54
- <p><em><a href="https://flow-scanner.github.io/lightning-flow-scanner/#unsafe-running-context">https://flow-scanner.github.io/lightning-flow-scanner/#unsafe-running-context</a></em></p>
55
-
56
- > Want to help improve this project? See our [Contributing Guidelines](https://github.com/Flow-Scanner/lightning-flow-scanner?tab=contributing-ov-file)
57
-
58
- <!-- START GENERATED_RULES -->
59
-
60
- ---
61
-
62
- ### Problems
63
-
64
- These rules detect anti-patterns and unsafe practices in your Flows that could break functionality, compromise security, or cause deployment failures.
65
-
66
- #### DML Statement In A Loop
67
- Executing DML operations (insert, update, delete) inside a loop is a high-risk anti-pattern that frequently causes governor limit exceptions. All database operations should be collected and executed once, outside the loop.
68
-
69
- **Rule ID:** `dml-in-loop`
70
- **Class Name:** _[DMLStatementInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DMLStatementInLoop.ts)_
71
- **Severity:** 🔴 *Error*
72
-
73
- #### Hardcoded Id
74
- Avoid hard-coding record IDs, as they are unique to a specific org and will not work in other environments. Instead, store IDs in variables—such as merge-field URL parameters or a **Get Records** element—to make the Flow portable, maintainable, and flexible.
75
-
76
- **Rule ID:** `hardcoded-id`
77
- **Class Name:** _[HardcodedId](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedId.ts)_
78
- **Severity:** 🔴 *Error*
79
-
80
- #### Hardcoded Url
81
- Avoid hard-coding URLs, as they may change between environments or over time. Instead, store URLs in variables or custom settings to make the Flow adaptable, maintainable, and environment-independent.
82
-
83
- **Rule ID:** `hardcoded-url`
84
- **Class Name:** _[HardcodedUrl](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/HardcodedUrl.ts)_
85
- **Severity:** 🔴 *Error*
86
-
87
- #### Process Builder
88
- Process Builder is retired. Continuing to use it increases maintenance overhead and risks future compatibility issues. Migrating automation to Flow reduces risk and improves maintainability.
89
-
90
- **Rule ID:** `process-builder-usage`
91
- **Class Name:** _[ProcessBuilder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ProcessBuilder.ts)_
92
- **Severity:** 🔴 *Error*
93
-
94
- #### SOQL Query In A Loop
95
- Running SOQL queries inside a loop can rapidly exceed query limits and severely degrade performance. Queries should be executed once, with results reused throughout the loop.
96
-
97
- **Rule ID:** `soql-in-loop`
98
- **Class Name:** _[SOQLQueryInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SOQLQueryInLoop.ts)_
99
- **Severity:** 🔴 *Error*
100
-
101
- #### Unsafe Running Context
102
- Flows configured to run in System Mode without Sharing grant access to all data, bypassing user permissions. Avoid this setting to prevent security risks and protect sensitive data.
103
-
104
- **Rule ID:** `unsafe-running-context`
105
- **Class Name:** _[UnsafeRunningContext](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnsafeRunningContext.ts)_
106
- **Severity:** 🔴 *Error*
107
-
108
- #### Duplicate DML Operation
109
- When a Flow performs database operations across multiple screens, users navigating backward can cause the same actions to run multiple times. To prevent unintended changes, either restrict backward navigation or redesign the Flow so database operations execute in a single, forward-moving step.
110
-
111
- **Rule ID:** `duplicate-dml`
112
- **Class Name:** _[DuplicateDMLOperation](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/DuplicateDMLOperation.ts)_
113
- **Severity:** 🟡 *Warning*
114
-
115
- #### Missing Fault Path
116
- Elements that can fail should include a Fault Path to handle errors gracefully. Without it, failures show generic errors to users. Fault Paths improve reliability and user experience.
117
-
118
- **Rule ID:** `missing-fault-path`
119
- **Class Name:** _[MissingFaultPath](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFaultPath.ts)_
120
- **Severity:** 🟡 *Warning*
121
-
122
- #### Missing Null Handler
123
- Get Records operations return null when no data is found. Without handling these null values, Flows can fail or produce unintended results. Adding a null check improves reliability and ensures the Flow behaves as expected.
124
-
125
- **Rule ID:** `missing-null-handler`
126
- **Class Name:** _[MissingNullHandler](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingNullHandler.ts)_
127
- **Severity:** 🟡 *Warning*
128
-
129
- #### Recursive After Update
130
- After-save Flows that update the same record can trigger recursion, causing unintended behavior or performance issues. Avoid updating the triggering record in after-save Flows; use before-save Flows instead to prevent recursion.
131
-
132
- **Rule ID:** `recursive-record-update`
133
- **Class Name:** _[RecursiveAfterUpdate](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecursiveAfterUpdate.ts)_
134
- **Severity:** 🟡 *Warning*
135
-
136
- ---
137
-
138
- ### Suggestions
139
-
140
- These rules highlight areas where Flows can be improved. Following them increases reliability and long-term maintainability.
141
-
142
- #### Action Call In A Loop
143
- Repeatedly invoking Apex actions inside a loop can exhaust governor limits and lead to performance issues. Where possible, bulkify your logic by moving the action call outside the loop and passing a collection variable instead.
144
-
145
- **Rule ID:** `action-call-in-loop`
146
- **Class Name:** _[ActionCallsInLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/ActionCallsInLoop.ts)_
147
- **Severity:** 🟡 *Warning*
148
-
149
- #### Get Record All Fields
150
- Avoid using Get Records to retrieve all fields unless necessary. This improves performance, reduces processing time, and limits exposure of unnecessary data.
151
-
152
- **Rule ID:** `get-record-all-fields`
153
- **Class Name:** _[GetRecordAllFields](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/GetRecordAllFields.ts)_
154
- **Severity:** 🟡 *Warning*
155
-
156
- #### Inactive Flow
157
- Inactive Flows should be deleted or archived to reduce risk. Even when inactive, they can cause unintended record changes during testing or be activated as subflows. Keeping only active, relevant Flows improves safety and maintainability.
158
-
159
- **Rule ID:** `inactive-flow`
160
- **Class Name:** _[InactiveFlow](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/InactiveFlow.ts)_
161
- **Severity:** 🟡 *Warning*
162
-
163
- #### Invalid API Version
164
- Flows running on outdated API versions may behave inconsistently when newer platform features or components are used. From API version 50.0 onward, the API Version attribute explicitly controls Flow runtime behavior. Keeping Flows aligned with a supported API version helps prevent compatibility issues and ensures predictable execution.
165
-
166
- **Rule ID:** `invalid-api-version`
167
- **Class Name:** _[APIVersion](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/APIVersion.ts)_
168
- **Severity:** 🟡 *Warning*
169
-
170
- #### Missing Filter Record Trigger ![Beta](https://img.shields.io/badge/status-beta-yellow)
171
- Record-triggered Flows without filters on changed fields or entry conditions execute on every record change. Adding filters ensures the Flow runs only when needed, improving performance.
172
-
173
- **Rule ID:** `missing-record-trigger-filter`
174
- **Class Name:** _[MissingFilterRecordTrigger](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingFilterRecordTrigger.ts)_
175
- **Severity:** 🟡 *Warning*
176
-
177
- #### Same Record Field Updates
178
- Before-save Flows can safely update the triggering record directly via $Record, applying changes efficiently without extra DML operations. Using before-save updates improves performance
179
-
180
- **Rule ID:** `same-record-field-updates`
181
- **Class Name:** _[SameRecordFieldUpdates](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/SameRecordFieldUpdates.ts)_
182
- **Severity:** 🟡 *Warning*
183
-
184
- #### Excessive Cyclomatic Complexity
185
- High numbers of loops and decision elements increase a Flow's cyclomatic complexity. To maintain simplicity and readability, consider using subflows or splitting a Flow into smaller, ordered Flows.
186
-
187
- **Rule ID:** `excessive-cyclomatic-complexity`
188
- **Class Name:** _[CyclomaticComplexity](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CyclomaticComplexity.ts)_
189
- **Severity:** 🔵 *Note*
190
-
191
- #### Missing Trigger Order
192
- Record-triggered Flows without a specified Trigger Order may execute in an unpredictable sequence. Setting a Trigger Order ensures your Flows run in the intended order.
193
-
194
- **Rule ID:** `unspecified-trigger-order`
195
- **Class Name:** _[TriggerOrder](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TriggerOrder.ts)_
196
- **Severity:** 🔵 *Note*
197
-
198
- #### Record ID as String ![Beta](https://img.shields.io/badge/status-beta-yellow)
199
- Flows that use a String variable for a record ID instead of receiving the full record introduce unnecessary complexity and additional Get Records queries. Using the complete record simplifies the Flow and improves performance.
200
-
201
- **Rule ID:** `record-id-as-string`
202
- **Class Name:** _[RecordIdAsString](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/RecordIdAsString.ts)_
203
- **Severity:** 🔵 *Note*
204
-
205
- #### Transform Instead of Loop ![Beta](https://img.shields.io/badge/status-beta-yellow)
206
- Loop elements that perform direct Assignments on each item can slow down Flows. Using Transform elements allows bulk operations on collections, improving performance and reducing complexity.
207
-
208
- **Rule ID:** `transform-instead-of-loop`
209
- **Class Name:** _[TransformInsteadOfLoop](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/TransformInsteadOfLoop.ts)_
210
- **Severity:** 🔵 *Note*
211
-
212
- ---
213
-
214
- ### Layout
215
-
216
- Focused on naming, documentation, and organization, these rules ensure Flows remain clear, easy to understand, and maintainable as automations grow.
217
-
218
- #### Flow Naming Convention
219
- Using clear and consistent Flow names improves readability, discoverability, and maintainability. A good naming convention helps team members quickly understand a Flow's purpose—for example, including a domain and brief description like Service_OrderFulfillment. Adopt a naming pattern that aligns with your organization's standards.
220
-
221
- **Rule ID:** `invalid-naming-convention`
222
- **Class Name:** _[FlowName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowName.ts)_
223
- **Severity:** 🔴 *Error*
224
-
225
- #### Missing Flow Description
226
- Flow descriptions are essential for documentation and maintainability. Include a description for each Flow, explaining its purpose and where it's used.
227
-
228
- **Rule ID:** `missing-flow-description`
229
- **Class Name:** _[FlowDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/FlowDescription.ts)_
230
- **Severity:** 🔴 *Error*
231
-
232
- #### Missing Metadata Description ![Beta](https://img.shields.io/badge/status-beta-yellow)
233
- Elements and metadata without a description reduce clarity and maintainability. Adding descriptions improves readability and makes your automation easier to understand.
234
-
235
- **Rule ID:** `missing-metadata-description`
236
- **Class Name:** _[MissingMetadataDescription](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/MissingMetadataDescription.ts)_
237
- **Severity:** 🟡 *Warning*
238
-
239
- #### Unclear API Name
240
- Elements with unclear or duplicated API names, like Copy_X_Of_Element, reduce Flow readability. Make sure to update the API name when copying elements to keep your Flow organized.
241
-
242
- **Rule ID:** `unclear-api-naming`
243
- **Class Name:** _[CopyAPIName](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/CopyAPIName.ts)_
244
- **Severity:** 🟡 *Warning*
245
-
246
- #### Unreachable Element
247
- Unconnected elements never execute and add unnecessary clutter. Remove or connect unused Flow elements to keep Flows clean and efficient.
248
-
249
- **Rule ID:** `unreachable-element`
250
- **Class Name:** _[UnconnectedElement](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnconnectedElement.ts)_
251
- **Severity:** 🟡 *Warning*
252
-
253
- #### Unused Variable
254
- Unused variables are never referenced and add unnecessary clutter. Remove them to keep Flows efficient and easy to maintain.
255
-
256
- **Rule ID:** `unused-variable`
257
- **Class Name:** _[UnusedVariable](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/UnusedVariable.ts)_
258
- **Severity:** 🟡 *Warning*
259
-
260
- #### Missing Auto Layout
261
- Auto-Layout automatically arranges and aligns Flow elements, keeping the canvas organized and easier to maintain. Enabling it saves time and improves readability.
262
-
263
- **Rule ID:** `missing-auto-layout`
264
- **Class Name:** _[AutoLayout](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/core/src/main/rules/AutoLayout.ts)_
265
- **Severity:** 🔵 *Note*
266
- <!-- END GENERATED_RULES -->
267
-
268
- ---
269
-
270
- ## Configuration
271
-
272
- It is recommend to configure and define:
273
-
274
- - The severity of violating any specific rule.
275
- - Expressions used for rules, such as REGEX patterns and comparison operators.
276
- - Any known exceptions that should be ignored during scanning.
277
-
278
- ```json
279
- {
280
- "rules": {
281
- // Your rule configurations
282
- },
283
- "exceptions": {
284
- // Your defined exceptions
285
- }
286
- }
287
- ```
288
-
289
- Most Lightning Flow Scanner distributions automatically resolve configurations from `.flow-scanner.yml`, `.flow-scanner.json`, or `package.json` → `flowScanner`.
290
-
291
- ### Configure Rules
292
-
293
- By default, all default rules are executed. You can customize individual rules and override the rules to be executed without having to specify every rule. Below is a breakdown of the available attributes of rule configuration:
294
-
295
- ```json
296
- {
297
- "rules": {
298
- "<RuleId>": {
299
- "severity": "<Severity>", // Override severity level
300
- "expression": "<Expression>", // Override rule expression
301
- "message": "<Message>", // Set custom message
302
- "messageUrl": "<URL>", // Set custom documentation URL
303
- "enabled": false, // Disable this rule
304
- }
305
- }
306
- }
307
- ```
308
-
309
- #### Configure Severity
310
-
311
- When the severity is not provided it will be `warning` by default. Other available values for severity are `error` and `note`. Configure the severity per rule as demonstrated below:
312
-
313
- ```json
314
- {
315
- "rules": {
316
- "record-id-as-string": {
317
- "severity": "warning",
318
- },
319
- "unclear-api-naming": {
320
- "severity": "error",
321
- }
322
- }
323
- }
324
- ```
325
-
326
- #### Override Expressions
327
-
328
- Some rules are configurable and allow overriding their default expressions. You configure these overrides the same way as severity, as shown in the examples below.
329
-
330
- ```json
331
- {
332
- "rules": {
333
- "invalid-api-version": {
334
- "expression": "===58" // comparison expression
335
- },
336
- "invalid-naming-convention": {
337
- "expression": "[A-Za-z0-9]" // regular expression
338
- }
339
- }
340
- }
341
- ```
342
-
343
- #### Customize Messages
344
-
345
- If not provided, `message` shows the standard rule summary and `messageUrl` links to the README; providing either overrides the default behavior.
346
-
347
- ```json
348
- {
349
- "rules": {
350
- "dml-in-loop": {
351
- "message": "Avoid DML inside loops. Bulkify operations instead.",
352
- "messageUrl": "https://internal.docs.company.com/salesforce/flow-dml-best-practices"
353
- }
354
- }
355
- }
356
- ```
357
-
358
- #### Disable Rules
359
-
360
- To disable a rule, set `"enabled": false` as shown below:
361
-
362
- ```json
363
- {
364
- "rules": {
365
- "dml-in-loop": {
366
- "enabled": false
367
- }
368
- }
369
- }
370
- ```
371
-
372
- ### Define Exceptions
373
-
374
- Defining exceptions allows you to exclude specific scenarios from rule enforcement. Exceptions can be specified at the flow, rule, or result level to provide fine-grained control. Below is a breakdown of the available attributes of exception configuration:
375
-
376
- ```json
377
- {
378
- "exceptions": {
379
- "<FlowName>": {
380
- "<RuleId>": [
381
- "<ResultName>", // Suppress a result
382
- "*", // Wildcard to suppress all results
383
- ...
384
- ]
385
- },
386
- ...
387
- }
388
- }
389
- ```
390
-
391
- _Example_
392
-
393
- ```json
394
- {
395
- "exceptions": {
396
- "MyFlow": {
397
- "hardcoded-id": ["Old_Lookup_1"],
398
- "missing-null-handler": ["*"]
399
- }
400
- }
401
- }
402
- ```
403
-
404
- ### Exclude Flows
405
-
406
- #### Exclude by File Path (Node.js only)
407
-
408
- Use glob patterns to exclude flows based on their file system location. This is useful for excluding entire directories or specific name patterns:
409
-
410
- ```json
411
- {
412
- "ignore": [
413
- "**/testing/**",
414
- "**/*_Deprecated.flow-meta.xml"
415
- ]
416
- }
417
- ```
418
-
419
- **Environment compatibility**: requires Node.js(file system access) and is not available when using the Core Library in browser/web environments.
420
-
421
- #### Exclude by Flow API Name (Browser-compatible)
422
-
423
- Exclude specific flows by their unique API names, regardless of their location. This is particularly useful for:
424
- - Excluding specific flows without knowing their exact file path
425
- - Working with metadata API deployments where directory structures may vary
426
- - More precise control than path-based patterns
427
-
428
- ```json
429
- {
430
- "ignoreFlows": [
431
- "My_Legacy_Flow",
432
- "Temporary_Test_Flow",
433
- "Deprecated_Process_Builder"
434
- ]
435
- }
436
- ```
437
-
438
- **Environment compatibility**: works in **all environments** including Node.js and browser/web distributions, as it operates on parsed flow data rather than file system paths.
439
-
440
- ### Scan Modes
441
-
442
- #### Beta Mode
443
-
444
- New rules are introduced in Beta mode before being added to the default ruleset. To include current Beta rules, enable the optional betamode parameter in your configuration:
445
-
446
- ```json
447
- { "betaMode": true }
448
- ```
449
-
450
- #### Rule Mode
451
-
452
- By default, Lightning Flow Scanner runs **all** default rules and merges any custom configurations you provide. If instead, you want to run **only** the rules you explicitly specify, use:
453
- ```json
454
- { "ruleMode": "isolated" }
455
- ```
456
-
457
- ## Installation
458
-
459
- ### Distributions
460
-
461
- | Distribution | Best for | Install |
462
- |----------------------------------------------------------------|-----------------------------------------------|---------------------------------------------------------------------------------------------------------|
463
- | **[Salesforce CLI Plugin](https://www.npmjs.com/package/lightning-flow-scanner)** | Local development, scratch orgs, CI/CD | `sf plugins install lightning-flow-scanner` |
464
- | **[VS Code Extension](https://open-vsx.org/extension/ForceConfigControl/lightning-flow-scanner-vsx)** | Real-time scanning inside VS Code | `code --install-extension ForceConfigControl.lightning-flow-scanner-vsx` |
465
- | **[Salesforce App (Managed Package)](https://github.com/Flow-Scanner/lightning-flow-scanner-app)** | Run scans directly inside a Salesforce org | `sf package install --package 04tgK0000008CLlQAM` |
466
- | **[GitHub Action](https://github.com/marketplace/actions/lightning-flow-scan)** | Native PR checks | `uses: Flow-Scanner/lightning-flow-scanner@main` |
467
- | **[Core Library](https://www.npmjs.com/package/@flow-scanner/lightning-flow-scanner-core)** (Node.js + Browser) | Custom tools, scripts, extensions, web apps | `npm install -g @flow-scanner/lightning-flow-scanner-core` |
468
-
469
- **Privacy:** Zero user data collected. All processing is client-side. → See our [Security Policy](https://github.com/Flow-Scanner/lightning-flow-scanner?tab=security-ov-file).
470
-
471
- ### CICD Templates
472
- Ready-to-use CI/CD templates and a **Copado Plugin**.
473
-
474
- | Platform | Type | Link |
475
- |----------------|-----------------------------------|------|
476
- | [Azure DevOps](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/azure-templates.md) | Full Project Scan | [`azure-pipelines-flow-FullScan.yml`](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/templates/azure-devops/azure-pipelines-flow-FullScan.yml) |
477
- | [Azure DevOps](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/azure-templates.md) | Change-Based Scan | [`azure-pipelines-flow-changedFiles.yml`](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/templates/azure-devops/azure-pipelines-flow-changedFiles.yml) |
478
- | **[Copado Plugin](https://github.com/Flow-Scanner/lightning-flow-scanner-copado)** | Copado Plugin | [Copado Marketplace](https://success.copado.com/s/listing-detail?language=en_US&recordId=a54P7000003G3gBIAS) |
479
-
480
- ## Quick Start
481
-
482
- ### Salesforce CLI Plugin
483
-
484
- Use `lightning-flow-scanner` in the Salesforce CLI:
485
-
486
- ```bash
487
- sf flow:scan # Scan flows in the current directory
488
- sf flow:scan --sarif > report.sarif # Export scan results as SARIF
489
- sf flow scan --csv > results.csv # Export scan results as CSV
490
- sf flow doc > flow-docs.md # Generate flow documentation (Single markdown file)
491
- sf flow doc --output flow-docs --separate # Generate one Markdown file per flow
492
- sf flow:fix -d src/force-app # Fix flows in a specific directory
493
- ```
494
-
495
- For full details, see the [CLI Readme](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/cli/README.md).
496
-
497
- ### VS Code Extension
498
- Use our side bar or the **Command Palette** and type `flow scanner` to see the list of all available commands.
499
-
500
- * `Configure Scanner` - Set up rules in `.flow-scanner.yml`
501
- * `Scan Flows` - Analyze a directory or selected flow files
502
- * `Fix Flows` - Automatically apply available fixes
503
- * `Generate Flow Documentation` - Generate flow documentation
504
- * `Open Scanner Documentation` - Open the rules reference guide
505
-
506
- For full details, see the [VSX Readme](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/vsx/README.md).
507
-
508
- ### GitHub Action
509
- Add a GitHub workflow file `.github/workflows/scan-flows.yml` to detect issues directly in pull requests:
510
-
511
- ```yaml
512
- - name: Lightning Flow Scan
513
- id: flowscanner
514
- uses: Flow-Scanner/lightning-flow-scanner@main
515
- with:
516
- sarif-only: true # Strict mode for PRs
517
-
518
- - name: Upload SARIF to Code Scanning
519
- uses: github/codeql-action/upload-sarif@v3
520
- with:
521
- sarif_file: ${{ steps.flowscanner.outputs.sarifPath }}
522
- ```
523
-
524
- For full details, see the [Action Readme](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/packages/action/README.md).
525
-
526
- ### Core Module
527
- Use `lightning-flow-scanner-core` as a Node.js/browser dependency:
528
-
529
- ```js
530
- // Basic
531
- import { parse, scan } from "@flow-scanner/lightning-flow-scanner-core";
532
- parse("flows/*.xml").then(scan);
533
-
534
- // Get SARIF output (e.g. for GitHub Code Scanning)
535
- import { parse, scan, exportSarif } from "@flow-scanner/lightning-flow-scanner-core";
536
- parse("flows/**/*.flow-meta.xml").then(scan).then(exportSarif)
537
- // .then(sarif => fs.writeFile("results.sarif", sarif))
538
-
539
- // Generate Markdown documentation with Mermaid flow diagrams
540
- import { parse, exportDiagram } from "@flow-scanner/lightning-flow-scanner-core";
541
- parse("flows/**/*.flow-meta.xml").then(exportDiagram)
542
- // .then(md => fs.writeFile("flow-docs.md", md))
543
-
544
- // Browser Usage (Tooling API)
545
- const { Flow, scan } = window.lightningflowscanner;
546
- const metadataRes = await conn.tooling.query(`SELECT Id, FullName, Metadata FROM Flow`);
547
- const results = scan(
548
- metadataRes.records.map((r) => ({
549
- uri: `/services/data/v60.0/tooling/sobjects/Flow/${r.Id}`,
550
- flow: new Flow(r.FullName, r.Metadata),
551
- })) //, optionsForScan
552
- );
553
- ```
554
-
555
- For more on Programmatic API, types, and advanced usage of `@flow-scanner/lightning-flow-scanner-core`, see the [Core Library Reference](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/docs/core-reference.md).
556
-
557
- ## Development
558
-
559
- > This project optionally uses [Volta](https://volta.sh) to guarantee the exact same Node.js and tool versions for every contributor.
560
- >
561
- > MacOs/Linux:
562
- > ```sh
563
- > curl https://get.volta.sh | bash
564
- > ```
565
- > Windows:
566
- > ```sh
567
- > winget install Volta.Volta
568
- > ```
569
- > Volta will automatically install and lock the tool versions defined in `package.json`.
570
-
571
- 1. Clone the repository
572
-
573
- ```bash
574
- git clone https://github.com/Flow-Scanner/lightning-flow-scanner.git
575
- ```
576
-
577
- 2. Install dependencies:
578
-
579
- ```bash
580
- pnpm install
581
- ```
582
-
583
- 3. Compile:
584
-
585
- ```bash
586
- pnpm run build
587
- ```
588
-
589
- To compile just the core package::
590
- ```bash
591
- pnpm build:core
592
- ```
593
-
594
- 4. Run tests:
595
-
596
- ```bash
597
- pnpm test
598
- ```
599
-
600
- Or to test a new version of the core:
601
- ```bash
602
- pnpm test:core
603
- ```
604
-
605
- 5. Linking the core module locally(Optional):
606
-
607
- To link the module, run:
608
-
609
- ```bash
610
- pnpm link --global @flow-scanner/lightning-flow-scanner-core
611
- ```
612
-
613
- You can now do Ad-Hoc Testing with node:
614
-
615
- ```bash
616
- node -i -e "import('@flow-scanner/lightning-flow-scanner-core').then(m => { Object.assign(global, m.default ? m.default : m); console.log('✅ Core loaded! Try: await parse(...), scan(...), etc.'); })"
617
- ```
618
-
619
- Or test in a dependent project with `npm link @flow-scanner/lightning-flow-scanner-core`
620
-
621
- 6. Deploy Demo Flows (Optional):
622
-
623
- ```bash
624
- cd example-flows && sf project deploy start
625
- ```
626
-
627
- Navigate to the [Demo Readme](https://github.com/Flow-Scanner/lightning-flow-scanner/blob/main/example-flows/README.md) for full details
628
-
629
- 7. Create a standalone UMD Module(Optional):
630
-
631
- ```bash
632
- pnpm dist
633
- ```
634
- This creates UMD at `dist/lightning-flow-scanner-core.umd.js`.
635
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes