Regex Rules Reference
The Regex rules help you search for specific string patterns in your code. To select these rules, use --rule-selector regex
. For example, to run all the Regex rules:
Description: Detects usage of the Limits.getHeapSize()
Apex method in for
, while
, and do-while
loops.
Default Severity: 2 (High)
Default Tags: Recommended
, Performance
, Apex
Example(s):
- [Bad] Code that causes a violation:
Description: Detects usage of Salesforce API versions that are 3 or more years old.
Default Severity: 2 (High)
Default Tags: Recommended
, Security
, Xml
Description: Detects usage of terms that reinforce implicit bias.
Default Severity: 5 (Info)
Default Tags: Recommended
, BestPractices
More Information: Salesforce Updates Technical Language in Ongoing Effort to Address Implicit Bias.
Description: Detects private methods within abstract or virtual Apex classes when the corresponding API version of the class is less than 61.0.
Default Severity: 2 (High)
Default Tags: Recommended
, BestPractices
, Apex
Example(s):
- [Bad] Code that causes a violation:
With this metadata XML file:
Description: Detects trailing whitespace (tabs or spaces) at the end of lines of code and lines that are only whitespace.
Default Severity: 5 (Info)
Default Tags: Recommended
, CodeStyle
, Apex