- ALM: Github
- CI system: cloud build
Hey, I’m trying to run sonar cloud’s code analysis to get the coverage percentage of new files (new in this case refering only to files updated in the current pull request) but it seems to always analyze some old files that were already merged
my yaml file
steps:
- name: 'gcr.io/cloud-builders/yarn:lts'
entrypoint: 'yarn'
args: ['install', '--frozen-lockfile']
id: 'Install dependencies'
secretEnv: ['GITHUB_TOKEN']
- name: 'gcr.io/cloud-builders/yarn:lts'
entrypoint: 'yarn'
args: ['prisma:generate']
id: 'Prisma generate'
secretEnv: ['GITHUB_TOKEN']
- name: 'gcr.io/cloud-builders/yarn:lts'
entrypoint: 'bash'
env: ['NODE_OPTIONS=--max_old_space_size=8192']
args: ['-c', 'yarn vitest run --coverage --testTimeout=10000']
id: 'Test and coverage'
secretEnv: ['GITHUB_TOKEN']
- name: 'sonarsource/sonar-scanner-cli:latest'
entrypoint: 'bash'
args:
- '-c'
- |
sonar-scanner \
-Dsonar.working.directory=/tmp/sonar \
-Dsonar.token=$$SONAR_TOKEN \
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info \
$(test "$_PR_NUMBER" != "" && echo "-Dsonar.pullrequest.key=${_PR_NUMBER} -Dsonar.pullrequest.branch=${_HEAD_BRANCH} -Dsonar.pullrequest.base=${_BASE_BRANCH}")
id: 'SonarCloud Scan'
secretEnv: ['SONAR_TOKEN']