パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v2.0.0

remove_from_coverage

カバレッジの lcov.info ファイルの内容をカスタマイズするためのコマンドラインツールです。

macOSWindowsLinux
30日間ダウンロード
6.8万
いいね数
37
Pub ポイント
140

パッケージをインストール

flutter pub add remove_from_coverage

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

指定された行やファイルをカバレッジレポートから削除することで、lcov.info カバレッジファイルを編集するように設計されたコマンドラインツールです。生成コードやボイラープレートコードなどの特定のコードセクションを除外することで、開発者がテストカバレッジデータを最適化し、より正確かつ意味のあるカバレッジメトリクスを確保できます。CI/CDパイプラインでは、クリーンで焦点の当たったカバレッジレポートが不可欠であるため、このツールは特に役立ちます。macOS、Windows、Linuxで動作するため、さまざまな開発環境での利用が可能になっています。

用途

  • テストカバレッジレポートの最適化
  • カバレッジから生成コードを除外する
  • CI/CDレポートの正確性を向上させる
  • 分析用にカスタマイズされたカバレッジデータ
  • カバレッジファイルからのノイズの除去

主な機能

  • コマンドラインインターフェース
  • lcov.info ファイルの操作をサポート
  • クロスプラットフォーム互換性
  • ビルドスクリプトとの簡単な統合
  • カスタマイズ可能な除外ルール

適している対象

  • テスト自動化エンジニア
  • CI/CD パイプライン開発者
  • コード品質チーム
  • カバレッジを管理するFlutter開発者
  • 正確なカバレッジメトリクスを目指すチーム

注意事項

  • 除外の手動設定が必要です
  • ランタイムパッケージではありません
  • ポストプロセッシングカバレッジファイルに限定
  • GUIインターフェースなし
  • 正しい lcov.info 形式に依存する

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

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.

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト