SonarCloud Azure Scanner Performance

I’ve got an XL (900KLOC) project we’re building in Azure Pipelines. This is integrated into SonarCloud and has been working well for the last year.

We’ve noticed the duration of our CI build has jumped up dramatically since November 18th.

Our ‘Run Code Analysis’ job used to take on average 5minutes, its now running at closer to 30. This is starting to cause a real problem for us as Pull Requests are backing up.

I’m not sure if it’s related but we’re starting to see errors in the code analysis log as well, log extract (with filenames redacted) is below.

Was there a new version of SonarCloud pushed around Nov 18th, if so are there release notes for it somewhere?

Is anyone else seeing this or have any suggestions for how we can get the performance back to where it should be?

Thanks,

Matt

##[error]ERROR: Error: Debug Failure. Branch in 'resolveSignature' should be unreachable. SyntaxKind: LastTypeNode
ERROR: Error: Debug Failure. Branch in 'resolveSignature' should be unreachable. SyntaxKind: LastTypeNode
##[error]ERROR: Occurred while linting x.ts:22
ERROR: Occurred while linting x.ts:22
##[error]ERROR:     at resolveSignature (node_modules\typescript\lib\typescript.js:49783:28)
ERROR:     at resolveSignature (node_modules\typescript\lib\typescript.js:49783:28)
##[error]ERROR:     at getResolvedSignature node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:49804:26)
ERROR:     at getResolvedSignatureWorker \node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:31043:30)
ERROR:     at Object.getResolvedSignature (\node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:30910:24)
ERROR:     at getResolvedSignature (node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:49804:26)
ERROR:     at getResolvedSignatureWorker (node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:31043:30)
ERROR:     at Object.getResolvedSignature (node_modules\@angular-devkit\build-optimizer\node_modules\typescript\lib\typescript.js:30910:24)
##[error]ERROR:     at getTypeParametersFromCall (d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-unnecessary-type-arguments.js:100:25)
ERROR:     at getTypeParametersFromNode (d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-unnecessary-type-arguments.js:82:12)
ERROR:     at getArgsAndParameters (d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-unnecessary-type-arguments.js:70:28)
ERROR:     at getTypeParametersFromCall (d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-unnecessary-type-arguments.js:100:25)
ERROR:     at getTypeParametersFromNode (d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-unnecessary-type-arguments.js:82:12)
ERROR:     at getArgsAndParameters (d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-unnecessary-type-arguments.js:70:28)
##[error]ERROR:     at TSTypeParameterInstantiation (d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-unnecessary-type-arguments.js:61:39)
ERROR:     at d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\eslint\lib\util\safe-emitter.js:45:58
ERROR:     at Array.forEach (<anonymous>)
ERROR: Failed to analyze file [formula-scoring-risk-score-band.component.ts]: Debug Failure. Branch in 'resolveSignature' should be unreachable. SyntaxKind: LastTypeNode
ERROR:     at TSTypeParameterInstantiation (d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-unnecessary-type-arguments.js:61:39)
ERROR:     at d:\a\1\.sonarqube\out\.sonar\.sonartmp\eslint-bridge-bundle\package\node_modules\eslint\lib\util\safe-emitter.js:45:58
ERROR:     at Array.forEach (<anonymous>)
ERROR: Failed to analyze file [x.ts]: Debug Failure. Branch in 'resolveSignature' should be unreachable. SyntaxKind: LastTypeNode
##[error]Occurred while linting xt.ts:22

@matt_sharpe could you provide full log? And the file which fails with Debug Failure

@matt_sharpe It seems that the failures are related to rule S4157. Could you try to deactivate it?

Hi Elena,

Deactivating that rule has removed the errors from the log.

The performance is unchanged though; this is my main concern. Is there anything to look at here?

Thanks,

Matt

Is your project open source? The best option will be to allow us to debug it (you can send sources in private). Or at least provide debug logs.

And looks like S4157 failure is not related to the perf problem, but still needs investigation. Sending the file reproducer will help us.

He Elena,

Our project is closed source so I’m unable to share it. I can share the debug log with you though. Is there an email address I can send it to?

Thanks,

Matt

Closing the topic as no traction from the user and it’s not possible to investigate the problem just based on logs without source.

Note that this topic Sonar Scanner is really slow scanning typescript probably concerns the same problem

If you have performance problem analyzing JS/TS please start a new topic.