C#: Do not display the found violations as a warning in the compiler

Hi,

we are using SQ 8.4.2 Developer Edition, we are using the sonar scanner during are c# compile.

Is it possible that the violations found during compile are not shown as Warning after compile. We want to enable the build option to treat warnings (brought by other places like by SQ rules) as Error?

I tried the silent option, but it only applies to the console output (as it is correctly described). Further research has brought me only to how to suppress a certain warning. But not if and how to not show all warnings caused by SQ in a build.

Hi,

Your version is past EOL. You should upgrade to either the latest version or the current LTS at your earliest convenience. Your upgrade path is:

8.4.2 → 8.9.8 → 9.4 (last step optional)

You may find the Upgrade Guide helpful. If you have questions about upgrading, feel free to open a new thread for that here.

If your error persists after upgrade, please come back to us.

 
HTH,
Ann

Hello,

we have tried the 8.9 ltsc and 9.3 tested but still the same behavior. The rule violations are displayed as (compiler) warning after compile.

Hi,

It’s not clear to me what behavior you’re seeking. However, the Notes on external .NET issues (bottom of the page) may be of interest.

 
Ann

Hi,

this example should clarify what we currently get displayed after the compile (c# no matter if dotnet or msbuild):

"blabla.sln" (Build target) (1) ->
"blabla\F1.csproj" (default target) (2) ->
  blabla\F2.cs(60,15): warning S1135: Complete the task associated to this 'TODO' comment. [blabla\F1.csproj]
  blabla\F3.cs(188,17): warning S1067: Reduce the number of conditional operators (5) used in the expression (maximum allowed 3). [blabla\F1.csproj]
  blabla\F4.cs(351,17): warning S1067: Reduce the number of conditional operators (4) used in the expression (maximum allowed 3). [blabla\F1.csproj]
  blabla\F5.cs(47,13): warning S3240: Use the '?:' operator here. [blabla\F1.csproj]
  blabla\F5.cs(67,29): warning S107: Constructor has 8 parameters, which is greater than the 7 authorized. [blabla\F1.csproj]

5 Warning(s)
0 Error(s)

Is there a way to not display the detected issues as warnings in the compile (e.g. a general suppression)?

Thanks

1 Like

Hi,

Thanks for clarifying. I’m officially out of my depth now, so I’m going to refer this to the language experts.

 
Ann

Hello @nibo,

To set the severity of a rule you can use .editorconfig. Here you can see more details about it.

All the best,
Čaba