Dart-CoCo Coverage

Dart-CoCo for Dart is a simple command line utility providing insights into:

  • quality of code by using static analysis of the code to calculate cyclomatic complexity value.
  • coverage information generated from lcov.info file.

How to use

In pubspec.yaml add a development dependency:

dev-dependencies:
    dart_coco: ^1.0.6

From command line execute:

flutter pub run dart_coco --html

If you run flutter test --coverage before executing Dart-CoCo, tool will include coverage data gathered inside coverage/lcov.info

Directly from GitHub clone:

git clone https://github.com/alexZaicev/dart-coco.git
cd dart-coco
pub get

dart bin/dart_coco.dart --html -r path/to/lib -o report --lcov path/to/lcov.info

Report example

Report index.html page:

Index Report Page

Coverage report collected from LCOV:

Coverage Report Page

Options

  • --root (-r) - package root containing modules with dart files to analyse
  • --output (-o) - report output directory location
  • --html - HTML report format
  • --json - JSON report format
  • --help (-h) - Help page
  • --verbose (-v) - Enable detailed logging
  • --lcov - path to LCOV coverage report file

Libraries

dart_coco
dart_coco.analyzer
dart_coco.cyclomatic
dart_coco.logger
dart_coco.parser
dart_coco.reporter