Pull Request analysis seems to scanning all files

We have a large Vue JS project and we have enabled Pull Request analysis using SonarCloud. Should the PR analysis scan only the files changed in the PR? Or does it scan all the files based on New Code definition? From what we observe, it looks like SonarCloud is scanning all files based on tsconfig.json instead of the files changed in the PR. So regardless of the number of files changed in the PR, SonarCloud scan always takes a long time (up to 30 minutes) to complete. Is this expected or are we missing some settings / configurations?

Hi @tsriram and welcome to our Community!

Please can you share more information about how your project is analysed:

  • Do you use automatic analysis or a CI
  • If you use a CI, how is the configuration for the scanner execution?

Scanner execution must be properly set in order to a pull request analysis to be recognised. This kind of issue generally happens when a CI is used and there are any configuration mistakes that prevents properly recognition of a pull request analysis scenario.

Additionally, it is possible to tell me an analysis task ID of any analysis related to this problem?

Hello @tsriram,

This is part of our 2022 objectives to be able to analyze only files changed in the PR and no longer the entire project.

Can you share the number of LOCs of JS or TS you have today in your project? I’m surprised about the 30min analysis time you are facing.

Thanks
Alex

Thank you @Alexandre_Holzhey and @Alexandre_Gigleux.

@Alexandre_Holzhey - we use CI (GitHub Actions). Can you please point me to any resources on how to verify if we’ve set up Scanner execution correctly?

@Alexandre_Gigleux Looking forward to this in 2022 - would be a great value add. Average time is currently 15-20 minutes. Our project has 286k LOC.

It should be enough to follow the in-product tutorial. Please check the documentation.

Additionally, you can take a look in a small project i use for testing (PHP + VueJS). I tested it with a PR where i changed one line and only one file was analysed. Hope that helps!

I’m encountering this same issue right now. I made some changes to our SonarCloud linting rules within the web UI and now all of a sudden, our scans are running against every file in the repo instead of just the changes submitted in the PR. Any idea what’s up with that and how to resolve it?

@Alexandre_Holzhey might you be able to help me figure out what’s going on here? my configuration of sonarcloud worked perfectly the day before yesterday.