Skip to content
kurnakovv edited this page May 28, 2026 · 5 revisions

πŸ“™ Description

Import specific rule groups (e.g., CA / IDE / SA / Roslynator, etc.) from separate files or URLs for better organization and maintainability.

πŸ’» Usage

Structure

.biak/
β”œβ”€β”€ Categories/
β”‚ β”œβ”€β”€ .editorconfig-CodeAnalysis-CAxxxx
β”‚ β”œβ”€β”€ .editorconfig-CodeStyle-IDExxxx
β”‚ β”œβ”€β”€ .editorconfig-IDisposableAnalyzers
β”‚ β”œβ”€β”€ .editorconfig-kuker
β”‚ β”œβ”€β”€ .editorconfig-Roslynator
β”‚ └── .editorconfig-StyleCop
β”‚
β”œβ”€β”€ .editorconfig-main
└── config.json

.editorconfig-main

root = true

[*]
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

^biak^ import "Categories/.editorconfig-CodeAnalysis-CAxxxx"

^biak^ import "Categories/.editorconfig-CodeStyle-IDExxxx"

^biak^ import "Categories/.editorconfig-IDisposableAnalyzers"

^biak^ import "Categories/.editorconfig-kuker"

^biak^ import "Categories/.editorconfig-Roslynator"

^biak^ import "Categories/.editorconfig-StyleCop"

...

Where files at the specified paths are taken and replaced with the contents of these files, for example

.biak/Categories/.editorconfig-Roslynator

[*.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
roslynator_max_line_length = 200
dotnet_diagnostic.rcs0056.severity = error

# VS extension https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelines
guidelines = 200
guidelines_style = 1px dotted purple

dotnet_diagnostic.rcs0009.severity = error # RCS0009: Add blank line between declaration and documentation comment https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0009
dotnet_diagnostic.rcs0021.severity = error # RCS0021: Format block's braces on a single line or multiple lines https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0021
dotnet_diagnostic.rcs0027.severity = error # RCS0027: Place new line after/before binary operator https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0027
dotnet_diagnostic.rcs0031.severity = error # RCS0031: Put enum member on its own line https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0031

After running the Enable / Disable commands, the .editorconfig file is converted to:

.editorconfig

root = true

[*]
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.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
roslynator_max_line_length = 200
dotnet_diagnostic.rcs0056.severity = error

# VS extension https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelines
guidelines = 200
guidelines_style = 1px dotted purple

dotnet_diagnostic.rcs0009.severity = error # RCS0009: Add blank line between declaration and documentation comment https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0009
dotnet_diagnostic.rcs0021.severity = error # RCS0021: Format block's braces on a single line or multiple lines https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0021
dotnet_diagnostic.rcs0027.severity = error # RCS0027: Place new line after/before binary operator https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0027
dotnet_diagnostic.rcs0031.severity = error # RCS0031: Put enum member on its own line https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0031

[*.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
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.LayoutRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.MaintainabilityRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.NamingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.OrderingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.ReadabilityRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpacingRules.severity = none
dotnet_analyzer_diagnostic.category-StyleCop.CSharp.SpecialRules.severity = none


dotnet_diagnostic.SA1001.severity = error # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1001.md Use <GenerateDocumentationFile>true</GenerateDocumentationFile>
dotnet_diagnostic.SA1002.severity = error # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1002.md
dotnet_diagnostic.SA1003.severity = error # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1003.md

...

As you can see, imports were replaced by content from these same files.

This feature can also be used for links and will work in the same way as for files.

root = true

[*]
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

# Code analysis (CAxxxx) rules
^biak^ import https://gist.githubusercontent.com/kurnakovv/7ca966f8099209136f4baa87d804d39c/raw/cfb32e5b1da5c9dcd7340de5f1d166109642979d/.editorconfig

# Code-style (IDExxxx) rules
^biak^ import https://gist.githubusercontent.com/kurnakovv/b396696805339988a547c6d53a0d0254/raw/193bb9d95f8132a690d7a3e51aa8291bd2bb4dba/.editorconfig

πŸ—’οΈ Notes

  • Import files only from the .biak folder. This is done for security purposes, so that an attacker cannot import files outside .biak and, for example, obtain the contents of secret files ^biak^ import "../../secretFile" -> mySuperSecretValue. If this rule is violated, a warning will be issued and this import will not be replaced.

  • If file not found, then a warning will be issued and this import will not be replaced.

  • If the content from the URL could not be obtained, then a warning will be issued and this import will not be replaced.

  • If the URL uses HTTP or points to a private network or localhost, then a warning will be issued and this import will not be replaced.

  • If the URL response exceeds 5 MB, the import will not be replaced. This restriction is enforced for security reasons.

  • If the content type is not text, but an image or another format, then this import will not be replaced.

  • If the import is commented out # ^biak^ import "...", it will not be applied.

Note

You can override the behavior on import failures using the onImportFailure config field (docs).

πŸ”— Links

βš™οΈ Enable / Disable .editorconfig rules

πŸ—‚οΈ Imports

πŸ“¦ Variables

πŸ”Ž Include / Exclude filter

πŸ§‘β€πŸ’» Find activity

βš”οΈ Find conflicts

Clone this wiki locally