패키지, 저장소 및 앱 카테고리 검색

패키지 상세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 개

소스 저장소

이 패키지를 사용하는 프로젝트