Various TSQL Statements not parsing by SonarWay quality profile

  • ALM used Azure DevOps
  • CI system used Azure DevOps
  • Languages of the repository TSQL
  • Sonarsource version 1.9.0

Hi,
We’re seeing loads of parse errors when running the prepare analysis on SonarCloud step of our Azure build pipeline. The header from the log file from this step is as follows;
2019-10-30T10:59:06.2926083Z ##[section]Starting: Run Code Analysis
2019-10-30T10:59:06.3735345Z ==============================================================================
2019-10-30T10:59:06.3735653Z Task : Run Code Analysis
2019-10-30T10:59:06.3735838Z Description : Run scanner and upload the results to the SonarCloud server.
2019-10-30T10:59:06.3735994Z Version : 1.9.0
2019-10-30T10:59:06.3736138Z Author : sonarsource
2019-10-30T10:59:06.3736366Z Help : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

More Information

When running this step we are getting parse failures on the following valid SQL commands;
CREATE MESSAGE TYPE [ErroredMessage] fails at the M in Message
CREATE QUEUE [dbo].[//CM/ReceiveQueue] fails at the Q in queue
CREATE MASTER KEY ENCRYPTION BY PASSWORD fails at the M in Master
CREATE SERVICE [//DEW/DewInternalReceiveService] fails as the S in Service
ALTER SEQUENCE fails at the S In Sequence
CREATE CONTRACT fails at the C in Contract
SET @MessageVody.[modify](‘declare namespace xsi=“urn:cccc:tech:xsd:ics.doc.001”;
2019-10-30T11:00:51.4785847Z ^
2019-10-30T11:00:51.4786218Z 19: insert attribute BrokerErrorMessageID {sql:variable("@Handle") }
2019-10-30T11:00:51.4786510Z 20: into (/xsi:Document)[1]’); fails at the m in modify
BEGIN ATOMIC WITH (TRANSACTION ISOLATION LEVEL = SNAPSHOT, LANGUAGE = N’English’) fails at the W in With
CREATE CERTIFICATE fails at the C in Certificate

Could you please advise;

  1. Why these commands are failing to parse.
  2. If these commands are not currently recognised by SonarCloud, what the rollout plans for adding these statements.
  3. Is there any other potential reason why these commands are not parsing.

Regards,
Scot

Hello Scot,

First, welcome to our community forum and thank you for your feedback !

To answer your first question: these parsing errors are coming from our analyzer that encounters snytaxes not yet supported (You can have a look at this answer for more information).

Regarding the errors you’ve reported.

For these 4 errors, we already have the following corresponding tickets: SONARTSQL-232, SONARTSQL-233, SONARTSQL-234, SONARTSQL-235.

I will investigate the other errors you’ve reported and create fix tickets accordingly.

For you second question, I cannot say for sure when these issues will be tackled. We regularly do improvement efforts on our analyzers, but there is currently nothing planned in the near future regarding the TSQL analyzer. We will have to discuss and planify internally.

Regards,
-Chris

1 Like