I’m running the sonarqube command using an npx command from a Dockerfile, but Sonar isn’t flagging all issues.
Locally from a Windows Command prompt using the exact same command flags the issues correctly.
The npx command is shown below with the details omitted.
The local version successfully flags a missing import (unused-import rule) but the Docker one doesn’t.
Docker will flag up other issues, but local flags everything it should.
In the logs it can be seen that Local is using linterId “default” whereas Docker is using linterId “unchanged”.
The Local one also shows that it’s saving the unused-import issue whereas the Docker one doesn’t.
I can include more log details if required but it contains information I don’t want to publish.
npx sonarqube-scanner -Dsonar.projectKey="*****" -Dsonar.projectName="*****" -Dsonar.organization="*****" -Dsonar.host.url="https://sonarcloud.io" -Dsonar.token="*****" -Dsonar.pullrequest.base="master" -Dsonar.pullrequest.branch="My/testbranch" -Dsonar.pullrequest.key="*****" -Dsonar.pullrequest.provider="vsts" -Dsonar.pullrequest.vsts.instanceUrl="https://dev.azure.com/cappco/" -Dsonar.pullrequest.vsts.project="*****" -Dsonar.pullrequest.vsts.repository="*****"
Snippets from local log (verbose):
09:19:32.499 DEBUG: Cache entry extracted for key 'js:filemetadata:10.11.1.25225:*****:<myfilepath>/branding.service.ts'
09:19:32.500 DEBUG: Cache strategy set to 'WRITE_ONLY' for file '<myfilepath>/branding.service.ts' as the current file is changed
09:19:32.500 DEBUG: Analyzing file: file:///<myfilepath>/branding.service.ts
09:19:32.502 DEBUG: Analyzing file "<myfilepath>/branding.service.ts" with linterId "default"
09:19:32.806 DEBUG: Parsing <myfilepath>/branding.service.ts with @typescript-eslint/parser
09:19:32.806 DEBUG: Using linter configuration for {"fileType":"MAIN","language":"ts"}
09:19:32.811 DEBUG: Saving issue for rule unused-import on file <myfilepath>/branding.service.ts at line 4
09:19:32.846 DEBUG: Saving issue for rule unused-import on file <myfilepath>/branding.service.ts at line 4
09:19:32.856 DEBUG: Cache entry created for key 'jssecurity:ucfgs:SEQ:10.11.1.25225:*****:<myfilepath>/branding.service.ts' containing 1 file(s)
Snippets from log via docker (verbose):
2024-02-09T09:30:34.3757121Z e[90m09:30:34e[0me[90m [e[0me[97;1mDBGe[0me[90m] e[0m#19 37.94 09:30:34.205 DEBUG: Cache strategy set to 'WRITE_ONLY' for file '<myfilepath>/branding.service.ts' as the current file is changede[0m
2024-02-09T09:30:34.3757730Z e[90m09:30:34e[0me[90m [e[0me[97;1mDBGe[0me[90m] e[0m#19 37.94 09:30:34.205 DEBUG: Analyzing file: file://<myfilepath>/branding.service.tse[0m
2024-02-09T09:30:34.3758339Z e[90m09:30:34e[0me[90m [e[0me[97;1mDBGe[0me[90m] e[0m#19 37.95 09:30:34.220 DEBUG: Analyzing file "<myfilepath>/branding.service.ts" with linterId "unchanged"e[0m
2024-02-09T09:30:35.1381902Z e[90m09:30:35e[0me[90m [e[0me[97;1mDBGe[0me[90m] e[0m#19 38.87 09:30:35.136 DEBUG: Parsing <myfilepath>/branding.service.ts with @typescript-eslint/parsere[0m
2024-02-09T09:30:35.1382951Z e[90m09:30:35e[0me[90m [e[0me[97;1mDBGe[0me[90m] e[0m#19 38.87 09:30:35.136 DEBUG: Using linter configuration for e[0m{"fileType":"MAIN","language":"ts"}e[0m
2024-02-09T09:30:35.2399224Z e[90m09:30:35e[0me[90m [e[0me[97;1mDBGe[0me[90m] e[0m#19 38.91 09:30:35.175 DEBUG: Cache entry created for key 'jssecurity:ucfgs:SEQ:10.11.1.25225:*****:<myfilepath>/branding.service.ts' containing 1 file(s)e[0m