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

Comments

@jpakkane
Copy link

@jpakkane jpakkane commented Jan 26, 2019

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

This comment has been minimized.

Copy link
Member

@latk 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.

@the-code-cult

This comment has been minimized.

Copy link

@the-code-cult 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
Projects
None yet
3 participants
You can’t perform that action at this time.