Skip to content

Instantly share code, notes, and snippets.

View kurnakovv's full-sized avatar
👴
Dead inside, Babka outside...

kurnakovv

👴
Dead inside, Babka outside...
View GitHub Profile
@kurnakovv
kurnakovv / .editorconfig
Last active July 15, 2026 02:42
Favorite JetBrains ReSharper InspectCode rules in .editorconfig
[*]
##
## JetBrains ReSharper InspectCode
##
# All rules here https://www.jetbrains.com/help/resharper/Reference__Code_Inspections_CSHARP.html
# + - good
# - - bad
# d - duplicate
@kurnakovv
kurnakovv / Directory.Build.props
Last active May 29, 2026 12:16
Favorite Directory.Build.props file
<Project>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>NU1901,NU1902,NU1903,NU1904</WarningsNotAsErrors>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Roslynator.Formatting.Analyzers" Version="4.15.0">
@kurnakovv
kurnakovv / .editorconfig
Last active November 29, 2025 05:53
Favorite Roslynator rules in .editorconfig
[*.cs]
##
## Roslynator
##
# All rules here https://josefpihrt.github.io/docs/roslynator/configuration
# Disable all rules
dotnet_analyzer_diagnostic.category-roslynator.severity = none
# Row length limits
@kurnakovv
kurnakovv / .editorconfig
Last active March 11, 2026 13:23
Favorite StyleCop.Analyzers rules in .editorconfig
[*.cs]
# https://gist.github.com/kurnakovv/70a5d76dc5f3eb9ef114b182283cb407
##
## StyleCop.Analyzers
##
# All rules here https://github.com/DotNetAnalyzers/StyleCopAnalyzers/tree/master/documentation
# Disable all rules
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.AlternativeRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.DocumentationRules.severity = none
@kurnakovv
kurnakovv / DotnetFormat-GitBranchChanges.ps1
Created November 3, 2025 07:30
Run dotnet format only for current git branch changes | PowerShell script
$baseBranch = "main" # or "master"
$currentBranch = git rev-parse --abbrev-ref HEAD
# Get changed file names in current branch
$files = git diff --name-only $baseBranch
# Delete useless spaces
$files = $files | Where-Object { $_ -ne "" }
if ($files.Count -eq 0) {
@kurnakovv
kurnakovv / DotnetFormat-GitCurrentChanges.ps1
Last active November 3, 2025 07:43
Run dotnet format only for git changes (`git status` files)
# Get git current changes (file names)
$files = git status --porcelain | ForEach-Object {
$_.Substring(3)
}
if ($files.Count -eq 0) {
Write-Host "No diff"
exit
}
@kurnakovv
kurnakovv / .editorconfig
Last active November 15, 2025 06:00
All IDisposableAnalyzers rules in .editorconfig
##
## IDisposableAnalyzers rules
##
# All rules here https://github.com/DotNetAnalyzers/IDisposableAnalyzers
dotnet_diagnostic.IDISP001.severity = suggestion # Dispose created
dotnet_diagnostic.IDISP002.severity = suggestion # Dispose member
dotnet_diagnostic.IDISP003.severity = suggestion # Dispose previous before re-assigning
dotnet_diagnostic.IDISP004.severity = suggestion # Don't ignore created IDisposable
dotnet_diagnostic.IDISP005.severity = suggestion # Return type should indicate that the value should be disposed
@kurnakovv
kurnakovv / .editorconfig
Last active November 15, 2025 06:11
Favorite Code analysis (CAxxxx) rules in .editorconfig
[*.cs]
##
## Code analysis (CAxxxx) rules
##
# All rules here https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/categories
### Design rules ###
# ✅ Good
@kurnakovv
kurnakovv / .editorconfig
Last active November 16, 2025 03:47
Favorite Code-style (IDExxxx) rules in .editorconfig
[*.cs]
##
## Code-style (IDExxxx) rules
##
# All rules here https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules
dotnet_analyzer_diagnostic.category-Style.severity = error
dotnet_analyzer_diagnostic.category-CodeQuality.severity = error
@kurnakovv
kurnakovv / .editorconfig
Last active November 15, 2025 05:58
WarningsAsErrors for all nullable codes in .editorconfig | NullReferenceException (NRE)
[*.cs]
##
## NullReferenceException (NRE) or nullable
##
# All rules here https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/nullable-warnings
# Thrown value may be null.
dotnet_diagnostic.CS8597.severity = error