# EditorConfig is awesome: https://EditorConfig.org
# Please feel free to update it (by considering the code style of ABP Team).
# top-most EditorConfig file
root = true

[*.cs]

#Namespace设置
# noinspection EditorConfigKeyCorrectness
csharp_style_namespace_declarations = file_scoped

# diagnostic规则配置 各个项目自己定义
# noinspection EditorConfigKeyCorrectness
# CS8618 表示在定义非空属性时，没有在构造函数、初始化器或默认值中对其进行初始化。
dotnet_diagnostic.CS8618.severity = none
# noinspection EditorConfigKeyCorrectness
# CS8618 表示方法的返回类型的可空性与目标委托的不匹配。
dotnet_diagnostic.CS8613.severity = none
# noinspection EditorConfigKeyCorrectness
# CS1591 表示缺少XML注释
dotnet_diagnostic.CS1591.severity = none

#Core editorconfig formatting - indentation

#使用制表符进行缩进
# noinspection EditorConfigValueCorrectness
indent_style = tabs

#Formatting - indentation options

#缩进switch case内容
csharp_indent_case_contents = true
#缩进switch标签
csharp_indent_switch_labels = true

#Formatting - new line options

#在新行上放置catch语句
csharp_new_line_before_catch = true
#在新行上放置else语句
csharp_new_line_before_else = true
#要求对象初始化器的成员在单独的行上
csharp_new_line_before_members_in_object_initializers = true
#要求在对象集合数组初始化器、方法、控制块、类型和lambda表达式的花括号前换行（也称为“Allman”风格）
csharp_new_line_before_open_brace = object_collection_array_initializers, methods, control_blocks, types, lambdas

#Formatting - organize using options

#按字母顺序排序System.*using指令，并将它们放在其他using指令之前
dotnet_sort_system_directives_first = true

#Formatting - spacing options

#要求在类型转换和值之间不留空格
csharp_space_after_cast = false
#在类型声明中要求在基类或接口的冒号前留空格
csharp_space_after_colon_in_inheritance_clause = true
#在控制流语句（如for循环）中的关键字后要求留空格
csharp_space_after_keywords_in_control_flow_statements = true
#在类型声明中要求在基类或接口的冒号前留空格
csharp_space_before_colon_in_inheritance_clause = true
#删除空参数列表括号内的空格
csharp_space_between_method_call_empty_parameter_list_parentheses = false
#删除方法调用名称和左括号之间的空格
csharp_space_between_method_call_name_and_opening_parenthesis = false
#在方法调用的左括号后和右括号前不要留空格
csharp_space_between_method_call_parameter_list_parentheses = false
#删除方法声明中空参数列表括号内的空格
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
#在方法声明参数列表的左括号后和右括号前留空格
csharp_space_between_method_declaration_parameter_list_parentheses = false

#Formatting - wrapping options

#将代码块留在单行上
csharp_preserve_single_line_blocks = true

#Style - Code block preferences

#即使是单行代码也使用花括号
csharp_prefer_braces = true:suggestion

#Style - expression bodied member options

#构造函数使用块体
csharp_style_expression_bodied_constructors = false:suggestion
#方法使用块体
csharp_style_expression_bodied_methods = false:suggestion
#属性使用表达式体
csharp_style_expression_bodied_properties = true:suggestion

#Style - expression level options

#尽可能在方法调用的参数列表中内联声明out变量
csharp_style_inlined_variable_declaration = true:suggestion
#对于有关键字表示的类型，成员访问表达式使用语言关键字而不是类型名
dotnet_style_predefined_type_for_member_access = true:suggestion

#Style - Expression-level preferences

#使用default而不是default(T)
csharp_prefer_simple_default_expression = true:suggestion
#尽可能使用对象初始化器初始化对象
dotnet_style_object_initializer = true:suggestion
#使用推断的元组元素名称
dotnet_style_prefer_inferred_tuple_names = true:suggestion

#Style - implicit and explicit types

#在所有情况下都使用var代替显式类型，除非被其他代码样式规则覆盖
csharp_style_var_elsewhere = true:suggestion
#使用var声明内置系统类型（如int）的变量
csharp_style_var_for_built_in_types = true:suggestion
#当类型已经在声明表达式的右侧提及时，使用var
csharp_style_var_when_type_is_apparent = true:suggestion

#Style - language keyword and framework type options

#对于有关键字表示的类型，局部变量、方法参数和类成员使用语言关键字而不是类型名
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion

#Style - Miscellaneous preferences

#使用局部函数而不是匿名函数
csharp_style_pattern_local_over_anonymous_function = true:suggestion

#Style - modifier options

#除了公共接口成员外，偏好声明访问修饰符。这目前不会与“总是”不同，并且将在C#添加默认接口方法时作为未来的保护措施。
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion

#Style - Modifier preferences

#当此规则设置为修饰符列表时，偏好指定的顺序。
csharp_preferred_modifier_order = public, protected, private, virtual, async, readonly, static, override, abstract:suggestion

#Style - Pattern matching

#使用模式匹配而不是带有类型转换的is表达式
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion

#Style - qualification options

#偏好字段前不加this. 或 Me.（在Visual Basic中）
dotnet_style_qualification_for_field = false:suggestion
#偏好方法前不加this. 或 Me.（在Visual Basic中）
dotnet_style_qualification_for_method = false:suggestion
#偏好属性前不加this. 或 Me.（在Visual Basic中）
dotnet_style_qualification_for_property = false:suggestion