Teams / Enterprise Plan
Step 3: Advanced IDE Setup
Configure team-specific IDE settings to ensure consistency across your team.
First, complete the basic IDE setup by following the common IDE setup guide.
- VS Code
- IntelliJ & Android Studio
Team Configuration for VS Code
Once the basic setup is complete, configure the following settings to ensure consistency across your team.
Ensuring Team-Wide IDE Extension Installation
To ensure that all team members using VS Code have the necessary extensions installed, configure the "Workspace recommended extensions":
-
Create or update the
.vscode/extensions.jsonfile in your project directory. -
Add the following configuration:
{
"recommendations": ["dcmdev.dcm-vscode-extension"]
}
Refer to the Workspace recommended extensions documentation for more details.
Ensuring Consistent Executable Versions Across the Team
To ensure that all team members use the same version of the DCM executable, configure the version constraints in your project's dcm_global.yaml file:
-
Open or create the
dcm_global.yamlfile in your project root. -
Set the version constraint:
version: '>=1.15.0 <2.0.0'
For more information on global configuration options, refer to the global configuration documentation.
Team Configuration for IntelliJ / Android Studio
Once the basic setup is complete, configure the following settings to ensure consistency across your team.
Ensuring Team-Wide IDE Extension Installation
To ensure team-wide plugins installation, configure the list of required plugins:
- Go to File > Settings (or IntelliJ IDEA > Preferences on macOS).
- Navigate to Plugins and select the Required Plugins tab.
- Add "DCM" to the list of required plugins.
Refer to the Required plugins documentation for detailed instructions.
Ensuring Consistent Executable Versions Across the Team
To ensure that all team members use the same version of the DCM executable, configure the version constraints in your project's dcm_global.yaml file:
-
Open or create the
dcm_global.yamlfile in your project root. -
Set the version constraint:
version: '>=1.15.0 <2.0.0'
For more information on global configuration options, refer to the global configuration documentation.
Step 4: 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 5: Integration
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.
Excluding Existing Issues from the Analysis
DCM offers a command to generate a baseline file with all existing issues. These issues will not be reported by the IDE or CLI, allowing you to address them gradually without overwhelming your development process.
To generate the baseline, use the following command:
dcm init baseline --analyze lib # or dcm i b --analyze lib
For more details, refer to the command documentation on generating the baseline.
Once the baseline file is created, you can incrementally remove the issues from this file and fix them at your own pace.
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 6: 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 to suit your team's needs, 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.
-
DCM Dashboards: Learn how DCM helps you visualize your technical debt and how it changes over time.
For Team Administrators
If you're managing the team's DCM account, explore the Team Administration section to learn about:
- Managing developers and users
- Controlling access to DCM Dashboards
- Billing and seat management
- CI/CD credentials management