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

GitHub 代码仓jack-r-warren/remove_from_coverage

从覆盖率中移除

一个命令行工具,用于自定义覆盖率 lcov.info 文件的内容

从覆盖率中移除 项目封面
星标
20
复刻
5
最近推送(UTC)
2023年3月7日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

Remove from Coverage

Author: Jack Warren

Build Status Pub

Manipulate lcov.info coverage files to ignore files matching given patterns. This can be used to exclude generated files from coverage reports, and is language-agnostic.

Remove files with paths matching given PATTERNs from the lcov.info FILE
-f, --file=<FILE>         the target lcov.info file to manipulate
-r, --remove=<PATTERN>    a pattern of paths to exclude from coverage
-h, --help                show this help

The patterns are used to construct RegExp objects, so -r "\.g\.dart$" becomes RegExp('\.g\.dart$'). Multiple patterns may be provided by either providing -r multiple times or by using comma-separation, like -r '\.g\.dart$', 'main\.dart'. When evaluating a file's entry in the lcov.info, if its path matches any pattern it will be excluded. The paths are relative from the project's root.

If a lcov.info file is not provided via the -f flag, stdin input is run through the program's filter and is sent to stdout.

Example

Suppose you want to remove generated files ending in .g.dart from code coverage reports:

  • We'll target the lcov.info file in the coverage directory
  • We'll use \.g\.dart$ as the pattern

If pub global scripts are on your path, you can use the following:

remove_from_coverage -f coverage/lcov.info -r "\.g\.dart$"

Otherwise, you can use the following:

pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r "\.g\.dart$"

An entire example project where remove_from_coverage is useful exists in the example directory of the package.

How it works

Code coverage reports are generated from an lcov.info file, which is generated by test coverage packages.

In some cases, it might make sense to have some files excluded from code coverage reports, like generated or experimental files. Some generators of lcov.info files might support excluding files, but remove_from_coverage provides another route: after a lcov.info file has been generated, it can be manipulated to remove data relating to ignored files.

This means that remove_from_coverage is agnostic to both how the lcov.info file is generated or how it is used. It may be used for non-Dart projects, and it has been tested on both Linux and Windows.

Jack Warren GitHub avatar
GitHub 作者

Jack Warren ↗

Principal Full Stack Engineer at @AgZen-Inc • he/him

@AgZen-IncBoston, MA官方网站 ↗
语言DartShell

此仓库发布的插件

使用的依赖

依赖清单 2 项

  • args^2.0.0
  • pedantic开发依赖^1.11.0

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗