episerver / Foundation

Foundation offers a starting point that is intuitive, well-structured and modular allowing developers to explore CMS, Commerce, Personalization, Search and Navigation, Data Platform and Experimentation.
https://docs.developers.optimizely.com/digital-experience-platform/docs/optimizely-foundation-demo-sites
Apache License 2.0
132 stars 136 forks source link

Enable code analysis with roslyn analyzers #176

Open balanikas opened 4 years ago

balanikas commented 4 years ago

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)

davidknipe commented 4 years ago

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/

krompaco commented 4 years ago

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