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:
1sf code-analyzer run --rule-selector regex
AvoidGetHeapSizeInLoop
Description: Detects usage of the Limits.getHeapSize() Apex method in for, while, and do-while loops.
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:
1public abstract class SomeAbstractClass{2 public void somePublicMethod(){3 somePrivateMethod();4}5 private void somePrivateMethod(){6 // ...7}8}
With this metadata XML file:
1<?xml version="1.0" encoding="UTF-8"?>2<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">3<!-- Here's a comment -->4 <apiVersion>60.0</apiVersion>5</ApexClass>
NoTrailingWhitespace
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
NoMixedIndentation
Description: Detect if tabs and spaces are mixed together. Mixing tabs and spaces can cause unexpected formatting issues, especially in the Developer Console.