Ignoring Paths
You can use the top-level ignore:
key to tell Codecov to ignore certain paths.
Add a list of paths (folders or file names) to your codecov.yml file under the ignore key to exclude files from being collected by Codecov. Ignored files will be skipped during processing.
Things to note
File paths will be read as regex patterns, so special characters in regex will need to be escaped using
\\
prior to the character, an example being+
which would require\\+
to be processed correctly.The pattern
folder/*
will not match recursively in the folder.
Please use thisfolder/**/*
, which will exclude all files within the given folder.
# sample regex patterns
ignore:
- "path/to/folder" # ignore folders and all its contents
- "test_.*.rb" # regex accepted
- "**/*.py" # glob accepted
The following are examples of different rules and how they behave followed by a corresponding directory with the ignored files called out for clarity.
Ignoring a Specific Folder
This rule will ignore everything in the top level project2 folder and everything underneath it, but will NOT ignore project 2 underneath the src/ folder.
ignore:
- "project2"
Sample file tree:
āāā src/
āāā project1/
āāā 1A.py
āāā 1B.py
āāā 1C.py
āāā coverage/
āāā coverage.xml
āāā project2/
āāā 2A.py
āāā 2B.py
āāā 2C.py
āāā coverage/
āāā coverage.xml
āāā project3/
āāā 3A.py
āāā test_3A.rb
āāā 3B.py
āāā test_3B.rb
āāā 3C.py
āāā test_3C.rb
āāā coverage/
āāā coverage.xml
āāā project2/
āāā 2A.py
āāā 2B.py
āāā 2C.py
āāā coverage/
āāā coverage.xml
Ignored files:
- project2/2A.py
- project2/2B.py
- project2/2C.py
- project2/coverage/coverage.xml
Ignoring Specific Files At All Depths
This rule will ignore any files at any depth that start with "test_" and end with ".rb".
ignore:
- "**/test_*.rb"
Sample file tree:
āāā src/
āāā project1/
āāā 1A.py
āāā 1B.py
āāā 1C.py
āāā project2/
āāā 2A.py
āāā 2B.py
āāā 2C.py
āāā project3/
āāā 3A.py
āāā test_3A.rb
āāā 3B.py
āāā test_3B.rb
āāā 3C.py
āāā test_3C.rb
āāā project4/.
āāā test_4A.rb
āāā test_4B.rb
āāā test_4C.rb
Ignored files:
- src/project3/test_3A.rb
- src/project3/test_3B.rb
- src/project3/test_3C.rb
- project4/test_4A.rb
- project4/test_4B.rb
- project4/test_4C.rb
Ignoring Specific File Types
This rule will ignore any file at any depth that ends in ".py".
ignore:
- "**/*.py"
Sample file tree:
āāā src/
āāā project1/
āāā 1A.py
āāā 1B.py
āāā 1C.py
āāā project2/
āāā 2A.py
āāā 2B.py
āāā 2C.py
āāā project3/
āāā 3A.py
āāā test_3A.rb
āāā 3B.py
āāā test_3B.rb
āāā 3C.py
āāā test_3C.rb
āāā project4/.
āāā test_4A.rb
āāā test_4B.rb
āāā test_4C.rb
Ignored files:
- src/project1/1A.py
- src/project1/1B.py
- src/project1/1C.py
- src/project2/2A.py
- src/project2/2B.py
- src/project2/2C.py
- src/project3/3A.py
- src/project3/3B.py
- src/project3/3C.py
Ignoring Specific File Names
This rule will ignore any files in any folder that have "coverage" as part of the name.
ignore:
- "**/coverage*"
Sample file tree:
āāā src/
āāā project1/
āāā 1A.py
āāā 1B.py
āāā 1C.py
āāā coverage/
āāā coverage.xml
āāā project2/
āāā 2A.py
āāā 2B.py
āāā 2C.py
āāā coverage/
āāā coverage.xml
āāā project3/
āāā 3A.py
āāā test_3A.rb
āāā 3B.py
āāā test_3B.rb
āāā 3C.py
āāā test_3C.rb
āāā coverage/
āāā coverage.xml
āāā project2/.
āāā 2A.py
āāā 2B.py
āāā 2C.py
āāā coverage/
āāā coverage.xml
āāā coverage/
āāā coverage.xml
Ignored files:
- src/project1/coverage/coverage.xml
- src/project2/coverage/coverage.xml
- src/project3/coverage/coverage.xml
- project2/coverage/coverage.xml
- coverage/coverage.xml
Updated 7 months ago