Scala project getting analysed as java

Hello,

We are using SonarQube LTS 7.9.6 in our environment.

A Scala based project is showing bugs related to Java where the code is made in Scala 2.11

We were using below property in previous version of SonarQube(7.1) and it worked fine without any issues:
<sonar.language>scala</sonar.language>

We learnt that this property is deprecated in SonarQube 7.9.6.
Do we have any alternate mechanism in place to ensure that project is analysed by scala explicitly ?

Attaching screenshot for the reference.

Note: We cannot use exclusion property since we do not have any java files in our project.

Thanks,
Vaibhav Jariwala

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

7.9.6 → 8.9.4 → 9.2.2 (last step optional)

You may find the Upgrade Guide and the LTS-to-LTS Upgrade Notes helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us.

 
Ann

Hi @ganncamp ,

We have upgraded sonar from 7.9.6 to 8.9.6. We are still facing the same issue.

Hi Vaibhav,
Could you share the detail of one java issue to better understand it?
It would be interesting to know if issues are really on *.java files and not on *.xml (because the java analyzer (< 7.6) also reports issues on XML files related to the java ecosystem)

1 Like

Hi @alban.auzeill @ganncamp ,

We have pure scala based project and there is no .java file in the project. Please find attached screenshot for java rules that is being applied to .scala files.

Above screenshot depicts one of java rules being applied. There are n numbers of other java rules being applied as well.

Thanks,
Vaibhav Jariwala

Hey there.

This is happening due to a pecularity of spotbugs/sonar-findbugs (a community-supported plugin not developed, maintained or supported by SonarSource) which declares that it can analyze Scala but simply runs all of its Java rules on this code.

I’d suggest…

  • raising an issue with the maintainer
  • creating a new (possibly empty) Quality Profile for Java that you assign to this project
  • remove the Findbugs plugin from your SonarQube installation

Creating new empty Quality Profile for Java and assigning it explicitly to concerned project resolved the issue. Thanks. @Colin