java:S120 triggers when underscores are present (false-positive)

Sonarqube version: * Enterprise Edition * Version 8.9.2 (build 46101)

The java:S120 triggers when the java package name has underscores.
Example: com.sonar.some_package_name

This matches the provided regular expression, ^[a-z_]+(\.[a-z_][a-z0-9_]*)*$, but still triggers the rule. The rule should pass and should have an example with underscores in it.

Java package naming convention for reference: Naming a Package (The Java™ Tutorials > Learning the Java Language > Packages)

Hi Stephen,

I’m not able to reproduce, on my side S120 does not raise an issue on com.sonar.some_package_name using the default configuration of the rule.
Could you check the issue message or the rule configuration, does it show the same regular expression pattern as the one you mention above?

The default pattern: BadPackageNameCheck.java:36
The rule logic: BadPackageNameCheck.java:60