I might be missing something obvious, but I can’t seem to get scan results for javascript to appear in SonarCloud. The repository is 95% an angular app with 5% java code. The java code scan is appearing in SonarCloud, but really I only need to scan the javascript in the angular application.
So clearly we are connected to SonarCloud, but nothing appears for the javascript.
I added <sonar.language>js</sonar.language>
to the pom.xml file, which has had the effect that no scan information at all appears in SonarCloud, presumably because this property cancels scanning any language other than javascript, and the javascript scan isn’t configured correctly.
I just want to scan the angular project and report results in SonarCloud. Either by scanning the dist/portal
directory where the angular project is built, or by scanning the underlying Typescript files in src/app
.
It’s fine if the java code is also scanned.
Thanks for any help or pointers you can provide.
- ALM used: Bitbucket with Maven
- Languages of the repository: java, javascript (only need to scan the javascript)
- Error observed: No scan results for javascript appearing in SonarCloud
The directory structure of the repository is:
- src
- app
- [rest of angular code]
- e2e
- [testing files]
- deploy
- pom.xml
- [java code for the deploy]
- pipelines.yml
This is the pipeline.yml, and the step that uses maven to run sonarcloud:
caches:
sonar: ~/.sonar/cache
steps:
- step: &buildArtifacts
name: Build and test
image:
name: 604999277007.dkr.ecr.us-west-2.amazonaws.com/sky_falcon_build:1.0.1
aws:
access-key: $AWS_ACCESS_KEY
secret-key: $AWS_SECRET_KEY
caches:
- maven
- sonar
script:
- source prepare_environment.sh
- mvn -e clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
- source ../archive.sh ${RELEASE_TAG}
- source ../make_rpm.sh ${RELEASE_TAG}
- cd -
- mkdir artifact
- cp /root/rpmbuild/driver-portal-build/*.tar.gz ./artifact
- cp /root/rpmbuild/driver-portal-build/*.rpm ./artifact
artifacts:
- artifact/**
And this is the properties inside the pom.xml
in the deploy/
directory:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<sonar.language>js</sonar.language>
<sonar.sources>${project.basedir}/../dist/portal</sonar.sources>
</properties>