| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- # OmegaAi BackEnd 统一代码格式规范
- # 说明:本文件为后端所有微服务共享的代码格式基准。
- # 规则以「仅统一格式、不强制重命名」为原则 —— 属性名/方法名与 DB 列名、OmegaRouter URL 字典、前端 match 强绑定,不做自动改名。
- root = true
- # ============ 基础编码 ============
- [*]
- end_of_line = lf
- indent_style = space
- indent_size = 4
- trim_trailing_whitespace = true
- insert_final_newline = true
- # ============ C# 格式规则 ============
- [*.cs]
- # --- 命名规则:不强制自动重命名(IDE1006)---
- dotnet_diagnostic.IDE1006.severity = none
- # 保持 block-scoped 命名空间,不自动改为 file-scoped(避免整体重排缩进)
- dotnet_diagnostic.IDE0161.severity = none
- # 不自动补 private/readonly 等修饰符,避免无关改动
- dotnet_diagnostic.IDE0040.severity = none
- dotnet_diagnostic.IDE0044.severity = none
- # 不自动改 var / 显式类型
- dotnet_diagnostic.IDE0007.severity = none
- dotnet_diagnostic.IDE0008.severity = none
- # 不自动调整未使用参数
- dotnet_diagnostic.IDE0060.severity = none
- # --- using 指令:System 优先 + 分组排序 ---
- dotnet_sort_system_directives_first = true
- dotnet_separate_import_directive_groups = true
- # --- 大括号:Allman 风格(另起一行)---
- csharp_new_line_before_open_brace = all
- csharp_new_line_before_else = true
- csharp_new_line_before_catch = true
- csharp_new_line_before_finally = true
- csharp_new_line_before_members_in_object_initializers = true
- csharp_new_line_before_members_in_anonymous_types = true
- csharp_new_line_between_query_expression_clauses = true
- # --- 缩进 ---
- csharp_indent_block_contents = true
- csharp_indent_braces = false
- csharp_indent_case_contents = true
- csharp_indent_case_contents_when_block = true
- csharp_indent_switch_labels = true
- csharp_indent_labels = one_less_than_current
- # --- 空格 ---
- csharp_space_after_cast = false
- csharp_space_after_keywords_in_control_flow_statements = true
- csharp_space_between_method_declaration_parameter_list_parentheses = false
- csharp_space_between_method_call_parameter_list_parentheses = false
- csharp_space_between_parentheses = false
- csharp_space_around_binary_operators = before_and_after
- csharp_space_after_colon_in_inheritance_clause = true
- csharp_space_before_colon_in_inheritance_clause = true
- csharp_space_after_comma = true
- csharp_space_before_comma = false
- csharp_space_after_dot = false
- csharp_space_before_dot = false
- csharp_space_after_semicolon_in_for_statement = true
- csharp_space_before_semicolon_in_for_statement = false
- csharp_space_around_declaration_statements = ignore
- # --- 表达式级 ---
- csharp_style_var_elsewhere = false
- csharp_style_expression_bodied_methods = false:silent
- csharp_style_expression_bodied_constructors = false:silent
- csharp_style_expression_bodied_operators = false:silent
- csharp_style_expression_bodied_properties = true:suggestion
|