Rules are one of the core building blocks of DCM. A rule validates if your code meets a certain expectation, and what to do if it does not meet that expectation.
All rules can be configured with
include options, but some rules also have additional configuration options specific to that rule and are marked with ⚙️.
Enabling a Rule
To enable a rule add its id to the
To change a rule's severity, configure the rule with one of these values:
To exclude specific files from rule's analysis, configure the rule
Excluding Files for All Rules
To exclude a file for all the rules, configure global
To include specific files to rule's analysis, configure the rule
All files are included by default.
Disabling a Rule
If you include an analysis options file (which has DCM configuration) or use a preset, you might want to disable some of the included rules. Disabling individual rules is similar to enabling them, but the name of a rule should be followed by either
: false or
Here's an example of an analysis options file that has a disabled rule:
- newline-before-return: false