.NET Compiler Platform ("Roslyn") Analyzers alternatives and similar packages
Based on the "Code Analysis and Metrics" category
Powerful .NET library for benchmarking.
App Metrics is an open-source and cross-platform .NET library used to record and report metrics within an application and reports it's health. See the docs for me details.
StyleCop analyzes C# source code to enforce a set of style and consistency rules
Capturing CLR and application-level metrics. So you know what's going on.
Liveness, health check library for ASP.NET Core Applications
Extensible rule-based tool to find problems in .NET applications and libraries
Static code analysis tool to enforce namespace dependency rules in C# projects.
A simple template base system of macros for C# that can be executed in design time
Capturing CLR, application-level web request metrics. Middleware and extensions using Metrics-Net
is a Visual Studio and VS Team Services extension that estimates your .NET code quality and Technical-Debt, that lets create code rules with C# LINQ syntax, visualize code structure and focus on changes and evolution.[$]
Enhanced syntax highlighting for C# and some other "Visual" features.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of .NET Compiler Platform ("Roslyn") Analyzers or a related project?
|Windows Debug||Windows Release|
What is Roslyn?
Roslyn is the compiler platform for .NET. It consists of the compiler itself and a powerful set of APIs to interact with the compiler. The Roslyn platform is hosted at github.com/dotnet/roslyn.
What are Roslyn Analyzers?
Roslyn analyzers analyze your code for style, quality and maintainability, design and other issues. The documentation for Roslyn Analyzers can be found at docs.microsoft.com/visualstudio/code-quality/roslyn-analyzers-overview.
Microsoft created 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. The documentation for FxCop analyzers in Visual Studio can be found at docs.microsoft.com/visualstudio/code-quality/install-fxcop-analyzers.
This is the primary analyzer package for this repo that contains all the ported FxCop code analysis rules (CAxxxx). The documentation for FxCop Analyzers and FAQs about migrating from legacy post-build static analysis also known as "FxCop" to FxCop Analyzers can be found at docs.microsoft.com/visualstudio/code-quality/install-fxcop-analyzers.
The documentation for all the ported and unported FxCop rules can be found at docs.microsoft.com/en-us/visualstudio/code-quality/fxcop-rule-port-status.
This analyzer package contains all the ported FxCop rules that are applicable for both .NetCore/.NetStandard and Desktop .NetFramework projects. You do not need to install any separate analyzer package from this repo to get target-framework specific FxCop rules. [More info about rules in this package](src/Microsoft.CodeAnalysis.FxCopAnalyzers/Microsoft.CodeAnalysis.FxCopAnalyzers.md)
The following are subpackages or NuGet dependencies that are automatically installed when you install the Microsoft.CodeAnalysis.FxCopAnalyzers package:
This package contains common code quality improvement rules that are not specific to usage of any particular API. For example, CA1801 (ReviewUnusedParameters) flags parameters that are unused and is part of this package. [More info about rules in this package](src/Microsoft.CodeQuality.Analyzers/Microsoft.CodeQuality.Analyzers.md)
This package contains rules for correct usage of APIs that are present in .NetCore/.NetStandard framework libraries. For example, CA1309 (UseOrdinalStringComparison) flags usages of string compare APIs that don't specify a
NOTE: This analyzer package is applicable for both .NetCore/.NetStandard and Desktop .NetFramework projects. If the API whose usage is being checked exists only in .NetCore/.NetStandard libraries, then the analyzer will bail out silently for Desktop .NetFramework projects. Otherwise, if the API exists in both .NetCore/.NetStandard and Desktop .NetFramework libraries, the analyzer will run correctly for both .NetCore/.NetStandard and Desktop .NetFramework projects. [More info about rules in this package](src/Microsoft.NetCore.Analyzers/Microsoft.NetCore.Analyzers.md)
This package contains rules for correct usage of APIs that are present only in Desktop .NetFramework libraries.
NOTE: The analyzers in this package will silently bail out if installed on a .NetCore/.NetStandard project that do not have the underlying API whose usage is being checked. If future versions of .NetCore/.NetStandard libraries include these APIs, the analyzers will automatically light up on .NetCore/.NetStandard projects that target these libraries. [More info about rules in this package](src/Microsoft.NetFramework.Analyzers/Microsoft.NetFramework.Analyzers.md)
Other Analyzer Packages
This package contains rules for correct usage of APIs from the Microsoft.CodeAnalysis NuGet package, i.e. .NET Compiler Platform ("Roslyn") APIs. These are primarily aimed towards helping authors of diagnostic analyzers and code fix providers to invoke the Microsoft.CodeAnalysis APIs in a recommended manner. [More info about rules in this package](src/Microsoft.CodeAnalysis.Analyzers/Microsoft.CodeAnalysis.Analyzers.md)
This package contains rules that are very specific to the .NET Compiler Platform ("Roslyn") project, i.e. https://github.com/dotnet/roslyn repo. This analyzer package is not intended for general consumption outside the Roslyn repo. [More info about rules in this package](src/Roslyn.Diagnostics.Analyzers/Roslyn.Diagnostics.Analyzers.md)
This package contains customizable rules for identifying references to banned APIs. [More info about rules in this package](src/Microsoft.CodeAnalysis.BannedApiAnalyzers/Microsoft.CodeAnalysis.BannedApiAnalyzers.md)
This package contains rules to help library authors monitoring change to their public APIs. [More info about rules in this package](src/PublicApiAnalyzers/Microsoft.CodeAnalysis.PublicApiAnalyzers.md)
For instructions on using this analyzer, see [Instructions](src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md).
The MetaCompilation Analyzer is an analyzer that functions as a tutorial to teach users how to write an analyzer. It uses diagnostics and code fixes to guide the user through the various steps required to create a simple analyzer. It is designed for novice analyzer developers who have some previous programming experience.
For instructions on using this tutorial, see Instructions.
- Install Visual Studio 2019 or later, with at least the following workloads:
- .NET desktop development
- .NET Core cross-platform development
- Visual Studio extension development
- Clone this repository
- Open the VS developer command prompt or PowerShell
- Go to the directory of the Roslyn Analyzer Repo
- Run the restore and build command:
build.cmd(in the command prompt) or
- Execute tests:
test.cmd(in the command prompt) or
Submitting Pull Requests
Prior to submitting a pull request, ensure the build and all tests pass using using steps 4 and 5 above.
Guidelines for contributing a new Code Analysis (CA) rule to the repo
See [GuidelinesForNewRules.md](.//GuidelinesForNewRules.md) for contributing a new Code Analysis rule to the repo.
Versioning Scheme for Analyzer Packages
See [VERSIONING.md](.//VERSIONING.md) for the versioning scheme for all analyzer packages built out of this repo.
Recommended version of Analyzer Packages
Recommended Visual Studio Version: Visual Studio 2017 15.9 RTW or later
Recommended Analyzer Package Version: Version 2.9.8, for example https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers/2.9.8
The documentation for FxCopAnalyzers package versions can be found at docs.microsoft.com/visualstudio/code-quality/install-fxcop-analyzers
You can also install a custom Microsoft Code Analysis VSIX containing these analyzers as a Visual Studio extension for all your managed projects.
- For Visual Studio 2017 15.5 or later: https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.MicrosoftCodeAnalysis2017
- For Visual Studio 2019 16.0 or later: https://marketplace.visualstudio.com/items?itemName=VisualStudioPlatformTeam.MicrosoftCodeAnalysis2019