Adjust for your needs, and not vice versa
DCM is designed with your needs in mind. There is no code style that suits everyone. Choose the rules and metrics that will help you, and customize them so that they help you as effectively as possible.
Configuration that is easy to use
Use already familiar analysis_options.yaml
file to configure DCM to serve you the best.
Familiar syntax
Although DCM relies on different entries in the analysis_options.yaml
file, the syntax is similar to what you would use to configure the Dart analyzer or linter.
One notable difference is the names of the rules. They are written with "-" instead of "_" (e.g. avoid-unused-parameters
). This is intentional so you can quickly identify where the rule comes from.
Custom config files support
Sometimes your team needs multiple analysis_options.yaml
files, for example to gradually migrate from one config to another. DCM fully supports various custom configuration files (e.g. dcm_rules.yaml
, analysis_options.1.1.0.yaml
, etc.) to help you with this.
With validation and code actions
DCM highlights configurable rules, provides code actions, and validates rule names to help you avoid configuration issues.
Get started quickly and always stay up to date
Given the number of rules available in DCM, the easiest way to get started is with presets. After you enable a preset, you can disable or reconfigure some of its rules. You can enable multiple presets.
With recommended rules and metrics
The main purpose of the recommended presets is to help find bugs in the code. We've tried to make them as objective as possible so that you can benefit from them no matter your code style or the packages you use.
The recommended preset for rules only includes around 40% of all available rules.
Or create your own
DCM comes with a predefined number of presets (one for all Dart and Flutter rules, two for recommended rules and metrics, and one for each supported package), but you can create your own presets. They are just yaml files with familiar syntax.
For different packages
Each package supported by DCM has its own preset. These rules are not included into other presets to avoid unnecessary calculations if you don't actually have the package the rules are intended for.
Updated with each release
With the exception of the recommended preset, when new rules are introduced in a new version, all associated presets are updated, helping you stay up to date with the new DCM rules.
Add to existing projects with ease
Baseline helps you integrate DCM into an existing project where you may have too many violations to fix at once. Addressing only new violations or violations for changed code tremendously simplifies the integration.
Easy to work with
Baseline is a simple JSON file where issues are grouped by name and the files they belong to. You can gradually update the baseline file and reduce violations at your desired pace.
When you change the code that contains a baselined violation, the issue will reappear only if you change the code that is in the issue range.
Shared with your team
Setting up baseline on one device and adding it to your version control system (e.g. git) makes the baseline available for your entire team.
For packages of your choice
You can generate baseline from the root of your project or in each package separately. Ultimately, each package will have its own baseline file, and it's up to you to decide which ones to keep.
To fix only new issues
If you have an old project where you are simply not interested in fixing all the existing violations, but are still interested in running DCM checks on new and changed code, baseline will help you do exactly that.
Ready to fix your code?
Start today