codacy / docs

Codacy documentation
https://docs.codacy.com
Other
20 stars 38 forks source link

[DOCS-207] Feedback on "Adding coverage to your repository" #479

Open tarvinder1 opened 3 years ago

tarvinder1 commented 3 years ago

Type of feedback

Feedback The page doesnt specify from which location Codacy Coverage Reporter is to be run. Also what is the name of the report file which the tool is expecting to work on

Affected pages This feedback applies to the following documentation pages / URLs: https://docs.codacy.com/coverage-reporter/adding-coverage-to-your-repository/

github-actions[bot] commented 3 years ago

Internal Jira issue: DOCS-207

tarvinder1 commented 3 years ago

I have figured out the right way. To run the report, the name of the file is given via -r flag. The report could be stored in the subfolder but it needs to be within the Git repository(and correctly checked out branch)

bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml

Also, I found this command failing when its specified in the buildspec.yaml file for aws code build projects. I had to split the command to 2 as it was reporting syntax errors.

prcr commented 3 years ago

Thanks for the extra information @tarvinder1! I will propose some improvements to the documentation soon taking into account your feedback.

prcr commented 3 years ago

We made the improvements in https://github.com/codacy/codacy-coverage-reporter/pull/300 to address your feedback, @tarvinder1. Please have a look if you have the time.

Regarding the issue of the syntax errors when running the command bash <(curl -Ls https://coverage.codacy.com/get.sh) report, we have a page suggesting alternative ways of running the Codacy Coverage Reporter. Your workaround is not included on that page, but if you're able to provide us with the exact error that you were getting, perhaps I can include a new entry on the troubleshooting page instead.

tarvinder1 commented 3 years ago

Here is the error received while running the command on ubuntu containers. This extract is from aws codebuild project which uses aws codebuild image built on ubuntu containers.

1001 | [Container] 2021/02/22 17:15:09 Running command (bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml) 1002 | /codebuild/output/tmp/script.sh: 4: /codebuild/output/tmp/script.sh: Syntax error: "(" unexpected 1003 |   1004 | [Container] 2021/02/22 17:15:09 Command did not exit successfully (bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml) exit status 2 1005 | [Container] 2021/02/22 17:15:09 Phase complete: POST_BUILD State: FAILED 1006 | [Container] 2021/02/22 17:15:09 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: (bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.xml). Reason: exit status 2

Might be some shell interpretation issue or some internal subcommand not being recognized on container. The same thing worked when I split the command like this: $ curl -sL https://coverage.codacy.com/get.sh -o get.sh && chmod +x ./get.sh $ ./get.sh report -r coverage.xml