Lightning-Flow-Scanner / lightning-flow-scanner-core

A rule engine capable of conducting static analysis on the metadata associated with Salesforce Lightning Flows, Process Builders, and Workflows.
https://www.npmjs.com/package/lightning-flow-scanner-core
MIT License
27 stars 9 forks source link

DuplicateDMLOperationsByNavigation false positive #33

Closed Damecek closed 1 year ago

Damecek commented 1 year ago

Hi, this rule DuplicateDMLOperationsByNavigation identifies falsely this element OnSave. I guess the rule is just checking the allowBack = true, but it probably should also check the showFooter = true. In my case we have a screen where allowBack = true but the footer is hidden, thus preventing user from going back.

Please consider a case to be true only if allowBack = true && showFooter = true.

Damecek commented 1 year ago

Also in my case I got the same element identified twice, probably because two elements were connected to it. This shoudl really be identified as single issue.

{
  "flowName": "Partner Portal: Contact New/Edit",
  "ruleName": "DuplicateDMLOperationsByNavigation",
  "description": "If the flow commits changes to the database or performs actions between two screens, don't let users navigate back between screen. Otherwise, the flow may perform duplicate database operations.",
  "details": {
    "name": "OnSave",
    "type": "screens"
  }
},
{
  "flowName": "Partner Portal: Contact New/Edit",
  "ruleName": "DuplicateDMLOperationsByNavigation",
  "description": "If the flow commits changes to the database or performs actions between two screens, don't let users navigate back between screen. Otherwise, the flow may perform duplicate database operations.",
  "details": {
    "name": "OnSave",
    "type": "screens"
  }
},
image
RubenHalman commented 1 year ago

Thank you for pointing this out and giving a clear explanation. I think I know how to solve this and will be added to the priorities.

RubenHalman commented 1 year ago

@Damecek it turns out im completely wrong and these are standard components. I have identified the bug for all your issues so its should be resolved in the next hours

RubenHalman commented 1 year ago

The rule is updated to not flag screens that have the navigation hidden. The duplicate result will be addressed in a later patch