DEV Community

Bharat Dwarkani
Bharat Dwarkani

Posted on

Top 10 Static Code Quality Analysers for ASP.NET Core

FXCopAnalyzers

Created by Microsoft, a set of analyzers, called Microsoft.CodeAnalysis.FxCopAnalyzers, that contains the most important "FxCop" rules from static code analysis, converted to Roslyn analyzers. These analyzers check your code for security, performance, and design issues, among others.

You can install these FxCop analyzers either as a NuGet package or as a VSIX extension to Visual Studio.

https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers

StyleCopAnalyzers

An implementation of StyleCop rules using the .NET Compiler Platform. It helps in enforcing standard style for code.

https://www.nuget.org/packages/StyleCop.Analyzers/

Security Code Scan

Detects various security vulnerability patterns: SQL Injection, Cross-Site Scripting (XSS), Cross-Site Request Forgery (CSRF), XML eXternal Entity Injection (XXE), etc.

https://security-code-scan.github.io/

Web API analyzers

ASP.NET Core 2.2 and later includes the Microsoft.AspNetCore.Mvc.Api.Analyzers NuGet package containing analyzers for web APIs.

https://www.nuget.org/packages/Microsoft.AspNetCore.Mvc.Api.Analyzers

SonarAnalyzer

Analyzers which spot bugs and code smells in your code.

https://www.sonarqube.org/
https://www.nuget.org/packages/SonarAnalyzer.CSharp

Lindhart.Analyser.MissingAwaitWarning

When using dependency injection and async-await pattern it is possible to end up with an interface with a method that returns a Task. If this interface method is used in a synchronous method there is a likelihood that it will erroneously be run like a fire and forget method. In this situation, this analyzer generates a warning.

https://www.nuget.org/packages/Lindhart.Analyser.MissingAwaitWarning

NSubstitute.Analyzers.CSharp

Provides diagnostic analyzers to warn about incorrect usage of NSubstitute in C#.

https://www.nuget.org/packages/NSubstitute.Analyzers.CSharp

xUnit.net [Code Analyzers]

Code Analyzers for projects using xUnit.net that help finds and fix frequent issues when writing tests.

https://www.nuget.org/packages/xunit.analyzers

Microsoft.CodeQuality.Analyzers

CodeQuality Analyzers

https://www.nuget.org/packages/Microsoft.CodeQuality.Analyzers

Microsoft.CodeAnalysis.VersionCheckAnalyzer

Microsoft.CodeAnalysis Version Check Analyzer
https://www.nuget.org/packages/Microsoft.CodeAnalysis.VersionCheckAnalyzer

Few more analyzers - https://github.com/dotnet/roslyn-analyzers

Top comments (0)