SonarCube skip sql scripts

Hello,

Im very beginning in sonarcube and i trying to analize a asp net core project.
Im using:

Developer edition version 9.1.0.47736

In my project I include several sql scripts, but the parsing of these seems to be skipped, my project is just almost entirely composed of these scripts.

I have set in proprties of project to : Patterns used to exclude some files from coverage report = **/.

Do I need to set something else to have control over the sql scripts?
Thanks

Hi,

Welcome to the community!

You don’t mention how you’re analyzing. I assume you’re using the SonarScanner for .NET. From the docs:

For older-style projects, the scanner will only analyze files that are listed in the .csproj or .vbproj project file… To enable the analysis of other types of files, include them in the project file.

Details on exactly how in the click-thru.

 
:slight_smile:
Ann

Hi, thanks for reply,

im using sonarqube.net right, vs 2019 and net core 3.1, and these scripts are included in my project.
Actually the scanner analize the project but not inside sql files that have .sql extensions.

Under Administration > General Settings > T-SQL in Comma-separated list of suffixes for files to analyze i have : .tsql, .sql

thanks for the help

Hi,

Are you using Developer Edition($)? T-SQL analysis isn’t available in Community Edition…

 
Ann

Yes, sure.

Hi,

Can you share your analysis logs?

The analysis log is what’s output from the analysis command. Hopefully, the log you provide will include that command as well.

 
Ann

Hi,

thanks for support,

yesterday, I was able to face up some errors but now i have

“ERROR: JAVA_HOME exists but does not point to a valid Java home
folder. No “\bin\java.exe” file can be found there.”

My java_home system variable point to: C:\Program Files\Java\jre1.8.0_333\bin
and i have java.exe inside.

These are the commands that i launch from my local machine:

  1. dotnet sonarscanner begin /k:“DbProject” /d:sonar.host.url=“http://server:7000” /d:sonar.login=“loginguid” /d:sonar.verbose=true

  2. MSBuild.exe C:\DbProject\DbProject.sqlproj /t:Rebuild

  3. dotnet sonarscanner end /d:sonar.login=“loginguid

the first two steps are executed without errors, at the last one i receive the errors.

Hi,

What I take from this error is that it’s trying to take your JAVA_HOME value and add \bin\java.exe to it to find the Java executable.

So it ends up with: C:\Program Files\Java\jre1.8.0_333\bin\bin\java.exe, which isn’t a valid path to java.exe. Perhaps you should edit your JAVA_HOME value?

 
Ann

Thanks Ann for your reply,

In the meantime i faced this issue download another jdk of java (openjdk) (the env variable was correctly pointed on root folder bin not on executable) not sonarqube analize the sql scripts but seems the not recognize language, ita give me a lot of error kind this:

INFO: Sensor C# Project Type Information [csharp]
ERROR: String is not parsed (file project/Tables/Logs.sql, line 1)"

INFO: Sensor C# Project Type Information [csharp] (done) | time=121ms
^
INFO: Sensor C# Analysis Log [csharp]
2: [Id] INT IDENTITY (1, 1) NOT NULL,
ERROR: String is not parsed (file SqlScript/DBUpdate.sql, line 1)

Hi,

This is a new question. Please create a new thread.

 
Thx
Ann

1 Like