• Stars
    star
    122
  • Rank 292,031 (Top 6 %)
  • Language
    C#
  • License
    MIT License
  • Created over 4 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A set of annotations and analyzers that add additional constraints to your codebase

CSharpExtensions

Nuget packge: https://www.nuget.org/packages/SmartAnalyzers.CSharpExtensions.Annotations/

Articles that explain implemented concepts:

Analyzers

Rule Description Related attributes Documentation
CSE001 Required properties initialization [InitRequired], [InitRequiredForNotNull] link
CSE002 InitOnly member modification [InitOnly], [InitOnlyOptional] link
CSE003 Type should have the same fields as twin type [TwinType] link
CSE004 Member with InitOnlyOptional requires default value [InitOnlyOptional]
CSE005 Return value unused link
CSE006 Expression too complex
CSE007 Return disposable value unused Same as SE005 but tracks only IDisposable and IAsyncDisposable values
CSE008 Return async result unused Same as SE005 but tracks only IAsyncResult (Task, ValueTask) values
CSE009 Task variable not awaited Check if task stored in a variable is awaited

Configuration

Add CSharpExtensions.json file with custom configuration:

{
  "CSE005": {
    "IgnoredReturnTypes": [ 
        "Microsoft.Extensions.DependencyInjection.IServiceCollection",
        "Microsoft.Extensions.Configuration.IConfigurationBuilder",
        "Microsoft.Extensions.Logging.ILoggingBuilder"
        ] 
  } 
}

Include config file as AdditionalFile in csproj:

<ItemGroup>
    <AdditionalFiles Include="CSharpExtensions.json" />
</ItemGroup>

Migrating from Constructors to Initialization Blocks

Step 1: Configure CSharpExtensions to report CSE001 even when constructor invocation is present

{
  "CSE001": {
    "SkipWhenConstructorUsed":  false 
  } 
}

Step 2: Execute "Try to move initialization from constructor to init block" CodeFix for CSE001 occurrences.

Feature Required in init block Can be modified outside init block Application level
init keyword NO NO Property
[InitRequired] YES YES Property. Class
[InitOnly] YES NO Property. Class
[InitOnlyOptional] NO NO Property. Class
[InitRequiredForNotNull] YES for non-null references and not Nullable<T> YES assembly

More Repositories

1

MappingGenerator

πŸ”„ "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
C#
1,031
star
2

polish-it-conferences

List of Polish IT Conferences
124
star
3

NScenario

Dead simple library for annotating steps of test case scenarios.
HTML
67
star
4

CsharpMacros

A simple template base system of macros for C# that can be executed in design time
C#
63
star
5

SmartCodeGenerator

C#
38
star
6

Tellurium

A utility pack to create maintainable and reliable UI tests using Selenium with additional support for ASP.NET MVC projects.
C#
34
star
7

msbuild-cheatsheet

34
star
8

DDDToolbox

A set of Roslyn refactorings supporting DDD design
C#
34
star
9

GRPC-Mock-Server

Super fast, platform independent, standalone component for mocking GRPC services using WireMock.NET stubbing engine
C#
32
star
10

MultithreadingAnalyzer

A set of Roslyn analyzers related to multithreading
C#
30
star
11

MappingGeneratorReleases

24
star
12

RoslynTestKit

A lightweight framework for writing unit tests for Roslyn diagnostic analyzers, code fixes, refactorings and completion providers.
C#
24
star
13

DependencyGraph

A small F# application to visualize .net assembly dependencies
F#
21
star
14

VanillaTransformer

A simple generic text file transformer
C#
20
star
15

ExceptionAnalyzer

A set of Roslyn analyzers related to exceptions usages
C#
20
star
16

ArchitecturalPatterns

Link aggregator of architectural patterns implementation
19
star
17

TCMetaRunnersPowerPack

A set of Team City meta runners
13
star
18

VsixPublisherAction

GithubAction for publishing extensions to Visual Studio Marketplace
TypeScript
11
star
19

ScriptRunnerPOC

C#
9
star
20

ProjectGraphs

PowerShell script to draw graph of c# projects dependencies
PowerShell
9
star
21

MyToolbox

7
star
22

CQRSsnippets

Resharper Live Templates for CQRS described in https://cezarypiatek.github.io/post/cqrs-snippets/
6
star
23

SampleWebApiTestsWithApprovals

C#
5
star
24

ApprovalTestsExtensions

A set of helper classes that facilitate the usage of ApprovalTests.NET library
C#
5
star
25

PluginArchitectureDemo

C#
3
star
26

Presentations

3
star
27

DebuggingDemo

C#
3
star
28

DotnetCodeAnalysisEssentialSetup

A quick guideline how to setup static code analysis for dotnet project with a list of essential analyzer packages.
3
star
29

SampleWebApiClientGeneration

C#
3
star
30

PSHistory

PowerShell lookup for recent locations and commands
PowerShell
3
star
31

NextVersionGeneratorAction

GithubAction for generating next version number based on the git log and message patterns
TypeScript
2
star
32

VsixVersionAction

GithubAction for setting Version of Visual Studio Extensions
JavaScript
2
star
33

MappingGeneratorIssueTracker

This is a issue tracker for MappingGenerator
C#
2
star
34

cezarypiatek.github.io

Personal blog https://cezarypiatek.github.io
HTML
2
star
35

SmoothSailing

A library to support Helm Chart installation in Kubernetes cluster from .NET code
C#
1
star
36

SampleRecordAnalyzer

PowerShell
1
star
37

BashVsPowerShell

Cheatsheet with syntax comparison between Bash and Powershell
1
star
38

HackingSculpfunS10

1
star
39

UniversalTemplates

C#
1
star
40

OnBuildGenerator-Example

Example usage of MappingGenerator.OnBuildGenerator
C#
1
star
41

TextExtensions

C#
1
star
42

CodePresenter

A tool to visualise your codebase
PowerShell
1
star
43

Tellurium.StableElements

A set of Selenium extensions that solve StaleElementReferenceException problem
C#
1
star