Click here to Skip to main content
15,878,945 members
Articles / All Topics

Four C# Code Analyzers That Are Worth Your Time

Rate me:
Please Sign up or sign in to vote.
3.91/5 (6 votes)
9 Jun 2016CPOL2 min read 22.6K   6   7
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!

This article was originally posted at http://www.hamidmosalla.com/feeds/posts/default

License

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


Written By
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 17:20
DanielRR21314-Jun-16 17:20 
AnswerRe: Combining code analyzers. Pin
Hamid Mosalla15-Jun-16 7:45
Hamid Mosalla15-Jun-16 7:45 
QuestionWhich to use? Pin
DW196210-Jun-16 3:30
DW196210-Jun-16 3:30 
AnswerRe: Which to use? Pin
Rajan Patekar14-Jul-16 5:37
professionalRajan Patekar14-Jul-16 5:37 
PraiseRe: Which to use? Pin
DW196214-Jul-16 11:29
DW196214-Jul-16 11:29 
GeneralRe: Which to use? Pin
Andre L.A.C Bittencourt18-Nov-16 6:30
Andre L.A.C Bittencourt18-Nov-16 6:30 
AnswerRe: Which to use? Pin
Hamid Mosalla25-Jul-16 5:51
Hamid Mosalla25-Jul-16 5: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.