With the advent of .NET Compiler Platform (code-named “Roslyn”), it became possible to build code analyzers for languages like C# with ease. In the past, only big companies like JetBrains or DevExpress with a lot of resources could build a code analyzer, because building it involved writing your own compiler for that purpose. Now the .NET Compiler Platform provides developers with a set of APIs to query the compiler and interact with it. In this post, I'm going to introduce four code analyzers that I happen to use, if you think some other important analyzer exists that is worth mentioning, please let me know in the comments section.
What is Code Analyzer?
In its simplest form, code analyzers are a set of tools that can analyze your code, and based on their rulesets, tell you what part of your code has a potential problem, and can get better. In this case, some of them can also provide you with an automatic fix for that problem.
Refactoring Essentials constantly gets updated by an active community, it works with C# and VB, and provide a set of features that you can see here.
Code Cracker is another amazing code analyzer for C# and VB, it also has an active community around it that only gets better as the set of rules and fixes grows.
Another great analyzer to have is StyleCop Analyzer for the .NET Compiler Platform, you don't have to use the old stuff anymore, this analyzer does its magic for you on the fly.
SonarLint is a great analyzer, the thing that set it apart from others, is that it has a connected mode, which allows you to connect to a server and automatically updates your rulesets for the solution. It also has an active community. You can install it as an Visual Studio extension.
As a minor note to those of you who don't use Visual Studio 2015, if you want to use these features, you need to either install VS 2015, or install the roslyn compiler as a nuget package. What you need to install can be found here and here and here! CodeProject