kgh02017.CodeStyle 1.1.0

dotnet add package kgh02017.CodeStyle --version 1.1.0
                    
NuGet\Install-Package kgh02017.CodeStyle -Version 1.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="kgh02017.CodeStyle" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="kgh02017.CodeStyle" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="kgh02017.CodeStyle" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add kgh02017.CodeStyle --version 1.1.0
                    
#r "nuget: kgh02017.CodeStyle, 1.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package kgh02017.CodeStyle@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=kgh02017.CodeStyle&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=kgh02017.CodeStyle&version=1.1.0
                    
Install as a Cake Tool

kgh02017.CodeStyle

This project reflects my personal coding style and preferences. Some rules are intentionally opinionated.

Personal .NET coding style, project templates, Roslyn analyzers, and code fixes for modern C# development.

This repository contains:

  • .NET project templates
  • Coding style guidelines
  • EditorConfig settings
  • Roslyn analyzers and code fixes

The goal is to provide a consistent and opinionated development experience across personal .NET projects.

Requirements

  • .NET SDK 9.0 or later
  • C# 12 or later

Example (KGH1007)

Bad

IEnumerable<int> values = Enumerable.Range(1, 10)
    .Where(x => x > 5)
    .ToList();

Good

IEnumerable<int> values =
    Enumerable.Range(1, 10)
        .Where(x => x > 5)
        .ToList();

Packages

kgh02017.CodeStyle.Templates

Project templates for new .NET solutions.

Currently includes:

  • .editorconfig
  • Directory.Build.props
  • Directory.Packages.props
  • CodeStyle.md
  • .gitignore

kgh02017.CodeStyle

Combined Roslyn analyzers and code fixes package.

Includes all analyzers and supported code fixes.

Index
Rule ID Category Rule Description
KGH1001 Logging Do not use interpolated strings in logger calls
KGH1002 Strings Specify StringComparison
KGH1003 Nullability Prefer is null
KGH1004 Formatting Line exceeds 120 characters
KGH1005 Readability Prefer using declaration
KGH1006 Readability Prefer switch expression
KGH1007 Formatting Prefer assignment line break
KGH1008 Readability Prefer named arguments for literal
KGH1009 Nullability Prefer ArgumentNullException.ThrowIfNull
KGH1010 Logging Prefer PascalCase logger template names
KGH1011 Readability Prefer collection expression
KGH1012 Formatting Prefer consistent multiline arguments
KGH1013 Formatting Prefer consistent multiline parameters
KGH1014 Formatting Prefer leading continuation operators
KGH1015 Formatting Prefer multiline lambda indentation
KGH1016 Formatting Prefer leading pattern operators

Installation

Install the template package:

dotnet new install kgh02017.CodeStyle.Templates

Create a new coding style configuration in an existing repository:

dotnet new kgh02017.codestyle

Install the analyzers and code fixes package:

dotnet add package kgh02017.CodeStyle

Coding Style

The coding conventions are documented in:

CodeStyle.md

Key principles:

  • Readability over cleverness
  • Consistent formatting
  • Modern C# where it improves clarity
  • Minimal ceremony
  • Structured logging
  • Nullable reference types enabled

Details

Repository Structure

kgh02017.CodeStyle
|
|-- src
|   |-- kgh02017.CodeStyle.Templates
|   |-- kgh02017.CodeStyle.Analyzers
|   `-- kgh02017.CodeStyle.CodeFixes
|
|-- tests
|   |-- kgh02017.CodeStyle.Analyzers.Tests
|   `-- kgh02017.CodeStyle.CodeFixes.Tests
|
|-- .editorconfig
|-- Directory.Build.props
|-- Directory.Packages.props
`-- CodeStyle.md

License

Licensed under the MIT License.

Author

Taku Izumi

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.0 97 7/6/2026
1.0.0 99 7/2/2026
1.0.0-preview.6 50 7/2/2026
1.0.0-preview.5 55 6/30/2026
1.0.0-preview.4 58 6/23/2026
1.0.0-preview.3 60 6/21/2026
1.0.0-preview.2 75 6/20/2026
1.0.0-preview.1 64 6/9/2026