sonar-dotnet
sonar-dotnet copied to clipboard
Code analyzer for C# and VB.NET projects
In #5808 SonarCloud, without any particular change in the code, started reporting one of the conditions in [this](https://sonarcloud.io/code?id=sonaranalyzer-dotnet&pullRequest=5808&selected=sonaranalyzer-dotnet%3Aanalyzers%2Fsrc%2FSonarAnalyzer.Common%2FRules%2FVariableUnusedBase.cs&line=46) line as uncovered while locally the Unit Tests do cover this line....
see the discussion here https://github.com/SonarSource/sonar-dotnet/pull/5764#discussion_r904131177 The idea is, to change the code generator of the ShimLayer to add an overload for `IsInstance`. I don't think, the CodeGenerator is part of...
### Description Expect operations to throw exception also outside try statement. ``` Monitor.Enter(obj); // Noncompliant SomethingThatCanThrow(); Monitor.Exit(obj); ``` ### How Implementation is easy ``` if (exceptionCandidate.FromOperation(node.Operation) is { } exception)...
Source: http://stackoverflow.com/questions/42759665/does-sonarlint-have-the-custom-dictionary-feature-like-the-fxcop
### Description The next analyzers do not recognize the usage of `ArgumentNullException.ThrowIfNull()`, which was [added in .NET 6](https://docs.microsoft.com/en-us/dotnet/api/system.argumentnullexception.throwifnull?view=net-6.0). - [S4456](https://sonarsource.github.io/rspec/#/rspec/S4456/csharp): Parameter validation in yielding methods should be wrapped - [S4457](https://sonarsource.github.io/rspec/#/rspec/S4457/csharp):...
S2934 offers a code fix to remove an assignment. The Fixer is not offered if the assignment is placed in a deconstruction. ```cs a = 1; // remove fixer removes...
See [RSPEC 3898](https://sonarsource.github.io/rspec/#/rspec/S3898) # Description If you’re using a struct, it is likely because you’re interested in performance. But by failing to implement IEquatable you’re loosing performance when comparisons are...
The infrastructure for the code fix test,s lacks some essential features for code fix validation. Most notably, these are * Snippet-based testing ([see](https://github.com/SonarSource/sonar-dotnet/blob/96fe491db1228e452cc30bb7dd5f89b2a9e4e41f/analyzers/tests/SonarAnalyzer.UnitTest/TestFramework/Verifier.cs#L220-L223)) * Code comment-based annotation support for offered...