Skip to main content
Teams

Run

Run multiple passed DCM commands at once with the merged output (console, code climate / gitlab, json).

info

This command is supposed to be used on CI/CD. It has no progress indication and does not show any output on a successful run.

To execute the command, run:

$ dcm run --analyze --unused-code lib # or dcm r --analyze --unused-code lib

Full command description:

Usage: dcm run [arguments] <directories>
-h, --help Print this usage information.


--analyze Run dcm analyze.
--metrics Run dcm calculate-metrics.
--analyze-widgets Run dcm analyze-widgets.
--code-duplication Run dcm check-code-duplication.
--unused-code Run dcm check-unused-code.
--unused-files Run dcm check-unused-files.
--unused-l10n Run dcm check-unused-l10n.
--dependencies Run dcm check-dependencies.
--unnecessary-nullable Run dcm check-unnecessary-nullable.
--exports-completeness Run dcm check-exports-completeness.


--show-similarity Include similar widgets into the report.
--threshold Set a minimum threshold after which widgets are considered similar.
(defaults to "0.2")


--per-package Compare code for duplications only within one package.
--exclude-overrides Exclude methods marked with @override.
--statements-threshold Minimum number of statements inside a declaration block.
(defaults to "3")

--no-exclude-overridden Do not treat overridden members as always used.


-p, --class-pattern=<I18n$> The pattern to detect classes providing localization
(defaults to "I18n$")


--ignored-packages=<my-package,other,...> Package names that should be ignored.


-r, --reporter=<console> The format of the output of the analysis.
[console (default), codeclimate, json, gitlab]
--json-path=<path/to/file.json> Path to the JSON file with the output of the analysis.


-c, --print-config Print resolved config.


--root-folder=<./> Root folder.
(defaults to th current directory)
--sdk-path=<directory-path> Dart SDK directory path.
If the project has a `.fvm/flutter_sdk` symlink, it will be used if the SDK is not found.
--exclude=<{**/*.g.dart,**/*.freezed.dart}> File paths in Glob syntax to be exclude.
(defaults to "{**/*.g.dart,**/*.freezed.dart}")


--ci-key The license key to run on CI server. Can be provided via DCM_CI_KEY env variable.
--email The email used to purchase the license. Can be provided via DCM_EMAIL env variable.


--no-analytics Disable sending anonymous usage statistics.


--monorepo Include publicly exported code into the check.


--[no-]fatal-found Treat any found issue as fatal.
(defaults to on)

Output example

Console

Use --reporter=console to enable this format.

Console

JSON

The reporter prints a single JSON object containing meta information and the violations grouped by a file. Use --reporter=json to enable this format.

The root object fields are

  • formatVersion - an integer representing the format version (will be incremented each time the serialization format changes)
  • timestamp - a creation time of the report in YYYY-MM-DD HH:MM:SS format
  • analyzeResults - an array of "analyze" command results
  • metricResults - an array of "calculate-metrics" command results
  • widgetResults - an array of "analyze-widgets" command results
  • unusedCodeResults - an array of "check-unused-code" command results
  • unusedFilesResults - an array of "check-unused-files" command results
  • unusedL10nResults - an array of "check-unused-l10n" command results
  • dependenciesResults - an array of "check-dependencies" command results
  • unnecessaryNullableResults - an array of "check-unnecessary-nullable" command results
  • exportResults - an array of "check-exports-completeness" command results
note

You can find more details about the format on each command's documentation page.

Other formats

GitLab and Code Climate formats are also supported. Refer to the analyze commands docs to set up them.