I was happy to see the new "CPD" and "pmd-appexchange" CLI scanner tools in the recent documentation. Both are great additions to the tool that I'll run regularly.
docs: SF CPD
For CPD, is there command line syntax to pass a parameter in? I'm interested in the "--minimum-tokens" parameter, described in the PMD link. I added that on my SF command line, but it did not parse.
thanks,
Sean
Note, at the end of this week (Thursday afternoon) we will be releasing Code Analyzer v5 (beta) where you'll be able to have greater control over the minimum tokens arguments (per language) for the cpd engine.
You'll be able to create a code-analyzer.yml file (which we recommend you place in the root folder of your sfdx project) and configure the engines. One of the configuration options that we will have will be:
engines:
cpd:
# Specifies the minimum tokens threshold for each rule language.
# The minimum tokens threshold is the number of tokens required to be in a duplicate block of code in order to be
# reported as a violation. The concept of a token may be defined differently per language, but in general it is a
# distinct basic element of source code. For example, this could be language specific keywords, identifiers,
# operators, literals, and more. See https://docs.pmd-code.org/latest/pmd_userdocs_cpd.html to learn more.
# If a value for a language is unspecified, then the default value of 100 will be used for that language.
minimum_tokens:
apex: 100
html: 100
javascript: 100
typescript: 100
visualforce: 100
xml: 100
So you'll want to be on the look out for our release this week.
See: https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/code-analyzer.html and https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/guide/release-notes.html