Hi,
We have an angular project on bitbucket and I am trying to use the docker sonar-scanner via bitbucket pipeline
- step: &sonar-cloud-scan
name: Sonar Cloud Scan
image: atlassianlabs/docker-node-jdk-chrome-firefox
size: 2x
clone:
depth: full
script:
- ls ${BITBUCKET_CLONE_DIR}
- docker run \
--rm -e SONAR_HOST_URL="${SONAR_HOST_URL}" \
-e SONAR_SCANNER_OPTS="-Dsonar.projectKey=${SONAR_PROJECT_KEY}-${BITBUCKET_BRANCH} -Dsonar.projectName=${SONAR_PROJECT_KEY}-${BITBUCKET_BRANCH} -Dproject.settings=./sonar.properties" -e SONAR_LOGIN="${SONAR_TOKEN}" \
-v ${BITBUCKET_CLONE_DIR}
sonarsource/sonar-scanner-cli
services:
- docker
I specify -v ${BITBUCKET_CLONE_DIR} because ${BITBUCKET_CLONE_DIR} is the directory where the source code is cloned by bitbucket
But when I go to our sonar dashboard we see “The main branch has no lines of code”
In my bitbucket build log I do an ls ${BITBUCKET_CLONE_DIR} which shows code is there
ls ${BITBUCKET_CLONE_DIR}
<1s
+ ls ${BITBUCKET_CLONE_DIR}
README.md
angular.json
bitbucket-pipelines.yml
browserslist
debug.log
karma.conf.js
package-lock.json
package.json
proxy.conf.json
proxy.js
sonar.properties
src
tsconfig.app.json
tsconfig.json
tsconfig.spec.json
tslint.json
sonar.properties file content is
sonar.sourceEncoding=UTF-8
sonar.sources=src
sonar.exclusions=**/node_modules/**,**/src/environments/**
sonar.coverage.exclusions=src/environments/**/*
sonar.tests=src
sonar.test.inclusions=**/*.spec.ts
sonar.javascript.lcov.reportPaths=coverage/sml-customer-web/lcov.info
sonar.scm.provider=git
pipelineLog-{afb2781b-6efe-4d2e-9ace-71155688482b}.txt (9.0 KB)