Suppress SonarQube warnings in the T-SQL code

Hi, I am using SonarQube in version 9.2.3. I got some false findings in the T-SQL code which uses CTE expressions. It reports me this the bug: T-SQL static code analysis: "DELETE" and "UPDATE" statements should contain "WHERE" clauses
Issue message is “Add a “WHERE” clause to this “UPDATE” statement.”, my code looks like that:

UPDATE #CTE_Table 
SET column1 = 'some value' 

But this code is valid and I don’t need to add any “WHERE” clause. That’s why I would like to suppress this warning, I tried with adding a comment above this UPDATE statement, like:

– NOSONAR
@SuppressWarnings({“tsql:S1590”, “tsql:S4054”})

But it didn’t work, are there any other options ?

Hi,

Welcome to the community!

Those in-code suppressions are implemented on a language-by-language basis, and apparently not for T-SQL. Your best bet is to just mark the issue False Positive or Won’t Fix via the SonarQube UI.

 
HTH,
Ann

Thank’s for the reply Ann . I would use this approach with marking it as ‘Won’t Fix’ via the SonarQube UI.

Cheers,
Adrian

To be clear, NOSONAR should work. They must be on the same line as the issue that is raised.

select 42; -- NOSONAR

select 42; -- NOSONAR because I like it
2 Likes