sonar-scala / sbt-sonar

An sbt plugin which provides an easy way to integrate Scala projects with SonarQube.

Home Page:https://sonar-scala.com/docs/setup/sbt-sonar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No scala files analized?

fgiannetti opened this issue · comments

Hello
First, thanks for you help developing this plugin :)
Now, i run the sonarScan sbt task but no saca files are analized.
This is my conf file:

sonar.projectName=my-app
sonar.projectKey=my-team-app
sonar.sources=app
sonar.scala.version=2.11.1
sonar.host.url=http://backoffice.develop.it/sonarqube/
sonar.java.binaries=target

If i dont include the "sonar.java.binaries" property, the execution fails with: "Please provide compiled classes of your project with sonar.java.binaries property"

When i set that property, the scanner only checks java, js, css and html files. But no scala ones.
This is the output:

[info] Loading project definition from /Users/dev-user/Desarrollo/proyectos/my-app/project
[info] Set current project to my-app (in build file:/Users/dev-user/Desarrollo/proyectos/my-app/)
[info] INFO: Scanner configuration file: /private/tmp/sonar-scanner-3.2.0.1227-macosx/conf/sonar-scanner.properties
[info] INFO: Project root configuration file: /Users/dev-user/Desarrollo/proyectos/my-app/sonar-project.properties
[info] INFO: SonarQube Scanner 3.2.0.1227
[info] INFO: Java 1.8.0_121 Oracle Corporation (64-bit)
[info] INFO: Mac OS X 10.13.6 x86_64
[info] INFO: User cache: /Users/dev-user/.sonar/cache
[info] INFO: SonarQube server 6.7.1
[info] INFO: Default locale: "en_US", source code encoding: "UTF-8"
[info] INFO: Publish mode
[info] INFO: Load global settings
[info] INFO: Load global settings (done) | time=490ms
[info] INFO: Server id: AWHn2LOv4XHqZknEHeot
[info] INFO: User cache: /Users/dev-user/.sonar/cache
[info] INFO: Load plugins index
[info] INFO: Load plugins index (done) | time=325ms
[info] INFO: Process project properties
[info] INFO: Load project repositories
[info] INFO: Load project repositories (done) | time=245ms
[info] INFO: Load quality profiles
[info] INFO: Load quality profiles (done) | time=233ms
[info] INFO: Load active rules
[info] INFO: Load active rules (done) | time=3221ms
[info] INFO: Load metrics repository
[info] INFO: Load metrics repository (done) | time=236ms
[info] INFO: Project key: my-app
[info] INFO: ------------- Scan my-app
[info] INFO: Base dir: /Users/dev-user/Desarrollo/proyectos/my-app
[info] INFO: Working dir: /Users/dev-user/Desarrollo/proyectos/my-app/.scannerwork
[info] INFO: Source paths: app
[info] INFO: Source encoding: UTF-8, default locale: en_US
[info] INFO: Load server rules
[info] INFO: Load server rules (done) | time=1059ms
[info] INFO: Index files
[info] INFO: 188 files indexed
[info] INFO: Quality profile for java: Sonar way
[info] INFO: Quality profile for js: Sonar way
[info] INFO: Quality profile for web: Sonar way
[info] INFO: Sensor JavaSquidSensor [java]
[info] INFO: Configured Java source version (sonar.java.source): none
[info] INFO: JavaClasspath initialization
WARN: Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property
[info] INFO: JavaClasspath initialization (done) | time=16ms
[info] INFO: JavaTestClasspath initialization
[info] INFO: JavaTestClasspath initialization (done) | time=1ms
[info] INFO: Java Main Files AST scan
[info] INFO: 2 source files to be analyzed
[info] INFO: Java Main Files AST scan (done) | time=288ms
[info] INFO: 2/2 source files have been analyzed
[info] INFO: Java Test Files AST scan
[info] INFO: 0 source files to be analyzed
[info] INFO: 0/0 source files have been analyzed
[info] INFO: Java Test Files AST scan (done) | time=5ms
[info] INFO: Sensor JavaSquidSensor [java] (done) | time=847ms
[info] INFO: Sensor Embedded CSS Analyzer Sensor [css]
[info] INFO: 36 source files to be analyzed
[info] INFO: Sensor Embedded CSS Analyzer Sensor [css] (done) | time=223ms
[info] INFO: 36/36 source files have been analyzed
[info] INFO: Sensor SmellMeasuresSensor [smells]
[info] INFO: Sensor SmellMeasuresSensor [smells] (done) | time=26ms
[info] INFO: Sensor SonarJS [javascript]
[info] INFO: 1 source files to be analyzed
[info] INFO: Sensor SonarJS [javascript] (done) | time=79ms
[info] INFO: 1/1 source files have been analyzed
[info] INFO: Sensor SonarJS Coverage [javascript]
[info] INFO: Sensor SonarJS Coverage [javascript] (done) | time=2ms
[info] INFO: Sensor FindBugs Sensor [findbugs]
[info] INFO: Loading findbugs plugin: /Users/dev-user/Desarrollo/proyectos/my-app/.scannerwork/findbugs/findsecbugs-plugin.jar
[info] INFO: Findbugs output report: /Users/dev-user/Desarrollo/proyectos/my-app/.scannerwork/findbugs-result.xml
The following classes needed for analysis were missing:
scala.runtime.AbstractFunction0
scala.Serializable
scala.runtime.AbstractFunction1
scala.runtime.AbstractFunction2
com.despegar.routing.filter.ComponentProvider
scala.runtime.AbstractFunction0$mcV$sp
play.api.mvc.WithFilters
com.myproject.routing.filter.HeadersFilter
.....
.....
.....
[info] INFO: Sensor FindBugs Sensor [findbugs] (done) | time=56757ms
[info] INFO: Sensor SurefireSensor [java]
[info] INFO: parsing [/Users/dev-user/Desarrollo/proyectos/my-app/target/surefire-reports]
[info] INFO: Sensor SurefireSensor [java] (done) | time=4ms
[info] INFO: Sensor JaCoCoSensor [java]
[info] INFO: Sensor JaCoCoSensor [java] (done) | time=1ms
[info] INFO: Sensor SonarJavaXmlFileSensor [java]
[info] INFO: Sensor SonarJavaXmlFileSensor [java] (done) | time=2ms
[info] INFO: Sensor Web [web]
[info] INFO: Sensor Web [web] (done) | time=337ms
[info] INFO: Sensor Snyk Dependency Check Sensor [despegardepcheck]
[info] INFO: Snyk installation OK. Executing plugin.
[info] INFO: Sensor Snyk Dependency Check Sensor [despegardepcheck] (done) | time=20ms
[info] INFO: Sensor Retirejs Dependency Check Sensor [despegardepcheck]
WARN: Retire command not found
[info] INFO: Sensor Retirejs Dependency Check Sensor [despegardepcheck] (done) | time=14ms
[info] INFO: Sensor Zero Coverage Sensor
[info] INFO: Sensor Zero Coverage Sensor (done) | time=46ms
[info] INFO: Sensor CPD Block Indexer
[info] INFO: Sensor CPD Block Indexer (done) | time=18ms
[info] INFO: SCM provider for this project is: git
[info] INFO: 38 files to be analyzed
[info] INFO: 38/38 files analyzed
[info] INFO: 6 files had no CPD blocks
[info] INFO: Calculating CPD for 33 files
[info] INFO: CPD calculation finished
[info] INFO: Analysis report generated in 221ms, dir size=220 KB
[info] INFO: Analysis reports compressed in 319ms, zip size=118 KB
[info] INFO: Analysis report uploaded in 1660ms
[info] INFO: ANALYSIS SUCCESSFUL, you can browse http://backoffice.develop.it/sonarqube/dashboard/index/my-app
[info] INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
[info] INFO: More about the report processing at http://backoffice.develop.it/sonarqube/api/ce/task?id=AWZeAEaDPe2FC9iyiYIB
[info] INFO: Task total time: 1:08.725 s
[info] INFO: ------------------------------------------------------------------------
[info] INFO: EXECUTION SUCCESS
[info] INFO: ------------------------------------------------------------------------
[info] INFO: Total time: 1:11.792s
[info] INFO: Final Memory: 34M/1593M
[info] INFO: ------------------------------------------------------------------------
[success] Total time: 73 s, completed Oct 10, 2018 9:42:48 AM

The line that call my atention is:
[info] INFO: 188 files indexed
Because I have 188 scala files

In the sonar report none Scla references appears
I missing something?
Thanks in advance for your help!

It looks like you don't have a Scala plugin installed in your SonarQube instance - see https://github.com/mwz/sonar-scala for the instruction on how to set it up.

I suspected that could be that.
Thank you very much for the super fast response ;)
Maybe you could include this clarification in the doc? To prevent another goofies like me ask the same question hahaha.
Tanks!