Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build

on:
push:
branches:
- develop
pull_request:
types: [opened, synchronize, reopened]

permissions:
actions: read
contents: read
security-events: write

jobs:
build:
name: Build and analyze
runs-on: macos-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# If you wish to fail your job when the Quality Gate is red, uncomment the
# following lines. This would typically be used to fail a deployment.
# We do not recommend to use this in a pull request. Prefer using pull request
# decoration instead.
# - uses: SonarSource/sonarqube-quality-gate-action@v1
# timeout-minutes: 5
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
17 changes: 17 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# General settings
# sonar.host.url=https://sonarcloud.io
# sonar.organization=adyen
sonar.projectKey=platform-experience-components-web
sonar.sourceEncoding=UTF-8

# Path to sources
sonar.sources=src
sonar.test.inclusions=**/*.test.*
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.

medium

The pattern **/*.test.* is very broad and could match non-test files (e.g., image.test.png). For a TypeScript project, it's better to be more specific with file extensions to ensure only actual test scripts are included.

sonar.test.inclusions=**/*.test.{ts,tsx,js,jsx}

sonar.exclusions=\
mocks/**/*,\
netlify/**/*,\
src/types/**/*,\
static/**/*,\
stories/**/*,\
tests/**/*,\
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.

medium

The tests/**/* exclusion prevents files in a tests directory (e.g., src/tests) from being analyzed by SonarQube. Test files should also be analyzed for code quality, and SonarQube can apply different rules for them. Excluding tests might cause you to miss issues in test code and lose visibility on test metrics. It's recommended to remove this exclusion.

**/types.ts
Loading