Parse-Error while SQL Code Quality Scan with SonarQube

Hi Team,
I’m using Redgate SQL source control 7 for versioning our SQL code in SSMS(SQL server 2016) and Redgate SQL change automation:build/release tasks for build/release pipelines in Azure Devops. I added Sonarqube tasks for static code analysis. Run code analysis took time to analyze full code(1200+ files) and given Parse errors in almost all the files.
Our Dev team able to parse those objects in SSMS.

Request you help me resolving this issues and let me know if you need more details.

Thanks,
Upendar

Can you share the analysis logs from the start and until the first parsing error is logged?

SQLParseError_Upendar.txt (2.1 MB)
PFA full log of run code analysis step in build pipeline

Your .sql files are analyzed with PL/SQL analyzer. That’s the default for .sql files.

You should set up your project to analyze .sql files with the TSQL analyzer by adjusting sonar.tsql.file.suffixes and sonar.plsql.file.suffixes.
You can do that through the UI in Administration -> General Settings -> Languages:

  • For “PL/SQL”, remove the “sql” suffix
  • For “T-SQL”, add the “sql” suffix

See the documentation.

Can you please tell me we need to do this changes in SSMS or Azure Devops pipeline or sonarqube project ?

Can we add any additional properties reg. this issue in Prepare Analysis Configuration task ?
If yes, please let us know

You need to add sonar.tsql.file.suffixes in sonar.properties and do language suffix chnages in Sonarqube administration.
Administration -> General Settings -> Languages:

I updated accordingly, now TSQL analyzer able to analyze .sql files. Thanks for your suggestion

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.