Disabling rules in code-analyzer.yml
and suppressing PMD Apex via // NOPMD
comments
#1799
-
I'm seeing some unexpected (to me, at least) behavior and wanted to see if it was correct or not. First, if I comment out a rule in the Second, if I suppress a reported PMD violation using a Thanks in advance for any insights. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
The code-analyzer.yml file is just an overrides file. If something is not present in that file then the defaults are used. Use the Note that the default value for What are you using for The Are you seeing otherwise? I can't reproduce. |
Beta Was this translation helpful? Give feedback.
The code-analyzer.yml file is just an overrides file. If something is not present in that file then the defaults are used.
Use the
sf code-analyzer rules --rule-selector <YOUR_RULE_SELECTOR>
command to see the rules that you have selected. Once you are happy then use the same--rule-selector
for your run command.Note that the default value for
--rule-selector
on therun
andrules
command isRecomended
. So if you don't want a rule to run with this default selector, then in your overrides file - just remove theRecommended
tag for that rule.What are you using for
--rule-selector
?The
// NOPMD
comment works only for PMD engine and should work as documented at https://pmd.github.io/pmd/pmd_…