Skip to content

Roslyn-based C# code analyzer that aims to provide a set of rules that helps to simplify code and make it cleaner.

Notifications You must be signed in to change notification settings

blowin/BlowinCleanCode

Repository files navigation

Roslyn analyzer

Build

Source Link
VSIX VSIX
VSIX(VS22) VSIX
Nuget NUGET package

Introduction

BlowinCleanCode is a Roslyn-based C# code analyzer that aims to provide a set of rules that helps to simplify code and make it cleaner.

Changelog

Available analyses

Single responsibility

  • Method contain 'And'
  • Control flag
  • Long method
  • Cognitive complexity of the method
  • Many parameter in method
  • Method contains a lot of declaration
  • Too many chained references
  • Large class
  • Large number of fields in types
  • Lambda have too many lines

Encapsulation

  • Don't use public static field

Good practice

  • Don't return null
  • Don't use static class
  • Disposable member in non disposable class
  • Switch statements should have at least 2 case clauses
  • Finalizers should not be empty
  • Type that provide Equals should implement IEquatable
  • 'ThreadStatic" fields should not be initialized.
  • Name is too long
  • Use only ASCII characters for names

Code smell

  • Nested ternary operator
  • Complex condition
  • Magic value
  • Preserve whole object
  • Hollow type name
  • Deeply nested
  • Switch should not have a lot of cases
  • Switch statements should not be nested
  • Catch should do more than rethrow
  • Empty 'default' clauses should be removed
  • Middle man

About

Roslyn-based C# code analyzer that aims to provide a set of rules that helps to simplify code and make it cleaner.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published