Starter Plan
Step 3: License Activation
Next, you need to activate your license after installing the executable and the IDE extension.
This process needs to be done only once per device.
Activating the License
Use the following command in your terminal to activate the license:
dcm activate --license-key=YOUR_KEY
Alternatively, you can activate the license through the IDE extension by using the DCM: Activate license key command.
License activation uses the device ID, so attempts to activate a license multiple times on the same device won't reduce the activation count.
To check the active license type, use:
dcm license
Running the Executable on CI/CD
DCM can be integrated into your CI/CD pipeline to automate code analysis. To run commands on CI, use the following options with each command instead of activating the license directly:
dcm analyze lib --ci-key=YOUR_CI_KEY --email=LICENSE_EMAIL
Alternatively, set the DCM_CI_KEY and DCM_EMAIL environment variables, and they will be picked up automatically.
Consider pinning the tool's version on CI, as each new release usually comes with fixes for false positives or new cases that can cause unexpected CI failures.
Step 4: Integration
This guide will help you integrate DCM into your project using rule presets.
Enabling DCM Rules with Presets
To quickly start using DCM rules, enable the "recommended" preset in your analysis_options.yaml file. This preset includes a curated set of rules designed to provide immediate benefits without extensive configuration.
Add the following to your analysis_options.yaml file:
dcm:
extends:
- recommended
To find out more about presets, refer to the documentation on presets.
DCM Presets Package
DCM also provides an additional package dart_code_metrics_presets to enable more presets. To find out how to enable a preset, refer to the presets documentation on enabling a preset.
Enabling DCM Metrics
DCM provides code metrics to help you measure and maintain code quality. To enable metrics in your project, add the following configuration to your analysis_options.yaml file:
dcm:
metrics:
cyclomatic-complexity: 20
number-of-parameters: 4
maximum-nesting-level: 5
For a complete list of available metrics and detailed configuration options, refer to the Metrics documentation.
Additional Integration Techniques
There are other techniques available to integrate DCM smoothly into your project. You can learn more about these methods in this comprehensive guide on Integrating DCM Into an Existing Project.
Step 5: Next Steps
Congratulations on setting up DCM! Here's what you can explore next.
Choosing Your Rules
To quickly choose your first DCM rules, follow this guide. It will walk you through various techniques (such as the "recommended" preset) that make this process very straightforward.
If you're integrating DCM into an existing project, this guide describes several techniques and DCM features that can significantly simplify the integration process.
Learn More
To maximize the potential of DCM and customize its behavior, explore the following resources:
-
Configuration Options: Learn how to customize DCM's behavior by exploring the configuration options.
-
Lint Rules: Get to know about lint rules and find bugs, performance and style issues to meet best practices and quality standards.
-
Metrics: Get to know about metrics and detect places in the codebase that need the most attention and ensure that code stays easy to maintain.
-
Command Line Interface: Use DCM CLI to find unused code, unused files, misused dependencies and more.
-
IDE Integrations: Explore DCM extensions for VS Code and IntelliJ and Android Studio to integrate real-time checks directly into your IDE.
-
CI/CD Integration: Learn how to set up your CI/CD to leverage DCM on your automated tasks.
Want More?
Consider upgrading to Teams or Enterprise plans for:
- Team management and access control
- DCM Dashboards for technical debt visualization
- Advanced collaboration features
Visit our pricing page to learn more.