Try our conversational search powered by Generative AI!

Mads Storm Hansen
Nov 7, 2019
  1828
(6 votes)

Introducing Code analyzers for Episerver

Code analyzers for Episerver is a new Roslyn-based plugin that analyzes your Episerver code as you type. It can help you avoid some problems with editor experience and code maintainability.
The plugin will show live warnings ("squiggles") in Visual Studio while you are typing.

Analyzers

Inspired by a recent blog post, Code analyzers for Episerver looks for the correct use of content type and property attributes to ensure a good experience for your editors.

The analyzer rules can be configured individually and phased in gradually in a larger codebase.

Code analyzers for Episerver also looks for the use of known legacy types and 'Internal' namespaces that should be avoided in your code.

Configuration

Each analyzer rule severity can be configured in a ruleset file similar to Visual Studios built-in code analysis.

Installation

Code analyzers for Episerver is installed per-project as a NuGet package from the Episerver feed.

Visual Studio automatically detects and executes the analyzers. Build servers will also execute the analyzer rules on every build.

Compatibility

Code analyzers for Episerver is compatible with the compilers in Visual Studio 2019 and Visual Studio 2017 (15.5+).

If your project references an old version of the Microsoft.Net.Compilers package you may need to upgrade this to 2.6.1+ for compatibility with Code analyzers for Episerver.

Nov 07, 2019

Comments

Petter Klang
Petter Klang Nov 7, 2019 08:50 AM

Nice!

Antti Alasvuo
Antti Alasvuo Nov 7, 2019 04:51 PM

Very nice Mads!

David Knipe
David Knipe Nov 8, 2019 07:20 AM

Very nice! 

Johan Björnfot
Johan Björnfot Nov 20, 2019 10:56 AM

Nice! A nice addition would be an analyzer that detects if you use types from internal namespaces (I have a prototype of such an analyzer in some closet somewhere ;-) ).

Mads Storm Hansen
Mads Storm Hansen Nov 20, 2019 11:44 AM

Thanks Johan. It already detects types from Internal Episerver/Mediachase namespaces.

Latest addition (v1.1) is detecting use of older concrete Order classes (Cart, LineItem etc.) where interfaces are preferred.

Linus Ekström
Linus Ekström Nov 30, 2019 10:32 AM

Nice work Mads - very useful!

Please login to comment.
Latest blogs
Solving the mystery of high memory usage

Sometimes, my work is easy, the problem could be resolved with one look (when I’m lucky enough to look at where it needs to be looked, just like th...

Quan Mai | Apr 22, 2024 | Syndicated blog

Search & Navigation reporting improvements

From version 16.1.0 there are some updates on the statistics pages: Add pagination to search phrase list Allows choosing a custom date range to get...

Phong | Apr 22, 2024

Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog