Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blowin/BlowinCleanCode
Roslyn-based C# code analyzer that aims to provide a set of rules that helps to simplify code and make it cleaner.
https://github.com/blowin/BlowinCleanCode
clean-code roslyn roslyn-analyzer
Last synced: 3 months ago
JSON representation
Roslyn-based C# code analyzer that aims to provide a set of rules that helps to simplify code and make it cleaner.
- Host: GitHub
- URL: https://github.com/blowin/BlowinCleanCode
- Owner: blowin
- Created: 2021-06-08T16:54:52.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-23T16:28:32.000Z (almost 2 years ago)
- Last Synced: 2024-05-18T22:33:51.499Z (9 months ago)
- Topics: clean-code, roslyn, roslyn-analyzer
- Language: C#
- Homepage:
- Size: 417 KB
- Stars: 14
- Watchers: 4
- Forks: 1
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
Awesome Lists containing this project
- awesome-analyzers - BlowinCleanCode - 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. (Popular Analyzers / Analyzer collections)
README
### Roslyn analyzer
![Build](https://github.com/blowin/BlowinCleanCode/actions/workflows/dotnet.yml/badge.svg)
| Source | Link |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| VSIX | [![VSIX](https://img.shields.io/visual-studio-marketplace/i/Blowin.1)](https://marketplace.visualstudio.com/items?itemName=Blowin.1) |
| VSIX(VS22) | [![VSIX](https://img.shields.io/visual-studio-marketplace/i/Blowin.BlowinCleanCodeVS22)](https://marketplace.visualstudio.com/items?itemName=Blowin.BlowinCleanCodeVS22) |
| Nuget | [![NUGET package](https://img.shields.io/nuget/v/Blowin.CleanCode.svg)](https://www.nuget.org/packages/Blowin.CleanCode/) |## 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](https://github.com/blowin/BlowinCleanCode/blob/master/changelog.md)
## Available analyses
### Single responsibility
* Method contain 'And'
* Control flag
* Long method
* [Cognitive complexity of the method](https://www.sonarsource.com/docs/CognitiveComplexity.pdf)
* 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](https://refactoring.guru/smells/middle-man)