Rules S927 look like have 2 responsabilites for the same rule

Please provide

  • Operating system: Windows 11 Entreprise - 23H2 - 22631.4317
  • Visual Studio version: Microsoft Visual Studio Enterprise 2022 (64 bits) - Version 17.11.0
  • SonarLint plugin version: 8.6.0.10679
  • Programming language you’re coding in: VB.NET
  • Is connected mode used: Yes
    • Connected to SonarCloud or SonarQube (and which version): SonarQube

And a thorough description of the problem / question:

Hello

I active the severity to error for the rule s927 in my .editorconfig :

dotnet_diagnostic.S927.severity = error

So the rule seem to have 2 responsabilities and not just one (S from SOLID :wink: in the rules ) … and seem have this one :

to match to the interface declaration

and this one :

to match to the base class declaration

But, we use in our code some Nuget and inherits from the base and we have our own rules naming that the base class in the Nuget are really not the good ones.

So, can I can activate only the severity error s927 for “to match to the interface declaration” and not the “to match to the base class declaration” ???

If we can’t, maybe is possible in the future of SonarLint to divide rules for the rules with multiple responsabilities like s927.

Thank you!

I suppose we can’t make it : activate only the severity error s927 for “to match to the interface declaration” and not the “to match to the base class declaration” ???

How I can ask to SOnarQube to split s927 in 2 distincts rules ?

Hi @Avelone,
Welcome to the community!

Unfortunately its not possible to split the rule. What you can do though is disable the rule per-file or project as needed.

You can find the documentation on excluding specific rules from specific files here

Hope this helps!

1 Like