mozilla / grcov

Rust tool to collect and aggregate code coverage data for multiple source files
Mozilla Public License 2.0
1.15k stars 148 forks source link

Question about `--ignore <PATH>` option #1176

Open s8sato opened 5 months ago

s8sato commented 5 months ago

Hi, we are using grcov for our product coverage analysis! I have some questions about the --ignore <PATH> option:

  1. Where is considered the root of the PATH?
  2. If I use --ignore "**/main.rs", what effect does this option have on the output?
  3. What is the role of --ignore "/*" in these examples?
culhatsker commented 3 months ago

Option --ignore works on the paths built into the coverage files (which are absolute paths usually), unless something like --prefix-dir is specified which removes the prefix and the paths become relative. So <PATH> here is a pattern to match the paths, whatever format they have. You can see what data it filters by running grcov path_to_your_coverage -t files optionally adding other params that you want to use.

--ignore "**/main.rs" would ignore coverage for all files which path ends with /main.rs, that's equivalent to --ignore "*/main.rs" if I'm not mistaken.

--ignore "/*" would remove coverage for all files that have absolute path (in this example, i suppose they want to ignore all system library files that happened to get into coverage data)