NextJS, SonarCloud and Bitbucket scans crashing

Victor do you know date or issue we can follow for tracking changes for this performance issue? Thanks

Hi @tredfield,

we recently reverted some changes in the JS/TS analyzer that had an impact on performance. This new release was deployed yesterday on SonarCloud. Still, we are aware that for some kinds of projects the performance is still under par. Especially for Vue projects we still need to improve how the analysis is done. And for very large projects we are still limited by how Typescript handles program creation.

If you want to track changes, you can check the github page for current milestones planned:

But, after just releasing the changes to improve some bottlenecks for the performance, we are focusing now on adding new rules.

In any case, there should always be possible to come up with a sonar.properties together with a set of custom tsconfig.json files which limits program creation size to a subset of the project, which would dramatically improve scan times.

For example:

my-app/
├─ app1/
│  ├─ tsconfig.sonar.json
├─ app2/
│  ├─ tsconfig.sonar.json
├─ ...
├─ tsconfig.json

and using

sonar.typescript.tsconfigPaths=my-app/app1/tsconfig.sonar.json,my-app/app2/tsconfig.sonar.json

would avoid the analyzer picking up the base tsconfig.json which may be including too many files if a project is very big and creates memory issues. Splitting the project into many tsconfig files should help in that case.

We are very aware that this tweaking is not ideal and at some point, we would like to have this managed automatically by the analyzer.

Hope this helps.

Cheers,
Victor

2 Likes

Hi @victor.diez ,

First the bad news - the 2.0.0 version of SonarScan docker still hangs for hours…

BUT… the good news is one of our developers went ‘old school’ and has apparently fixed the problem for us.

Our new Scan step looks like this:

         - export SONAR_SCANNER_VERSION=5.0.1.3006
          - export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
          - curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
          - unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
          - export PATH=$SONAR_SCANNER_HOME/bin:$PATH
          - sonar-scanner -Dsonar.token=$SONAR_TOKEN -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.organization=$SONAR_ORG -Dsonar.qualitygate.wait=true

This has succeeded consistently (and gives us full reporting as we’d expect) - may be useful to others with a similar problem…

1 Like