TSQL: More parsing errors

Currently running:

  • SonarScanner for MSBuild 4.6.2
  • SonarQube Scanner 3.3.0.1492
  • Windows 2016 Server

This is in relationship to:

and bug: https://jira.sonarsource.com/browse/MMF-1593

Following statements are not being parsed:

Anything around modifying procedures:
CREATE PROCEDURE [dbo].[sp_MyDatabase]
ALTER PROCEDURE [dbo].[sp_MyDatabase]
DROP PROCEDURE [dbo].[sp_MyDatabase]

Table variables:
DECLARE @tblUpdated TABLE ( [Id] INT , [Active] BIT , [Reason] NVARCHAR (50));

Hi Joshua,

Which version of SonarTSQL do you have? (latest is 1.4.0.3334)

Could you confirm that parse errors come from SonarTSQL and not SonarPLSQL? In the sonar-scanner logs, what do you see above the error?
INFO: Sensor T-SQL Sensor [tsql]
or
INFO: Sensor PL/SQL Sensor [plsql]

Because using SonarTSQL 1.4.0.3334 I can parse the following code:

CREATE PROCEDURE [dbo].[sp_MyDatabase] AS
BEGIN
   DECLARE @tblUpdated TABLE ( [Id] INT , [Active] BIT , [Reason] NVARCHAR (50));
END
GO

ALTER PROCEDURE [dbo].[sp_MyDatabase] AS PRINT 'Test';
GO

DROP PROCEDURE [dbo].[sp_MyDatabase];
GO

But if I map *.sql files to SonarPLSQL, I have the following errors:

...
INFO: Sensor PL/SQL Sensor [plsql]
...
WARN: Unable to fully parse: test.sql
WARN: Parse error starting from line 1
...

Regards,

Alban

Yup. It’s Sensor PL/SQL Sensor.

How do I remap the scanner to SonarTSQL?

Hi Joschua,

You can change those SonarQube properties:

  • Administration > General Settings > PL/SQL > File Suffixes
  • Administration > General Settings > T-SQL > File Suffixes

Or in sonar-project.properties and on sonar-scanner command line you can set:

  • sonar.plsql.file.suffixes
  • sonar.tsql.file.suffixes

For example:

  • PL/SQL *.sql -> *.plsql
  • T-SQL *.tsql -> *.sql,*.tsql