SonarCloud action scan is slow with node_modules

We’re using the SonarCloud GitHub action as part of our CI process, and I’ve noticed we have a major slowdown specifically for the SonarCloud scan step.

Previously, we had the install, build and test CI steps inside a docker image, and all node_modules were installed in a docker image. At this time, a sonar scan was ~3-4 minutes, which is expected according to this chart.

We refactored the CI a bit, so the install, build and test steps are now done in a GitHub image (/github/workspace). So, the analysis went from ~3min to ~10-15min:

So, I added these two steps that delete node_modules and dist folders:
Screenshot 2022-12-12 at 18.26.01

And the scan goes back to normal time:

Am I doing something wrong? Adding node_modules to sonar.exclusions didn’t really help (I thought it’s excluded by default)

Hello Stefan,

Thank you for notifying us about this behaviour.

Could you provide us with the logs of the scanner?

You can post them right here.

Best Regards,
Ilia