Skip to content
This documentation applies to Codacy Self-hosted v11.0.0

For the latest updates and improvements, see the latest Cloud documentation instead.

Uploading coverage in advanced scenarios#

The following sections include instructions on how to use the Codacy Coverage Reporter to upload coverage data in more advanced scenarios.

Uploading multiple coverage reports for the same language#

If your test suite is split in different modules or runs in parallel, you must upload multiple coverage reports for the same language either at once or in sequence.

Tip

Alternatively, it might also be possible to merge the coverage reports before uploading them to Codacy, since most coverage tools support merging or aggregating the coverage data. For example, use the merge mojo for JaCoCo.

Uploading all reports at once#

Upload multiple partial coverage reports with a single command by specifying each report with the flag -r. For example:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
    -l Java -r report1.xml -r report2.xml -r report3.xml

You can also upload all your reports dynamically using the command find. For example:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
    -l Java $(find . -name 'jacoco*.xml' -printf '-r %p ')

Uploading reports in sequence#

Upload multiple partial coverage reports in sequence:

  1. Upload each report separately with the flag --partial.

    If you're sending reports for a language with the flag --partial, you must use the flag in all reports for that language to ensure the correct calculation of the coverage.

  2. Notify Codacy with the final command after uploading all reports.

For example:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
    --partial -l Java -r report1.xml
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
    --partial -l Java -r report2.xml
bash <(curl -Ls https://coverage.codacy.com/get.sh) final

Uploading the same coverage report for multiple languages#

If your test suite generates a single coverage report for more than one language, you must upload the same coverage report for each language.

To do this, upload the same report multiple times, specifying each different language with the flag -l. For example:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
    --partial -l Javascript -r report.xml
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
    --partial -l TypeScript -r report.xml
bash <(curl -Ls https://coverage.codacy.com/get.sh) final

Uploading coverage for Golang#

Codacy can't automatically detect Golang coverage report files because they don't have specific file names.

If you're uploading a Golang coverage report, you must also specify the report type:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
    --force-coverage-parser go -r <coverage report file name>

Uploading coverage for unsupported languages#

If your language isn't in the list of supported languages, you can still send coverage to Codacy.

To do this, provide the correct language with the flag -l, together with --force-language. For example:

bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
  -l Kotlin --force-language -r <coverage report file name>

See the list of languages that you can specify using the flag -l.

Share your feedback 📢

Did this page help you?

Thanks for the feedback! Is there anything else you'd like to tell us about this page?

We're sorry to hear that. Please let us know what we can improve:

Alternatively, you can create a more detailed issue on our GitHub repository.

Thanks for helping improve the Codacy documentation.

If you have a question or need help please contact support@codacy.com.

Last modified November 29, 2022