SonarSource / sonar-dotnet

Code analyzer for C# and VB.NET projects
https://redirect.sonarsource.com/plugins/csharp.html
GNU Lesser General Public License v3.0
755 stars 223 forks source link

S101: Configuration for custom acronyms #2440

Open dnperfors opened 5 years ago

dnperfors commented 5 years ago

Description

On our project we have some three and four letter acronyms, that are part of a specification. These acronyms are used in code, but they will trigger S101. Would it be possible to add a file to the project that describe what acronyms are allowed, or should be written, for example in a similar way as the CustomDictionary.xml file that is used by CA1709

Repro steps

Create a class with the name NSAInformer

Expected behavior

Warning S101 is not given for NSAInformer, because NSA is the established capitalized 3 letter acronym in our specification.

Actual behavior

Warning S101 is given NSAInfomer, telling me that it should be NsaInformer

Known workarounds

Suppress S101 in all cases where the NSA acronym is used

Related information

andrei-epure-sonarsource commented 4 years ago

related to #320 - relax the restrictions

andrei-epure-sonarsource commented 3 years ago

RSPEC-101

SonarWay Default Severity:Minor Impact:Low Likelihood:Low

ericregnier commented 2 years ago

Is there an ETA for this? It seems like a basic feature that comes out-of-the-box with Visual Studio and Resharper. We ended up ignoring all S101 errors because of this lack of configuration to allow for custom known acronyms.

MichelZ commented 2 years ago

Yeah, this one feels annoying. Ideally it should take the resharper .DotSettings and the VS equivalent to ignore certain abbreviations. Alternatively use your own dictionary, that could be generated then from existing files by the community. As it stands now, we will also just ignore S101 :(

ericregnier commented 2 years ago

@andrei-epure-sonarsource any updates? :)

HaGGi13 commented 2 years ago

@andrei-epure-sonarsource Hello, any updates? It would be great to have something like this. Otherwise we start to ignore S101 as well. And I'm really not in favor with this approach.