Skip to content

Commit c384c43

Browse files
author
Paulo Ribeiro
authored
Merge pull request #407 from codacy/docs/refactor-coverage-validation-CY-6365
doc: Refactor coverage setup validation CY-6365
2 parents 141522b + 1765796 commit c384c43

File tree

2 files changed

+31
-21
lines changed

2 files changed

+31
-21
lines changed

docs/index.md

+27-17
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ The following table contains example coverage tools that generate reports in for
6565
<tr>
6666
<td>Go</td>
6767
<td><a href="https://blog.golang.org/cover">Golang</a> Code Coverage</td>
68-
<td>Golang report files don't have a specific name. Because of this, later in the setup process you must follow <a href="#submitting-coverage-for-golang">specific instructions</a> while submitting coverage to Codacy.</td>
68+
<td>Golang report files don't have a specific name. Because of this, later in the setup process you must follow <a href="uploading-coverage-in-advanced-scenarios/#golang">specific instructions</a> while submitting coverage to Codacy.</td>
6969
</tr>
7070
<tr>
7171
<td rowspan="2">Java</td>
@@ -197,41 +197,51 @@ The recommended way to do this is by using a CI/CD platform that automatically r
197197
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r <coverage report file name>
198198
```
199199

200-
Check the console output to validate that the Codacy Coverage Reporter **detected the correct commit UUID** and **successfully uploaded** the coverage data to Codacy. If you need help, [check the troubleshooting page](troubleshooting-common-issues.md) for solutions to the most common setup issues.
200+
Check the console output to validate that the Codacy Coverage Reporter **detected the correct commit SHA-1 hash** and **successfully uploaded** the coverage data to Codacy. If you need help, [check the troubleshooting page](troubleshooting-common-issues.md) for solutions to the most common setup issues.
201201

202202
!!! note
203203
Be sure to also check the [instructions for more advanced scenarios](uploading-coverage-in-advanced-scenarios.md) while uploading the coverage data to Codacy, such as when running parallel tests, using monorepos, or testing source code in multiple or unsupported languages.
204204

205-
1. Make sure that Codacy received the coverage data successfully for the **correct commit UUID and branch**. On Codacy, open your **Repository Settings**, tab **Coverage**, and observe the list of recent coverage reports in the section **Test your integration**:
205+
## 3. Validating that the coverage setup is complete {: id="validating-coverage"}
206206

207-
![Testing the coverage integration](images/coverage-test-integration.png)
207+
Codacy displays the code coverage in each branch, as well as the evolution of code coverage between commits and the code coverage variation introduced by pull requests.
208208

209-
If you make adjustments to your setup and upload new coverage data, click the button **Test integration** to refresh the table.
209+
Because of this, to ensure that all code coverage metrics are available on Codacy, you must have successfully uploaded coverage data and analyzed:
210210

211-
## 3. Validating that the coverage setup is complete {: id="validating-coverage"}
211+
- The last two commits in each branch
212+
- The common ancestor commit of each pull request branch and its target branch
212213

213-
Codacy displays the code coverage in each branch, as well as the evolution of code coverage between commits and the code coverage variation introduced by pull requests. Because of this, to ensure that all code coverage metrics are available on Codacy, you must have successfully uploaded coverage data and analyzed:
214+
!!! note "Example"
215+
The example below shows that after pushing a commit that correctly sets up coverage on the main branch:
214216

215-
- The last two commits in each branch
216-
- The common ancestor commits between pull request branches and their target branches
217+
- Codacy will report coverage metrics for all subsequent commits and pull requests relative to the main branch
218+
- Codacy won't report coverage metrics for commits and pull requests that are relative to older branches where the coverage setup wasn't performed yet
219+
220+
![Setting up coverage on the main branch](images/coverage-validate.png)
217221

218-
The example below shows that after pushing a commit that correctly sets up coverage on the main branch:
222+
Follow these instructions to validate that your coverage setup is working correctly:
219223

220-
- Codacy will report coverage metrics for all subsequent commits and pull requests relative to the main branch
221-
- Codacy won't report coverage metrics for commits and pull requests that are relative to older branches where the coverage setup wasn't performed yet
224+
1. On Codacy, open your **Repository Settings**, tab **Coverage**, and observe the list of recent coverage reports in the section **Test your integration** to make sure that Codacy received the coverage data successfully for the **[correct commit SHA-1 hash](troubleshooting-common-issues.md#commit-detection) and branch**, and that it processed the coverage data successfully.
222225

223-
![Setting up coverage on the main branch](images/coverage-validate.png)
226+
![Testing the coverage integration](images/coverage-test-integration.png)
227+
228+
If you make adjustments to your setup and upload new coverage data, click the button **Test integration** to refresh the table.
224229

225-
To validate that the coverage setup is complete:
230+
<!--TODO
231+
Link to troubleshooting instructions for each possible error status
232+
-->
226233

227-
1. Wait until there are **at least two commits** that have uploaded coverage data to Codacy and were successfully analyzed by Codacy.
234+
1. Make sure that there are **at least two commits** that uploaded coverage data to Codacy and were successfully analyzed by Codacy.
228235

229236
!!! important
237+
<!--TODO
238+
Move this information to the troubleshooting instructions linked in the previous step, as it is relevant to the error status "Commit not analyzed".
239+
-->
230240
Codacy only takes the uploaded coverage data into account after successfully analyzing each commit.
231241

232242
Make sure that you [invite or ask your team members to join your organization on Codacy](../organizations/managing-people/#adding-people) so that Codacy analyzes their commits on private repositories.
233243

234-
1. Check that Codacy displays the coverage information for the latest commits and pull requests:
244+
1. Check that Codacy displays the coverage information for the latest commits and pull requests.
235245

236246
![Coverage data displayed on Codacy](images/coverage-codacy-ui.png)
237247

@@ -243,6 +253,6 @@ To validate that the coverage setup is complete:
243253
- URL of your repository on Codacy
244254
- Your CI/CD configuration files and the name of your CI/CD platform
245255
- Full console output of your CI/CD when running the Codacy Coverage Reporter
246-
- Branch name and commit UUID corresponding to the CI/CD output
256+
- Branch name and commit SHA-1 hash corresponding to the CI/CD output
247257
- Test coverage report that you're uploading to Codacy
248258
- Any other relevant information or screenshots of your setup

docs/troubleshooting-common-issues.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ If the Codacy Coverage Reporter correctly uploaded your coverage report but the
2121

2222
![Commits that must have coverage data](images/coverage-pr-commits.png)
2323

24-
### Commit SHA hash detection {: id="commit-detection"}
24+
## Commit SHA-1 hash detection {: id="commit-detection"}
2525

26-
The Codacy Coverage Reporter automatically detects the commit SHA hash to associate with the coverage data from the following CI/CD platforms:
26+
The Codacy Coverage Reporter automatically detects the SHA-1 hash of the current commit to associate with the coverage data when you're using one of the following CI/CD platforms:
2727

2828
- Appveyor
2929
- AWS CodeBuild
@@ -48,7 +48,7 @@ The Codacy Coverage Reporter automatically detects the commit SHA hash to associ
4848

4949
If the Codacy Coverage Reporter fails to detect the current commit from the CI workflow context, it will use the current commit from the local Git repository instead.
5050

51-
However, you can also force using a specific commit SHA hash with the flag `--commit-uuid`. For example:
51+
However, you can also force using a specific commit SHA-1 hash with the flag `--commit-uuid`. For example:
5252

5353
```bash
5454
bash <(curl -Ls https://coverage.codacy.com/get.sh) report \
@@ -80,7 +80,7 @@ If you get a `com.fasterxml.jackson.core.JsonParseException` error while uploadi
8080

8181
There are some ways you can solve this:
8282

83-
- Split your coverage reports into smaller files and [upload them to Codacy one at a time](index.md#multiple-reports).
83+
- Split your coverage reports into smaller files and [upload them to Codacy one at a time](../uploading-coverage-in-advanced-scenarios/#multiple-reports).
8484

8585
- **If you're using dotCover to generate coverage reports for your C# projects**, you should [exclude xUnit files](https://www.jetbrains.com/help/dotcover/Running_Coverage_Analysis_from_the_Command_LIne.html#filters_cmd) from the coverage analysis as follows:
8686

0 commit comments

Comments
 (0)