False positive on "Zero should not be a possible denominator java:S3518"

  • ALM used - Azure DevOps
  • CI system used - Azure DevOps
  • Scanner command used - just a step in yaml -
    • task: Maven@4
      mavenPomFile: ‘pom.xml’
      options: ‘-DskipTests’
      publishJUnitResults: false
      javaHomeOption: ‘JDKVersion’
      jdkVersionOption: ‘1.17’
      mavenVersionOption: ‘Default’
      mavenAuthenticateFeed: false
      effectivePomSkip: false
      sonarQubeRunAnalysis: true
      sqMavenPluginVersionChoice: ‘latest’
  • Languages of the repository - java
  • Error observed
    I have this code -
    private static final double FEET_FACTOR = 0.3048;
    private double calculateMetersToFeet(double height) {
    	return height / FEET_FACTOR;
    I got the sonar error java:S3518 on height / FEET_FACTOR although FEET_FACTOR is constant and initiate with none 0 value.

Hey @Tamir_Adler,

Thanks for the report! It’s indeed an FP… and that’s amazing we encounter this one only now, years after initial implementation. Here is the ticket for it: SONARJAVA-4592


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