搜尋套件、儲存庫與 APP 分類

套件詳情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 項

原始碼儲存庫

使用此套件的專案