Getting error on sonar scan for my javascript project

Hi,

Getting error on sonar scan for my javascript project.
I am getting error on my javascript projecct(using azure build pipeline),i have added tasks for sonar in my pipeline.but getting error at the sonar scan step.
errorlog.zip (1.1 MB)

Hello

The analysis fails with OutOfMemoryError when what seems to be a SQL script creating a database is being analyzed:

2021-01-19T14:46:15.3814363Z INFO: 2170/3246 files analyzed so far, currently analyzing: E:/WKApps/45/s/Source/Repository/MDSCommonDB_CreateDB.sql

Such scripts are typically very big in size and auto-generated. They should be excluded from the analysis.

Best,
Michal

Thanks Michal for your help ,do you know a way to this I using azure pipeline.
is there a way i can ignore files with .sql extension or some other.

Below is my pipeline for javascript proj

I have exculded the .sql files by excluding the folder itself

sonar.exclusions=PortalDB/**/*
sonar.verbose=true

can i ignore all .sql files itself

moving ahead on the exclusions i have added exclusion in sonar scanner

sonar.exclusions=PortalDB//*,DB_Projects//,**/.sql,/*.png,/*.jpg
sonar.verbose=true

Moving ahead i have exclude some folders and files

sonar.exclusions=PortalDB/**/*,DB_Projects/**/*,**/*.sql,**/*.png,**/*.jpg
sonar.verbose=true

Hello
I’m glad you addressed the issue. The pattern you added **/*.sql will indeed exclude all the SQL files form the analysis. It is a good practice to exclude from the analysis scope all the files which are not of interest.

Excluding image extensions (.png, .jpg) is not necessary - these extensions are not mapped to any of the analyzers and will not be taken into account during analysis.

Best,
Michal

Hi Michal ,

Well I am seeing new error for the sonar scanner.
PFA the error log below.
Error_SonarScanner.zip (3.6 MB)

Hello
The analysis finished successfully:

2021-01-20T13:50:36.8902334Z 13:50:36.878 INFO: ANALYSIS SUCCESSFUL, you can browse https://sonarqube.cchaxcess.com/dashboard?id=portaladdfiles&branch=2019Portal-5.0
2021-01-20T13:50:36.8902868Z 13:50:36.878 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
2021-01-20T13:50:36.8903377Z 13:50:36.878 INFO: More about the report processing at https://sonarqube.cchaxcess.com/api/ce/task?id=AXcgD7aVLEbFqpjSgnX6

The failure happen in the 3rd party post job Quality Gate Breaker:

2021-01-20T13:50:36.8939335Z 13:50:36.878 DEBUG: Post-jobs : Forbidden Configuration Breaker -> Quality Gate Breaker
2021-01-20T13:50:36.8940053Z 13:50:36.878 INFO: Executing post-job 'Forbidden Configuration Breaker'
2021-01-20T13:50:36.8940403Z 13:50:36.878 INFO: Executing post-job 'Quality Gate Breaker'
2021-01-20T13:50:36.8943311Z 13:50:36.893 DEBUG: Loading report task properties from E:\WKApps\_temp\sonar\213850\1d980cee-d14b-c2d7-546e-2ed24b005af7\report-task.txt
2021-01-20T13:50:37.6981354Z 13:50:37.689 INFO: Waiting for report processing to complete...
2021-01-20T13:50:47.8301344Z 13:50:47.822 INFO: Waiting for report processing to complete...
2021-01-20T13:50:58.0034656Z 13:50:58.001 INFO: Waiting for report processing to complete...
2021-01-20T13:51:08.1476160Z 13:51:08.134 INFO: Waiting for report processing to complete...
2021-01-20T13:51:18.2648679Z 13:51:18.262 INFO: Waiting for report processing to complete...
2021-01-20T13:51:28.3511640Z 13:51:28.349 INFO: Waiting for report processing to complete...
2021-01-20T13:51:38.4310946Z 13:51:38.421 INFO: Waiting for report processing to complete...
2021-01-20T13:51:48.5057746Z 13:51:48.505 INFO: Waiting for report processing to complete...
2021-01-20T13:51:58.6117159Z 13:51:58.598 DEBUG: eslint-bridge server will shutdown
2021-01-20T13:52:07.6649877Z 13:52:07.664 DEBUG: stylelint-bridge server will shutdown
2021-01-20T13:52:07.6864290Z 13:52:07.685 INFO: ------------------------------------------------------------------------
2021-01-20T13:52:07.6864853Z 13:52:07.685 INFO: EXECUTION FAILURE
2021-01-20T13:52:07.6865215Z 13:52:07.685 INFO: ------------------------------------------------------------------------
2021-01-20T13:52:07.6865656Z 13:52:07.685 INFO: Total time: 16:21.752s
2021-01-20T13:52:07.8192670Z 13:52:07.811 INFO: Final Memory: 28M/107M
2021-01-20T13:52:07.8193332Z 13:52:07.811 INFO: ------------------------------------------------------------------------
2021-01-20T13:52:07.8235017Z ##[error]13:52:07.811 ERROR: Error during SonarScanner execution
2021-01-20T13:52:07.8242509Z 13:52:07.811 ERROR: Error during SonarScanner execution
2021-01-20T13:52:07.8252309Z ##[error]java.lang.IllegalStateException: Report processing did not complete successfully: FAILED
	at org.sonar.plugins.buildbreaker.QualityGateBreaker.getAnalysisId(QualityGateBreaker.java:205)
	at org.sonar.plugins.buildbreaker.QualityGateBreaker.execute(QualityGateBreaker.java:266)
	at org.sonar.scanner.postjob.PostJobWrapper.execute(PostJobWrapper.java:49)
	at org.sonar.scanner.postjob.PostJobsExecutor.execute(PostJobsExecutor.java:48)
	at org.sonar.scanner.postjob.PostJobsExecutor.execute(PostJobsExecutor.java:39)
	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:373)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:144)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:137)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:123)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
13:52:07.811 ERROR: 
13:52:07.811 ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

It seems that the report processing on the SonarQube side failed for some reason. You may check it on the Background Task page of this project. This post job is not provided by SonarSource, it might be that it fails because of the state of the Quality Gate of the project.

Michal