Can i run sonarscanner purely local without sonarqube?

Must-share information (formatted with Markdown):

  • SonarQube 5.8, Scanner 4.7
  • I want to make a dry run with the sonarscanner to see if the sonarscanner run would work. So i don’t want to upload the result to any Sonarqube instance. I run into the problem, that the key property is required. Is there a dry run option? Or a work around?
(/k:<project-key> [required] Specifies the key of the analyzed project in SonarQube)

  • I tried removing the key and giving a random key

You could use SonarLint for visual studio which should give you similar results (depending on the version of the scanner compared to the one on the server)

Or you could spin up sonarqube locally in a docker container and set up a project there and publish the results into that.

I read something about a dry run plugin, but can not find it in the marketplace.

The SonarLint option seems to have a different scope than just testing if sonarscanner would run properly.

Starting a local sonarqube session would solve the problem, but seems to be a pretty complex job for just testing if everything works as expected.

I need this to check if everything works as expected after updating sonarqube or java or other dependencies before i push the update to the pipeline.

I don’t know what you mean about testing if “sonarscanner would run properly” - I assumed you meant would the code pass the quality rules.
If that is what you mean then SonarLint in connected mode essentially does that for you on the fly.
If you mean you want to check if it could execute correctly and upload the results to the server instance (regardless of whether the code passes or fails the quality gates) then, aside from running an instance locally, you could create a test project in your existing instance and upload to that by specifying a different project key,

There doesn’t seem to be a “dry run” option as evidenced by this conversation about same: Scanner: Allow dryrun flag - #3 by Chris