Skip to content

Initialize Sonarcloud for test coverage and code quality reports#218

Merged
nikomakela merged 3 commits into
mainfrom
HCRC-186-init-sonarcloud
Dec 9, 2025
Merged

Initialize Sonarcloud for test coverage and code quality reports#218
nikomakela merged 3 commits into
mainfrom
HCRC-186-init-sonarcloud

Conversation

@nikomakela

@nikomakela nikomakela commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

HCRC-186.

  1. Initialize a Sonarcloud properties file to trigger code quality and test coverage scanning and reporting. The Sonarcloud project can be found in https://sonarcloud.io/project/overview?id=city-of-helsinki_react-helsinki-headless-cms.
  2. Start using the city of Helsinki common workflows for CI and stable releases. NOTE: Canary release not yet supported by the common templates. Templates are available in https://github.com/City-of-Helsinki/.github/blob/main/.github/workflows/.

@github-advanced-security

Copy link
Copy Markdown

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@nikomakela

Copy link
Copy Markdown
Contributor Author

I expect that we need to transfer the NPM project to some other organisation in order to get the common publish template to work.

@nikomakela

Copy link
Copy Markdown
Contributor Author

I think we should also setup a release please process for this repo. Sure it isn't mandatory to be done in this PR, but it would make this repo more consistent with other.

Release please would handle

  1. the version numbering
  2. git tag creation
  3. writing the changelog

What do you think @terovirtanen and @karisal-anders ?

Comment thread sonar-project.properties Outdated
sonar.sourceEncoding=UTF-8

# Paths to exclude from analysis
sonar.exclusions=**/node_modules/**,**/dist/**,**/lib/**,**/coverage/**,**/.storybook/**,**/scripts/**,**/*.js,**/*.d.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

.js files could be included, there aren't many of them

Comment thread sonar-project.properties Outdated

# Paths to test files
sonar.tests=src
sonar.test.inclusions=src/**/*.test.ts,src/**/*.test.tsx,src/**/__tests__/**/*.{ts,tsx},src/tests/**/*.{ts,tsx}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The src/tests doesn't seem to be a test directory, it only has apolloConfig.tsx and hideConsoleMessages.tsx. Maybe the directory could be renamed to something else to make it clearer as to what it is. Because of this src/tests doesn't seem to be useful to include here.

@karisal-anders karisal-anders left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left some comments. Please take a look at them.

@nikomakela nikomakela marked this pull request as ready for review December 8, 2025 13:58
@karisal-anders

Copy link
Copy Markdown
Contributor

I think we should also setup a release please process for this repo. Sure it isn't mandatory to be done in this PR, but it would make this repo more consistent with other.

Release please would handle

  1. the version numbering
  2. git tag creation
  3. writing the changelog

What do you think @terovirtanen and @karisal-anders ?

I'm slightly eager to get the SonarCloud coverage & reporting into main branch, so because of that I think it'd be better to split that to another PR.

@terovirtanen

Copy link
Copy Markdown

I think we should also setup a release please process for this repo. Sure it isn't mandatory to be done in this PR, but it would make this repo more consistent with other.

Release please would handle

  1. the version numbering
  2. git tag creation
  3. writing the changelog

What do you think @terovirtanen and @karisal-anders ?

I agree. release-please example can be found from https://github.com/City-of-Helsinki/react-helsinki-notification-manager/blob/0fcf09a90576c7669b0edfe08c36429f6a506772/.github/workflows/release-please.yml

@nikomakela

nikomakela commented Dec 9, 2025

Copy link
Copy Markdown
Contributor Author

I can merge this so we get the sonar cloud running, as @karisal-anders suggested. I'll start to setup release-please next @terovirtanen .

HCRC-186.

Modify the existing CI workflow configurations so that they use the city
of Helsinki common workflows available in
github.com/City-of-Helsinki/.github/blob/main/.github/workflows/.
@nikomakela nikomakela force-pushed the HCRC-186-init-sonarcloud branch from 282b260 to 17186b7 Compare December 9, 2025 07:22
@nikomakela nikomakela merged commit 15b9107 into main Dec 9, 2025
3 checks passed
@nikomakela nikomakela deleted the HCRC-186-init-sonarcloud branch December 9, 2025 07:23
@sonarqubecloud

sonarqubecloud Bot commented Dec 9, 2025

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
4 Security Hotspots
28.4% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants