Underscores in numeric literals is not supported for Scala

  • versions used (SonarQube, Scanner sonarsource/sonar-scanner-cli:4.7)
  • error observed
    Underscores in numeric literals is not supported. For example this file:
package com.zego.mapmatching

object test {
  val somevalue: Int = 10_000

line 4 is reported as a Code Smell (parsing error) because of the underscore although it is valid syntax

  • potential workaround
    Remove the underscore?

Hey there.

This was fixed in SonarQube v9.3 with an update to the underlying Scala parser (SONARSLANG-541). I just tested your reproducer locally and it scanned without any parsing errors!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.