lcov 4.3.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 83

LCOV Reports for Dart

Runtime Release License Coverage Build

Parse and format LCOV coverage reports, in Dart.

Resources

License

LCOV Reports for Dart is distributed under the MIT License.

Changelog

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.
  • Breaking change: raised the required Dart version.
  • Updated the package dependencies.

Version 1.0.0

  • First stable release.

Version 0.4.0

  • Breaking change: 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:async';
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: ^4.3.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
4.3.0 Aug 6, 2018 Go to the documentation of lcov 4.3.0 Download lcov 4.3.0 archive
4.2.0 Jul 21, 2018 Go to the documentation of lcov 4.2.0 Download lcov 4.2.0 archive
4.1.0 Jun 22, 2018 Go to the documentation of lcov 4.1.0 Download lcov 4.1.0 archive
4.0.0 Mar 3, 2018 Go to the documentation of lcov 4.0.0 Download lcov 4.0.0 archive
3.1.0 Nov 3, 2017 Go to the documentation of lcov 3.1.0 Download lcov 3.1.0 archive
3.0.0 Sep 13, 2017 Go to the documentation of lcov 3.0.0 Download lcov 3.0.0 archive
2.1.0 Sep 9, 2017 Go to the documentation of lcov 2.1.0 Download lcov 2.1.0 archive
2.0.1 Aug 8, 2017 Go to the documentation of lcov 2.0.1 Download lcov 2.0.1 archive
2.0.0 Jul 30, 2017 Go to the documentation of lcov 2.0.0 Download lcov 2.0.0 archive
1.0.0 Mar 25, 2017 Go to the documentation of lcov 1.0.0 Download lcov 1.0.0 archive

All 15 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
67
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]
83
Learn more about scoring.

We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

Format lib/src/branch.dart.

Run dartfmt to format lib/src/branch.dart.

Format lib/src/function.dart.

Run dartfmt to format lib/src/function.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/line.dart (Run dartfmt to format lib/src/line.dart.)
  • lib/src/record.dart (Run dartfmt to format lib/src/record.dart.)
  • lib/src/report.dart (Run dartfmt to format lib/src/report.dart.)
  • lib/src/token.dart (Run dartfmt to format lib/src/token.dart.)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
json_annotation ^1.0.0 1.1.0
Dev dependencies
build_runner ^0.10.0
coverage ^0.12.2
grinder ^0.8.3
json_serializable ^1.0.0
test ^1.3.0