Click here to Skip to main content
14,448,144 members

Four C# Code Analyzers That Are Worth Your Time

Rate this:
3.91 (6 votes)
Please Sign up or sign in to vote.
3.91 (6 votes)
9 Jun 2016CPOL
Four C# code analyzers that are worth your time

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

Image 1

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

Image 2

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.

StyleCop Analyzers

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

Image 3

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!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Hamid Mosalla
Software Developer
Iran (Islamic Republic of) Iran (Islamic Republic of)
Programming is my passion, because I find it so intellectually rewarding. I currently work as a back-end web developer, using Microsoft technology stack, I also blog about my experiences and contribute to open source projects on my free time.

Comments and Discussions

 
QuestionCombining code analyzers. Pin
DanielRR21314-Jun-16 18:20
MemberDanielRR21314-Jun-16 18:20 
AnswerRe: Combining code analyzers. Pin
Hamid Mosalla15-Jun-16 8:45
MemberHamid Mosalla15-Jun-16 8:45 
QuestionWhich to use? Pin
DW196210-Jun-16 4:30
MemberDW196210-Jun-16 4:30 
AnswerRe: Which to use? Pin
Rajan Patekar14-Jul-16 6:37
professionalRajan Patekar14-Jul-16 6:37 
PraiseRe: Which to use? Pin
DW196214-Jul-16 12:29
MemberDW196214-Jul-16 12:29 
GeneralRe: Which to use? Pin
Andre L.A.C Bittencourt18-Nov-16 7:30
MemberAndre L.A.C Bittencourt18-Nov-16 7:30 
AnswerRe: Which to use? Pin
Hamid Mosalla25-Jul-16 6:51
MemberHamid Mosalla25-Jul-16 6:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Technical Blog
Posted 9 Jun 2016

Tagged as

Stats

18K views
7 bookmarked