The provided coverage report generated an empty result


Please I am trying to send a Terraform coverage report to Codacy. I have run checkov and I am even able to save the generated report as an artifact, both in .json and .xml format. However, any attempt to send the same file to Codacy generates the error “The provided coverage report generated an empty result”

Below is a sample of the error I get. Hope you can assist.

2021-08-02 19:23:19.385Z info [ConfigurationRules] API base URL: - (ConfigurationRules.scala:77)
2021-08-02 19:23:19.385Z info [CommitUUIDProvider] CI/CD provider Circle CI found Commit UUID fbb944dde7d86178f871c7031997c2aaf29ff424 - (CommitUUIDProvider.scala:131)
2021-08-02 19:23:19.385Z info [ReportRules] Parsing coverage data from: /tmp/project/report.json … - (ReportRules.scala:43)
2021-08-02 19:23:19.389Z info [ReportRules] Coverage parser used is com.codacy.parsers.implementation.LCOVParser$@5590e542 - (ReportRules.scala:48)
2021-08-02 19:23:19.389Z error [CodacyCoverageReporter] The provided coverage report /tmp/project/report.json generated an empty result. - (CodacyCoverageReporter.scala:25)

Thank you

Hi @Victor_Addison , welcome to the Codacy Community! :wave:

Could you try sending the coverage report providing the correct language name with the flag -l , together with --force-language . For example:

bash <(curl -Ls report \
  -l Terraform --force-language

Hello Madalena,

Thanks for getting in touch. Please I have tried with the -l flag together with --force-language, but unfortunately the result is the same. Below is the setup of my pipeline.

working_directory: /tmp/project
- image:
- checkout
- run:
name: terraform init & plan
command: |
terraform init -input=false
terraform plan -out tfapply -var-file terraform.tfvars
terraform show -json tfapply > tf.json
- persist_to_workspace:
root: .
- .

- image: python:latest
- attach_workspace:
at: .
- run:
name: run-checkov
command: |
pip install checkov
checkov -f tf.json -s > report.json
cat report.json
bash <(curl -Ls report
-l Terraform --force-language -r report.json

I even tried using both the “-l” flag for Terraform together with the report extension as a “.tf” file and also using the “-l” flag with JSON together with the file a “.json” but in both case the result is still the same. I also added a “cat report.json” just to make sure my coverage report actually has data in it before sending, and it displays info, however, I still get the following error - [The provided coverage report generated an empty result]. Hope you can review and maybe see what I may be missing thank you.

Sorry for the confusion on my part - it seems you are trying to upload the output of the Checkov tool as a coverage report. Codacy will not recognise that output as a coverage report and, therefore, it will generate an empty result error from our Coverage Reporter.

In order to generate coverage reports, you must have tests for the languages in your repositories and use tools to generate coverage reports in formats that Codacy supports. Currently, we are not aware of any tool that generates coverage reports for Terraform although there are already some tools looking into this possibility - you can check these GitHub issues from Terratest and Hashicorp for more context on this.

In the meantime, please find below some helpful resources from our official documentation on generating and uploading coverage to Codacy:
Generating coverage reports
Uploading coverage data to Codacy
Alternative ways of running the Codacy Coverage Reporter
Troubleshooting common issues while using the Codacy Coverage Reporter

1 Like