Sonar Scanner T-SQL unable to parse file (drop synonym)

  • Hello, i’m using SonarQube Developer edition 10.4.0.87286 integrated with azure devops. During parsing (azure devops task “Run Code Analysis” version 5.19.0) my T-SQL code fails with the message that I will detail at the end of the post.
  • how is SonarQube deployed: zip, Docker, Helm
    –zip in Windows Server
  • what are you trying to achieve
    –scan t-sql files for static code analysis (SQL SERVER 2019 syntax)
  • what have you tried so far to achieve this
    –Sonar scanner analyzer with the .sql file using TSQL analyzer feature.

Error message:

INFO: Sensor T-SQL Sensor [tsql]
INFO: Sensor T-SQL Sensor is restricted to changed files only
INFO: 1 source files to be analyzed
WARN: Unable to parse file '/C:/XXX/20240209_test_synonym.sql' : Parse error at line 2 column 6:

1: IF EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[usp_test]') AND type IN (N'SN'))
2: DROP SYNONYM [dbo].[usp_test]
        ^
3: GO
4: CREATE SYNONYM [dbo].[usp_test] FOR [dbo].[usp_test_final]
5: 

INFO: 1/1 files, last analyzed (188 ms): XXX/20240209_test_synonym.sql
INFO: Sensor T-SQL Sensor [tsql] (done) | time=891ms

Please confirm, if any other information required.
Thank you!

20240209_test_synonym.zip (327 Bytes)

Hello @pabseb,

Thank you for raising this issue.
I was able to reproduce it.

I have created a ticket in our backlog so we can tackle it in the future.

Have a nice day!

1 Like

Hello Sebastien, is there any news on this? or any approximate date of solution?

Thank you!

Hello @pabseb,

We would like to have a sprint later this year to fix various issues with the analyzer which will hopefully include your issue.
Unfortunately, I cannot yet tell you whether it will happen in the next few weeks (definitely not) or in the next few months.

One thing is for sure, this sprint will happen before the release of the next SonarQube LTA which should happen before the end of the year.