Suppressing few error message

Suppressing Error Message

sonar version: 6.7

I am looking to suppress few error message on the .Net SQL project.,
We follow the suppress message on the .Net project it works well, but this suppress logic does not work for sql related error messages.

I am trying to suppress the error message

Error message to suppress:- “DELETE” and “UPDATE” statements should contain “WHERE” clauses.

So I added suppression logic in GlobalSuppressions.cs file as follows, but it does not work

[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(“1590”, “S1590:“DELETE” and “UPDATE” statements should contain “WHERE” clauses”, Justification = “Testing suppressing rule”, Scope = “module”)]

Below are my questions.
1. What is the category name for SQL Suppression. For C# related we uses “Microsoft.Rules.Data”, but not sure for this SQL.
2. Give me some sample for SQL suppression.

Please suggest us.

Hi,

Welcome to the community!

First, 6.7 is long past EOL. You should upgrade immediately:

6.7 -> 7.9.4 (current LTS) -> 8.4.2 (current version. This step is optional)

To be honest, I don’t know whether or not the upgrade will affect what you’re seeing, but you’re so far behind that you need to catch up right away.

Regarding the issues you are able to suppress, are you sure they originate from SonarQube analysis? Roslyn issues are imported automatically (see the bottom of this page) and I suspect it’s those 3rd-party issues that suppression is working for. Which would explain why it’s not working for issues originating from SonarQube.

 
HTH,
Ann

Hi, Thanks for the update. We have updated our version to >8.0. The rules defined in the Sonar qube for the TSQL, not able to suppress., These warnings are not highlighted on visual studio, this will appear on the Sonar Qube site. So i am targeting to suppress these messages on qube.
Below are the TSQL reference which has the list of warnings.

Give me some samples to suppress any one of the TSQL sonar warnings through GlobalSuppression.cs file. (FYI:- i am able to suppress C# related warnings on other .Net project, and not clear on categoryid, etc., param on [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage()] ).

Thanks in advance.

A post was split to a new topic: Errors during startup

Just would like to know is there any way to suppress sonar qube tsql warnings or this suppression will work only for .Net code ?

Hi,

You can suppress SonarQube issues using exclusions. You will not be able to configure them in GlobalSuppression.cs.

 
HTH,
Ann

Exclusion settings on Sonar Qube end on the required file or rule level right ?

Hi,

I don’t understand the question. Have you checked those docs I linked? Also, don’t forget that you have the option of simply removing the rule from your Quality Profile.

 
Ann