Closed nebc-jasonfung closed 1 year ago
can you verify if you what version you are using and if its the latest version of the sfdx plugin? I believe we have had this with v2 and was patched with 2.1 . Also are you using any flowscanner configuration file specifying which rules to run?(this is optional but if you do, it needs to contain rules)
Hi @RubenHalman, it appears I'm on the latest version:
I have tried both sfdx flow:scan
and sfdx flow:scan --config path/to/.flow-scanner.json
where the defined config rules is:
{
"rules": [
{
"DMLStatementInLoop": {
"severity": "warning"
},
"HardcodedIds": {
"severity": "warning"
},
"MissingFlowDescription": {
"severity": "warning"
},
"UnusedVariables": {
"severity": "error"
}
}
]
}
sfdx flow:scan
returns 0 errors found and with the config flag it returns the below and stops:
Thank you for verifying the version. Try to delete the configuration file and then run the scan or put all the rules of severity 'error'. warning levels only show when you configure the threshold to warning too. The configuration file is automatically detected if it exists, so in your case only one rule is really running.
If you run the --json flag on addition to your commands, you should see some of the rules have warnings that did not show up as error
Thank you for the response, I have gone and deleted the config file and ran sfdx flow:scan --json
and the following is the output:
{
"status": 0,
"result": {
"summary": {
"flowsNumber": 28,
"errors": 0,
"message": "A total of \u001b[1m0\u001b[22m errors have been found in \u001b[1m28\u001b[22m flows.",
"errorLevelsDetails": {}
},
"status": 0,
"results": []
}
}
It appears it's still not detecting any errors
@RubenHalman it appears to be a problem specific to v2.2.0 - after installing v2.1.0 the errors are surfacing as expected.
I am happy it works for you now and I'll look into 2.2. actually the latest version should be 2.3. It will help me if you would be willing to try that version to see if you are having issues too probably.
Thanks, @RubenHalman, 2.3 seems to work okay for sf flow:scan
command, for sf flow:scan --config path/to/config.json
it doesn't seem to output the results:
What I want to achieve is suppressing the warns and only surface the errors. Here is my config file:
{
"rules": [
{
"DMLStatementInLoop": {
"severity": "error"
},
"DuplicateDMLOperations": {
"severity": "warning"
},
"NoHardcodedIds": {
"severity": "error"
},
"MissingFlowDescription": {
"severity": "warning"
},
"MissingFaultPath": {
"severity": "warning"
},
"NoUnusedParameters": {
"severity": "warning"
},
"MissingNullHandler": {
"severity": "warning"
},
"UnconnectedElements": {
"severity": "warning"
},
"UnusedVariables": {
"severity": "warning"
}
}
]
}
great thanks. your rules are configured slightly incorrect: they need to be an object like so {{ "rules": { "MissingFlowDescription": { "severity": "warning" }, "UnusedVariables": { "severity": "error" } } }.
just remove the '[]'
meaning it is one object and not an array. an error should probably be thrown in this case.
Finally note you can also "deactivate" rules from running by only specifying rules you are interested in
@nebc-jasonfung did it work? if so please close this ticket. thanks!
That did work @RubenHalman - many thanks for your help!
I've been playing around with the plugin and have created a test flow in order to simulate some of the errors - i'm unable to get this to return any errors.
Here is my example flow:
Here's the output after running the scan:
What I'm expecting to see are the following rules being triggered:
Am I missing something?