Open keirbowden opened 1 year ago
@keirbowden , the documentation does instruct users to declare new rules in categories, rather than rulesets. However, the proposal to throw an error when adding the rules instead of allowing the catalog to enter an invalid state is a good one. We can take that on as a feature request.
This issue has been linked to a new work item: W-15080498
I'm creating a custom ruleset based on the instructions. If my ruleset just references other rules, e.g.
it all works as expected.
When I declare an XPath rule in the file:
I can still add the ruleset :
But any commands I execute after that throw an error:
INTERNAL ERROR: Unexpected error occurred while cataloging rules: begin 0, end 3, length 0. Please log an issue with us at github.com/forcedotcom/sfdx-scanner.
And the only way to fix this is to remove the entry from
.sfdx-scanner/CustomPaths.json
The rule works fine when added from a catalog file, just not in a ruleset.
The instructions mentioned (https://forcedotcom.github.io/sfdx-scanner/en/v3.x/custom-config/pmd/) do flip-flop a bit between rules and rulesets, so it might be a documentation issue to make it clear you can't declare rules in rulesets. However, I do think that it should error when I add the ruleset rather than succeeding and then not being able to execute any more commands.