Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SonarQube test coverage issue #1557

Merged
merged 11 commits into from
Dec 13, 2024
Merged

Conversation

StuAA78
Copy link
Contributor

@StuAA78 StuAA78 commented Dec 11, 2024

SonarQube (formerly SonarCloud) recently stopped correctly recognising test coverage. This PR fixes the issue.

Summary

On investigating, we realised that this was due to a fix we'd put in place to work around a SonarQube issue that had now been resolved, and our fix was now causing problems. We therefore remove the fix to ensure SonarQube recognises code coverage again.

Detail

Previously, SonarQube expected the code it analyses to be under the path /github/workspace. However, the lcov.info code coverage report had the code under a different path /home/runner/work/water-abstraction-system/water-abstraction-system. We therefore used sed to replace the original paths in lcov.info with ones under /github/workspace, ensuring that SonarQube correctly picked up code coverage.

Somewhere between 02/12/2024 and 05/12/204, SonarQube started expecting the code to be under the /home/runner/work/water-abstraction-system/water-abstraction-system path. This can be seen by comparing the logs of a previous run to a recent run:

Run dated 02/12/2024

...
15:16:40.334 INFO  Base dir: /github/workspace
...

Run dated 05/12/2024

...
10:04:01.791 INFO  Base dir: /home/runner/work/water-abstraction-system/water-abstraction-system
...

Because our fix changed the file paths to be under /github/workspace, SonarQube no longer recognised the files under /home/runner/work/water-abstraction-system/water-abstraction-system as having code coverage, hence the issue. Removing the fix therefore resolves this.

For some reason, SonarQube (formerly SonarCloud) no longer correctly recognises test coverage. This PR is to investigate and fix the issue.
@StuAA78 StuAA78 added bug Something isn't working housekeeping Refactoring, tidying up or other work which supports the project labels Dec 11, 2024
@StuAA78 StuAA78 self-assigned this Dec 11, 2024
@StuAA78 StuAA78 force-pushed the fix-sonarqube-test-coverage-issue branch from f687dfe to f8f0388 Compare December 11, 2024 17:07
@StuAA78 StuAA78 added the do not merge Used for spikes and experiments label Dec 11, 2024
@StuAA78 StuAA78 removed the do not merge Used for spikes and experiments label Dec 12, 2024
@StuAA78 StuAA78 marked this pull request as ready for review December 12, 2024 12:14
@StuAA78 StuAA78 requested a review from Cruikshanks December 12, 2024 12:14
Copy link
Member

@Cruikshanks Cruikshanks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StuAA78 added a commit to DEFRA/hapi-pg-rest-api that referenced this pull request Dec 13, 2024
Our CI pipeline uses SonarCloud for static code analysis using the `sonarsource/sonarcloud-github-action` action. This has recently been deprecated in favour of `sonarsource/sonarqube-scan-action` following the rebranding of SonarCloud to SonarQube Cloud. This PR therefore makes the required change to `ci.yml`.

We also resolve a code coverage issue by removing a previously-required fix; see DEFRA/water-abstraction-system#1557 for info.
StuAA78 added a commit to DEFRA/water-abstraction-helpers that referenced this pull request Dec 13, 2024
Our CI pipeline uses SonarCloud for static code analysis using the `sonarsource/sonarcloud-github-action` action. This has recently been deprecated in favour of `sonarsource/sonarqube-scan-action` following the rebranding of SonarCloud to SonarQube Cloud. This PR therefore makes the required change to `ci.yml`.

We also resolve a code coverage issue by removing a previously-required fix; see DEFRA/water-abstraction-system#1557 for info.
StuAA78 added a commit to DEFRA/water-abstraction-permit-repository that referenced this pull request Dec 13, 2024
Our CI pipeline uses SonarCloud for static code analysis using the `sonarsource/sonarcloud-github-action` action. This has recently been deprecated in favour of `sonarsource/sonarqube-scan-action` following the rebranding of SonarCloud to SonarQube Cloud. This PR therefore makes the required change to `ci.yml`.

We also resolve a code coverage issue by removing a previously-required fix; see DEFRA/water-abstraction-system#1557 for info.
StuAA78 added a commit to DEFRA/water-abstraction-returns that referenced this pull request Dec 13, 2024
Our CI pipeline uses SonarCloud for static code analysis using the `sonarsource/sonarcloud-github-action` action. This has recently been deprecated in favour of `sonarsource/sonarqube-scan-action` following the rebranding of SonarCloud to SonarQube Cloud. This PR therefore makes the required change to `ci.yml`.

We also resolve a code coverage issue by removing a previously-required fix; see DEFRA/water-abstraction-system#1557 for info.
StuAA78 added a commit to DEFRA/water-abstraction-tactical-crm that referenced this pull request Dec 13, 2024
Our CI pipeline uses SonarCloud for static code analysis using the `sonarsource/sonarcloud-github-action` action. This has recently been deprecated in favour of `sonarsource/sonarqube-scan-action` following the rebranding of SonarCloud to SonarQube Cloud. This PR therefore makes the required change to `ci.yml`.

We also resolve a code coverage issue by removing a previously-required fix; see DEFRA/water-abstraction-system#1557 for info.
StuAA78 added a commit to DEFRA/water-abstraction-tactical-idm that referenced this pull request Dec 13, 2024
Our CI pipeline uses SonarCloud for static code analysis using the `sonarsource/sonarcloud-github-action` action. This has recently been deprecated in favour of `sonarsource/sonarqube-scan-action` following the rebranding of SonarCloud to SonarQube Cloud. This PR therefore makes the required change to `ci.yml`.

We also resolve a code coverage issue by removing a previously-required fix; see DEFRA/water-abstraction-system#1557 for info.
StuAA78 added a commit to DEFRA/water-abstraction-import that referenced this pull request Dec 13, 2024
Our CI pipeline uses SonarCloud for static code analysis using the `sonarsource/sonarcloud-github-action` action. This has recently been deprecated in favour of `sonarsource/sonarqube-scan-action` following the rebranding of SonarCloud to SonarQube Cloud. This PR therefore makes the required change to `ci.yml`.

We also resolve a code coverage issue by removing a previously-required fix; see DEFRA/water-abstraction-system#1557 for info.
StuAA78 added a commit to DEFRA/water-abstraction-service that referenced this pull request Dec 13, 2024
Our CI pipeline uses SonarCloud for static code analysis using the `sonarsource/sonarcloud-github-action` action. This has recently been deprecated in favour of `sonarsource/sonarqube-scan-action` following the rebranding of SonarCloud to SonarQube Cloud. This PR therefore makes the required change to `ci.yml`.

While amending this, we found an unused sonarcloud config file `src/sonar-project.properties`, which we delete.

We also resolve a code coverage issue by removing a previously-required fix; see DEFRA/water-abstraction-system#1557 for info.
StuAA78 added a commit to DEFRA/water-abstraction-ui that referenced this pull request Dec 16, 2024
Our CI pipeline uses SonarCloud for static code analysis using the `sonarsource/sonarcloud-github-action` action. This has recently been deprecated in favour of `sonarsource/sonarqube-scan-action` following the rebranding of SonarCloud to SonarQube Cloud. This PR therefore makes the required change to `ci.yml`.

We also resolve a code coverage issue by removing a previously-required fix; see DEFRA/water-abstraction-system#1557 for info.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working housekeeping Refactoring, tidying up or other work which supports the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants