RegionRuler 1.2.0

dotnet add package RegionRuler --version 1.2.0
                    
NuGet\Install-Package RegionRuler -Version 1.2.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="RegionRuler" Version="1.2.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RegionRuler" Version="1.2.0" />
                    
Directory.Packages.props
<PackageReference Include="RegionRuler">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 RegionRuler --version 1.2.0
                    
#r "nuget: RegionRuler, 1.2.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 RegionRuler@1.2.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=RegionRuler&version=1.2.0
                    
Install as a Cake Addin
#tool nuget:?package=RegionRuler&version=1.2.0
                    
Install as a Cake Tool

RegionRuler

一个用于规范化 C# 代码中 **#region **块命名的 Roslyn 分析器。

Features

  • 检查 #region 名称是否符合规范
  • 支持.editorconfig自定义配置
  • 支持正则表达式
  • 回退默认值
  • 大小写敏感配置
  • 允许空名称

Quick start

使用NUGET下载,
或者,
在项目文件 .csproj 中添加引用:

    <PackageReference Include="RegionRuler" Version="1.2.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>

Config

在项目根目录创建 .editorconfig 文件:

Default config

root = true

[*.cs]

# Allowed region name
# 允许的Region名字
region_ruler.allowed_region_name = Main

# Using regex pattern
# 正则表达式
region_ruler.allowed_regex_pattern = ^(Private|Public).*

# Case sensitivity (default False)
# 区分大小写 (默认False)
region_ruler.case_sensitive = false

# Empty name (default False)
# 空名字 (默认False)
region_ruler.allow_empty = false

默认配置

如果不配置任何选项,分析器会使用以下默认的允许名称列表:

  • 成员分类:PUBLIC_MEMBERS, PRIVATE_MEMBERS, PROTECTED_MEMBERS, INTERNAL_MEMBERS
  • 属性分类:PUBLIC_PROPERTIES, PRIVATE_PROPERTIES, PROTECTED_PROPERTIES, INTERNAL_PROPERTIES
  • 字段分类:PUBLIC_FIELDS, PRIVATE_FIELDS, PROTECTED_FIELDS, INTERNAL_FIELDS
  • 方法分类:PUBLIC_METHODS, PRIVATE_METHODS, PROTECTED_METHODS, INTERNAL_METHODS, OVERRIDE_METHODS, ABSTRACT_METHODS, STATIC_METHODS
  • 生命周期:CONSTRUCTOR, DESTRUCTOR, INITIALIZATION
  • 其他:EVENT_CALLBACKS, HELPERS, UTILITIES
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • 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.2.0 99 1/18/2026
1.1.0 92 1/18/2026