Skip to content

Roslyn Diagnostic Analyzers are customized compiler errors providing real-time feedback to C# developers. Each Analyzer optionally includes an automatic Code Fixer.

License

Notifications You must be signed in to change notification settings

philips-software/roslyn-analyzers

Repository files navigation

Introduction

Roslyn Diagnostic Analyzers are customized compiler errors providing real-time feedback to C# developers. Many Analyzers include an automatic Code Fixer. While Microsoft (and other organizations) offer many analyzers, the market is nascent. Moreover, many tools offer a rich set of rules, but lack the shift-left integration that Roslyn achieves.

We have a policy whereby Code Reviewers ask themselves if a review comment can be automated. If so, and if a Diagnostic Analyzer is the right tool for the scenario in question, and if an Analyzer does not readily exist in the market already, an issue is created to track the need. That is, all analyzers herein are based on real-world code review feedback. This project is the result. It was open-sourced in 2020.

Rules Documentation

Consult the following for details on the available rules:

Getting Started

Add the rules using Visual Studio's Package Manager, locating these packages on nuget.org. Rules are generally enabled by default. Use the .editorconfig file to enable or disable each of them and set their severity level as desired.

Enabling a new rule on a legacy codebase can be daunting. Some rules (e.g., Avoid Duplicate Code, Avoid Static Classes) support configuration and whitelisting - again via the .editorconfig.

Visual Studio 2019/2022 Support

These packages reference Microsoft.CodeAnalysis version 3.6, which shipped with Visual Studio 2019 16.6.

Still on Visual Studio 2017?

If you are still working with Visual Studio 2017, use the 1.0.x versions of the analyzers.

CI/CD

Learn more about the CI/CD pipeline.

About

Roslyn Diagnostic Analyzers are customized compiler errors providing real-time feedback to C# developers. Each Analyzer optionally includes an automatic Code Fixer.

Resources

License

Stars

Watchers

Forks

Packages

No packages published