Skip to main content

Check Exports Completeness

Checks that an exported API exports all used types (even transitive).

To execute the command, run:

$ dcm check-exports-completeness lib # or dcm ec lib

Full command description:

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


-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 the 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}")


--no-congratulate Don't show output even when there are no issues.


--verbose Show verbose logs.


--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.


--[no-]fatal-found Treat found not exported code as fatal.
(defaults to on)

Suppressing the command

To suppress for an entire file add ignore_for_file: exports to the beginning of a file.

Output example

Console

Use --reporter=console to enable this format.

Console

JSON

The reporter prints a single JSON object containing meta information and the incomplete exports. 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
  • incompleteExports - an array of incomplete exports issues
{
"formatVersion": 2,
"timestamp": "2021-04-11 14:44:42",
"incompleteExports": [
{
...
},
{
...
},
{
...
}
]
}

The incompleteExports object fields are

  • path - a relative path of the file with the declaration that needs to be exported
  • issues - an array of issues detected in the target class
{
"path": "lib/src/some/class.dart",
"issues": [
...
],
}

The issue object fields are

  • referencePath - the path representing the call chain from the entrypoint to this declaration
  • declarationName - the name of a declaration that needs to be exported
  • declarationType - the type of a declaration that needs to be exported (function, method or constructor)
  • offset - a zero-based offset of the class member location in the source
  • line - a zero-based line of the class member location in the source
  • column - a zero-based column of class member the location in the source
{
"referencePath": "entrypoint > someClass",
"declarationName": "someFunction",
"declarationType": "function",
"offset": 156,
"line": 7,
"column": 1
}

GitLab

Reports export issues in merge requests based on Code Quality custom tool. Use --reporter=gitlab to enable this format.