搜索插件、代码仓与 APP 分类

插件详情v0.1.3

lcov_parser

一个 Dart 包,可将 LCOV 覆盖率文件解析为结构化记录,提供对行、分支和函数覆盖率数据的便捷访问。

AndroidiOSmacOSWindowsLinux
近 30 天下载
38.7万
喜欢数
4
Pub 分数
140

安装插件

flutter pub add lcov_parser

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

lcov_parser 包是一个 Dart 工具,旨在解析 LCOV(Linux 覆盖率)格式文件,将其转换为用于行、分支和函数覆盖率的结构化数据。它使开发者能够以编程方式分析测试覆盖率结果,从而更容易集成到 CI/CD 流水线或生成报告中。该包支持多种平台,非常适合希望借助详细的覆盖率指标来保持高代码质量的团队。

适合场景

  • 从测试运行中解析 LCOV 文件
  • 将覆盖率分析集成到CI/CD工作流中
  • 在应用程序中生成覆盖率报告
  • 分析代码覆盖率随时间的趋势
  • 在拉取请求中验证覆盖率阈值

主要特点

  • 支持行、分支和函数覆盖率
  • 提供结构化数据模型
  • 与 Dart 项目的轻松集成
  • 跨平台兼容性
  • 轻量级且专注于解析

适合对象

  • 测试自动化工程师
  • CI/CD 流水线开发者
  • 代码质量团队
  • Dart 项目维护者
  • 覆盖率报告生成器

使用建议

  • 需要有效的 LCOV 输入文件
  • 不生成覆盖数据——仅解析它
  • 仅限 LCOV 格式
  • 无内置报告UI
  • 依赖外部覆盖工具来生成 LCOV

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Lcov parser

Dart

A simple lcov file parser implementation in Dart.

The lcov is used to get test coverage. It works as a front-end for gcov collecting the data and generating the coverage info.

This implementation translates the lcov format to Dart classes we can understand and use the coverage info for a lot of proposals.

How to use

To use it is very simple, this package exports the model of the record and the parser class, and you will receive from the return of the parser is a list of record. As you can see in the code below

import 'package:lcov_parser/lcov_parser.dart';

void main() async {
    final file = 'absolute path from lcov.info file';
    final records = await Parser.parse(file);
}

Another option is to parse records from a list of strings:

void main() {
  final lines = [
    'SF:lib/src/interceptors/app_version_interceptor.dart',
    'DA:6,1',
    'DA:11,1',
    // ...more lines here
    'end_of_record',
  ];
  final records = Parser.parseLines(lines);
}

You also will find a script example in the example/main.dart file.

How to contribute with the project.

Feel free to open issues in this repository or open your pull request.

Running the tests

In the root path

dart test

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目