How to scan a local project?

  • SonarQube Community Build
  • Docker
  • Scan local repo (in VSCode)
  • Create new project in SonarQube, Connect from VS Code to that project

This is driving me nuts lol.

I just want to scan a local project with sonarqube. I do not want GitHub, and whatever else online/cloud eyes on this.
I use a self-hosted SonarQube Community server (updated today)
I already have an existing connection from my VSCode to it because I do analyze other projects (which are on github) with it too.
So I went into my sonarqube instance, added a project (call it My Project) and then in VS Code I opened my local project, I went to SonarQube setup section, I chose my existing connection, I added a project and selected the one I just created in SonbarQube

At the bottom of visual code it says “scanning 11 files” so I thought wow, fast and cool.

yet, zero issues found, so, no, this can’t be: I am not writing pixel perfect code.
Going back to SonarQube I see I am supposed to install some pip install pysonar and then run a terminal command
```

pysonar \
  --sonar-host-url=https://my-host.com \
  --sonar-token=my_token \
  --sonar-project-key=My Project
```

??? I am confused.
Why can I not analyze from the comfort of the VS UI as I do with all other projects (which have a Github instance)?
Why does it say “scanning 11 files” but clearly doesn’t?

How do I actually use SonarQube locally without going an installing new packages for each new project (which might have different languages), and avoid use terminal, since I have the VisuaCode extension of SonarQube?

… I cannot even connect it with GitHub since it does not allow me to add more than one GitHub org to the sonarqube instance?!

I am sorry but either the tool is extremely limited and basically useless for anything larger than a hobby instance or… I miss something

I was using sonar cloud before, and there I could at least use more than one org from GitHub?
That was at no add-on cost I believe, why would I not be allowed to do this on the self hosted instance?

Hi,

You’ve conflated two different things. You can use SonarQube for IDE in VS Code to check your coding as you type. Doing so will not make the project show up in SonarQube Community Build.

For that, you’ll need to run a (yes) command-line analysis. Don’t forget to include, at minimum, the mandatory analysis parameters.

 
HTH,
Ann