Skip to content

Commit fd3be55

Browse files
committed
Update
1 parent 6e4bafd commit fd3be55

File tree

2 files changed

+39
-10
lines changed

2 files changed

+39
-10
lines changed

src/.editorconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR___
397397

398398
# All constant fields must be PascalCase
399399
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md
400-
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected, local
400+
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
401401
dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const
402402
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field
403403
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group
@@ -406,7 +406,7 @@ dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity
406406

407407
# All static readonly fields must be PascalCase
408408
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md
409-
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected, local
409+
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
410410
# dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly
411411
dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static
412412
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field
@@ -918,7 +918,7 @@ dotnet_diagnostic.S1210.severity = warning
918918
dotnet_diagnostic.S1215.severity = warning
919919
dotnet_diagnostic.S122.severity = warning
920920
dotnet_diagnostic.S1226.severity = warning
921-
dotnet_diagnostic.S1227.severity = warning
921+
# dotnet_diagnostic.S1227.severity = warning # This rule is deprecated
922922
dotnet_diagnostic.S1244.severity = warning
923923
dotnet_diagnostic.S125.severity = warning
924924
dotnet_diagnostic.S126.severity = warning

template/src/.editorconfig

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,26 @@ dotnet_naming_style.begins_with_i.capitalization = pascal_case
311311

312312
##########################################
313313
# .NET Naming Rules
314-
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/naming-rules
314+
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/naming-rules
315315
# 命名规则由 符号规范和命名样式 组成,使用 symbols 和 style 配置,可以复用
316316
##########################################
317317

318+
# all dotnet_naming_symbols propertyValue
319+
# dotnet_naming_symbols.interface.applicable_kinds = namespace, class, struct, interface, enum, property, method, field, event, delegate, parameter, type_parameter, local, local_function
320+
# dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected, local
321+
# dotnet_naming_symbols.interface.required_modifiers = abstract, async, const, readonly, static
322+
323+
# all dotnet_naming_style propertyValue
324+
# dotnet_naming_style.pascal_case.capitalization = pascal_case, camel_case, first_word_upper, all_upper, all_lower
325+
# dotnet_naming_style.pascal_case.required_prefix =
326+
# dotnet_naming_style.pascal_case.required_suffix =
327+
# dotnet_naming_style.pascal_case.word_separator =
328+
329+
# all dotnet_naming_rule propertyValue
330+
# dotnet_naming_rule.private_static_fields_none.symbols = interface
331+
# dotnet_naming_rule.private_static_fields_none.style = pascal_case
332+
# dotnet_naming_rule.private_static_fields_none.severity = none
333+
318334
#### Styles ####
319335

320336
# camel_case_style - Define the camelCase style
@@ -381,7 +397,7 @@ dotnet_naming_style.internal_error_style.required_suffix = ____INTERNAL_ERROR___
381397

382398
# All constant fields must be PascalCase
383399
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1303.md
384-
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
400+
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
385401
dotnet_naming_symbols.stylecop_constant_fields_group.required_modifiers = const
386402
dotnet_naming_symbols.stylecop_constant_fields_group.applicable_kinds = field
387403
dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.symbols = stylecop_constant_fields_group
@@ -390,7 +406,7 @@ dotnet_naming_rule.stylecop_constant_fields_must_be_pascal_case_rule.severity
390406

391407
# All static readonly fields must be PascalCase
392408
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1311.md
393-
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected, private
409+
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
394410
# dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static, readonly
395411
dotnet_naming_symbols.stylecop_static_readonly_fields_group.required_modifiers = static
396412
dotnet_naming_symbols.stylecop_static_readonly_fields_group.applicable_kinds = field
@@ -400,7 +416,7 @@ dotnet_naming_rule.stylecop_static_readonly_fields_must_be_pascal_case_rule.seve
400416

401417
# No non-private instance fields are allowed
402418
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1401.md
403-
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected_internal, protected, private_protected
419+
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_accessibilities = public, internal, protected, protected_internal, private_protected
404420
dotnet_naming_symbols.stylecop_fields_must_be_private_group.applicable_kinds = field
405421
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.symbols = stylecop_fields_must_be_private_group
406422
dotnet_naming_rule.stylecop_instance_fields_must_be_private_rule.style = disallowed_style
@@ -444,7 +460,7 @@ dotnet_naming_rule.sanity_check_uncovered_field_case_rule.severity
444460
# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-classes-structs-and-interfaces#names-of-common-types
445461
# - Constructors, Properties, Events, Methods
446462
# https://docs.microsoft.com/dotnet/standard/design-guidelines/names-of-type-members
447-
dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, enum, struct, delegate, event, method, property
463+
dotnet_naming_symbols.element_group.applicable_kinds = namespace, class, struct, enum, property, method, field, event, delegate
448464
dotnet_naming_rule.element_rule.symbols = element_group
449465
dotnet_naming_rule.element_rule.style = pascal_case_style
450466
dotnet_naming_rule.element_rule.severity = warning
@@ -553,8 +569,10 @@ dotnet_diagnostic.IDE0055.severity = suggestion
553569
# IDE0061: 使用本地函数的块主体
554570
dotnet_diagnostic.IDE0061.severity = suggestion
555571

556-
# 使结构字段可写
572+
# 使结构字段可写,不要使用可写字段
557573
dotnet_diagnostic.IDE0064.severity = error
574+
# 结构可以使用字段
575+
dotnet_code_quality.ca1051.exclude_structs = true
558576

559577
# IDE0072: Add missing cases
560578
dotnet_diagnostic.IDE0072.severity = error
@@ -900,7 +918,7 @@ dotnet_diagnostic.S1210.severity = warning
900918
dotnet_diagnostic.S1215.severity = warning
901919
dotnet_diagnostic.S122.severity = warning
902920
dotnet_diagnostic.S1226.severity = warning
903-
dotnet_diagnostic.S1227.severity = warning
921+
# dotnet_diagnostic.S1227.severity = warning # This rule is deprecated
904922
dotnet_diagnostic.S1244.severity = warning
905923
dotnet_diagnostic.S125.severity = warning
906924
dotnet_diagnostic.S126.severity = warning
@@ -1479,6 +1497,9 @@ dotnet_diagnostic.S1186.severity = error
14791497
# S1206: "Equals(Object)" and "GetHashCode()" should be overridden in pairs
14801498
dotnet_diagnostic.S1206.severity = error
14811499

1500+
# "GC.Collect" should not be called
1501+
dotnet_diagnostic.S1215.severity = error
1502+
14821503
# Floating point numbers should not be tested for equality 浮点数不应测试相等性
14831504
dotnet_diagnostic.S1244.severity = error
14841505

@@ -1576,6 +1597,14 @@ resharper_indent_nested_while_stmt = true
15761597
resharper_indent_raw_literal_string = do_not_change
15771598
resharper_outdent_statement_labels = true
15781599

1600+
[*{Benchmark,Benchmarks}.cs]
1601+
# CA1707: Identifiers should not contain underscores
1602+
dotnet_diagnostic.CA1707.severity = none
1603+
# CRR0035 - No CancellationToken parameter in the asynchronous method
1604+
dotnet_diagnostic.CRR0035.severity = none
1605+
# CA1822: Mark members as static
1606+
dotnet_diagnostic.CA1822.severity = none
1607+
15791608
[*{Test,Tests}.cs]
15801609
# CA1707: Identifiers should not contain underscores
15811610
dotnet_diagnostic.CA1707.severity = none

0 commit comments

Comments
 (0)