Non-null assertions being reported as redundant

Here’s the repo: GitHub - lauraseidler/sonarqube-redundant-non-null-assertions

However, I’m also failing to reproduce this with my local sonarqube + sonar scanner.

This code smell shows up when I run the build through our Jenkins, connected to our actual sonarqube instance (running the developer edition of sonarqube):

This code smell does not show up in either of these cases:

  • running with a locally installed sonar-scanner against a local sonarqube instance (community edition in docker)
  • running with a locally installed sonar-scanner against our actual sonarqube instance
  • running sonar-scanner in a docker container using the same image as Jenkins uses to spin up the container to run in CI (sonarsource/sonar-scanner-cli:4.6)

So the only differences seem to be:

  • Jenkins uses the SonarQube Scanner plugin and withSonarQubeEnv around the step that runs the scan, while locally I am passing sonar.host.url and sonar.login parameters to sonar-scanner
  • Jenkins might differ slightly on git things (sparse checkout, setting some environment variables)

The issue might well be with out setup, though I’m failing to see where this could be. I’m happy to provide debug logs or any further information.