lcov 5.4.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 85

LCOV Reports for Dart #

Runtime Release License Coverage Build

Parse and format LCOV coverage reports, in Dart.

Documentation #

Development #

License #

LCOV Reports for Dart is distributed under the MIT License.

Changelog #

Version 5.4.0

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 5.3.0

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 5.2.0

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 5.1.0

  • Updated the package dependencies.
  • Updated the URL of the Git repository.

Version 5.0.0

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 4.5.0

  • Updated the package dependencies.

Version 4.4.0

  • Updated the package dependencies.

Version 4.3.0

  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 4.2.0

  • Added an example code.
  • Raised the Dart SDK constraint.
  • Updated the package dependencies.

Version 4.1.0

  • Added the LcovException class.
  • Raised the Dart SDK constraint.
  • Using optional const and new.
  • Updated the package dependencies.

Version 4.0.0

  • Breaking change: starting to use and support the Dart 2 SDK.
  • Added a user guide based on MkDocs.
  • Updated the package dependencies.

Version 3.1.0

  • Updated the package dependencies.

Version 3.0.0

  • Breaking change: changed the signature of most constructors.
  • Breaking change: most properties of data classes are now final.

Version 2.1.0

Version 2.0.1

  • Fixed a bug: a parsing error occurs when the coverage data does not include a test name.

Version 2.0.0

  • Breaking change: changed the Report.parse() static method to the fromCoverage constructor.
  • Raised the required Dart version.
  • Updated the package dependencies.

Version 1.0.0

  • First stable release.

Version 0.4.0

  • Raised the required Dart version.
  • Updated the package dependencies.

Version 0.3.1

  • Fixed a bug in Report.parse() method.

Version 0.3.0

  • Added the data parameter to the default constructors of the coverage classes.
  • Added the records parameter to the default constructor of the Report class.

Version 0.2.0

  • Breaking change: changed the signature of most default constructors.
  • Empty test names are not included in the report output.

Version 0.1.0 #

  • Initial release.

example/main.dart

import 'dart:io';
import 'package:lcov/lcov.dart';

/// Formats coverage data as LCOV report.
void formatReport() {
  final lineCoverage = LineCoverage(2, 2, [
    LineData(6, executionCount: 2, checksum: 'PF4Rz2r7RTliO9u6bZ7h6g'),
    LineData(7, executionCount: 2, checksum: 'yGMB6FhEEAd8OyASe3Ni1w')
  ]);

  final record = Record('/home/cedx/lcov.dart/fixture.dart')
    ..functions = FunctionCoverage(1, 1)
    ..lines = lineCoverage;

  final report = Report('Example', [record]);
  print(report);
}

/// Parses a LCOV report to coverage data.
Future<void> parseReport() async {
  final coverage = await File('lcov.info').readAsString();

  try {
    final report = Report.fromCoverage(coverage);
    print('The coverage report contains ${report.records.length} records:');
    print(report.toJson());
  } on LcovException catch (err) {
    print('An error occurred: ${err.message}');
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  lcov: ^5.4.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:lcov/lcov.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
71
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
85
Learn more about scoring.

We analyzed this package on Nov 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:lcov/lcov.dart.

Health suggestions

Fix lib/src/report.dart. (-1 points)

Analysis of lib/src/report.dart reported 2 hints:

line 31 col 11: DO use curly braces for all flow control structures.

line 108 col 7: DO use curly braces for all flow control structures.

Fix lib/src/branch.dart. (-0.50 points)

Analysis of lib/src/branch.dart reported 1 hint:

line 34 col 7: DO use curly braces for all flow control structures.

Fix lib/src/function.dart. (-0.50 points)

Analysis of lib/src/function.dart reported 1 hint:

line 34 col 7: DO use curly braces for all flow control structures.

Fix lib/src/line.dart. (-0.50 points)

Analysis of lib/src/line.dart reported 1 hint:

line 34 col 7: DO use curly braces for all flow control structures.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
json_annotation ^3.0.0 3.0.0
Dev dependencies
build_runner ^1.6.5
build_test ^0.10.8
coverage ^0.13.2
grinder ^0.8.3
json_serializable ^3.2.0
test ^1.6.5