Foundation icon indicating copy to clipboard operation
Foundation copied to clipboard

Enable code analysis with roslyn analyzers

Open balanikas opened this issue 5 years ago • 2 comments

Adding and enabling analyzers in the foundation solution produces warnings and recommendation that increase awareness of code issues and therefore code quality.

Add these 2 analyzers: https://www.nuget.org/packages/Microsoft.CodeAnalysis.FxCopAnalyzers (strongly recommended) which is a collection of recommended analyzers by Microsoft. https://www.nuget.org/packages/microsoft.visualstudio.threading.analyzers (secondary but useful) which suggests some threading related good practices.

The severity of issues in both packages can be configured but i recommend that initially the severity level is set to informational or warning, to not be obtrusive.

Add them either per project as needed, or via global configuration (i.e. analyzers.props)

balanikas avatar Nov 12 '19 17:11 balanikas

I second the use on analysers. We should also add this analyser to add some Episerver best practices: https://world.episerver.com/blogs/mads-storm-hansen/dates/2019/11/introducing-code-analyzers-for-episerver/

davidknipe avatar Nov 12 '19 17:11 davidknipe

This might be a harder sell but Install-Package StyleCop.Analyzers would help as well.

krompaco avatar Nov 12 '19 22:11 krompaco