Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for an "exclude file" #293

Closed
jpakkane opened this issue Jan 26, 2019 · 2 comments
Closed

Add support for an "exclude file" #293

jpakkane opened this issue Jan 26, 2019 · 2 comments
Labels
Filters related to filters, include/exclude, path handling Type: Enhancement

Comments

@jpakkane
Copy link

Currently you can exclude files and directories with -e and company. It would be nice to have a possibility to add support for an exclude file. The way it works is that if you have a tests subdirectory that you don't want to have in the coverage reports, then you'd create a (potentially empty) file tests/.gcovr-ignore. Then gcovr would not print coverage stats for that directory or any of its subdirectories. The front page might list all directories ignored in this way for clarity.

This would be convenient for tests, third party code and so on. You can also change which parts of the source tree to ignore without having to edit the commands used to invoke gcovr.

@latk
Copy link
Member

latk commented Jan 26, 2019

Hello @jpakkane, the HEAD version of gcovr (not yet released on PyPI) has support for configuration files (designed in #229, implemented in #281). You can then add a gcovr.cfg file to your project's --root directory, and put any command line options into that file, using a syntax similar to INI files. For example:

exclude = tests/
exclude = third-party/

This works exactly like adding those to the front of the command line arguments, here: gcovr --exclude test/ --exclude third-part/ ...

The list of exclusions is not currently provided in the HTML report, and I don't know whether that would be helpful in the general case.

You could try installing gcovr directly from GitHub (e.g. python3 -m pip install git+https://github.com/gcovr/gcovr.git) to test that feature. Please let me know if this solves your problem! In the meanwhile, I'm marking this issue as closed.

@latk latk closed this as completed Jan 26, 2019
@latk latk added Type: Enhancement Filters related to filters, include/exclude, path handling labels Jan 26, 2019
@the-code-cult
Copy link

the-code-cult commented Jul 1, 2019

→ moved to issue #320

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Filters related to filters, include/exclude, path handling Type: Enhancement
Projects
None yet
Development

No branches or pull requests

3 participants