Skip to content

Commit fc439c6

Browse files
committed
Update
1 parent 26c9279 commit fc439c6

File tree

2 files changed

+45
-17
lines changed

2 files changed

+45
-17
lines changed

template/src/.editorconfig

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ dotnet_analyzer_diagnostic.severity = warning
8888
# dotnet_analyzer_diagnostic.category-Naming.severity = warning
8989
dotnet_analyzer_diagnostic.category-Performance.severity = error
9090
# dotnet_analyzer_diagnostic.category-SingleFile.severity = warning
91-
# dotnet_analyzer_diagnostic.category-Reliability.severity = warning
92-
# dotnet_analyzer_diagnostic.category-Security.severity = warning
91+
dotnet_analyzer_diagnostic.category-Reliability.severity = error
92+
dotnet_analyzer_diagnostic.category-Security.severity = error
9393
# dotnet_analyzer_diagnostic.category-Style.severity = warning
9494
# dotnet_analyzer_diagnostic.category-Usage.severity = warning
9595

@@ -551,7 +551,7 @@ dotnet_diagnostic.IDE0047.severity = suggestion
551551
# IDE0049: 简化名称
552552
dotnet_diagnostic.IDE0049.severity = suggestion
553553

554-
# IDE0051: Remove unused private members,关闭,防止 cleanup 自动删除成员
554+
# IDE0051: Remove unused private members,改为 suggestion 防止 cleanup 自动删除成员并保留灰色,使用 S1144 警告
555555
dotnet_diagnostic.IDE0051.severity = suggestion
556556

557557
# IDE0054: 使用复合分配
@@ -572,7 +572,7 @@ dotnet_diagnostic.IDE0061.severity = suggestion
572572
# 使结构字段可写,不要使用可写字段
573573
dotnet_diagnostic.IDE0064.severity = error
574574
# 结构可以使用字段
575-
dotnet_code_quality.ca1051.exclude_structs = true
575+
dotnet_code_quality.CA1051.exclude_structs = true
576576

577577
# IDE0072: Add missing cases
578578
dotnet_diagnostic.IDE0072.severity = error
@@ -728,6 +728,12 @@ dotnet_diagnostic.CS8847.severity = error
728728
#### performance warnings ####
729729
# https://learn.microsoft.com/zh-cn/dotnet/fundamentals/code-analysis/quality-rules/performance-warnings
730730

731+
# CA1815:重写值类型上的 Equals 和相等运算符 改为 none 防止 cleanup 自动,使用 S3898 警告
732+
dotnet_diagnostic.CA1815.severity = none
733+
734+
# CA1822: Mark members as static 改为 none 防止 cleanup 自动 static,使用 S2325 警告
735+
dotnet_diagnostic.CA1822.severity = none
736+
731737
# CA1848: Use the LoggerMessage delegates
732738
dotnet_diagnostic.CA1848.severity = warning
733739

@@ -742,6 +748,9 @@ dotnet_diagnostic.CS1998.severity = error
742748
# CS4014: 由于此调用不会等待,因此在调用完成前将继续执行当前方法
743749
dotnet_diagnostic.CS4014.severity = error
744750

751+
# 在适用处使用属性
752+
dotnet_diagnostic.CA1024.severity = suggestion
753+
745754
# CA1715: Identifiers should have correct prefix
746755
dotnet_diagnostic.CA1715.severity = none
747756

@@ -901,6 +910,7 @@ dotnet_diagnostic.S1133.severity = warning
901910
dotnet_diagnostic.S1134.severity = warning
902911
dotnet_diagnostic.S1135.severity = warning
903912
dotnet_diagnostic.S114.severity = warning
913+
# Unused private types or members should be removed
904914
dotnet_diagnostic.S1144.severity = warning
905915
dotnet_diagnostic.S1147.severity = warning
906916
dotnet_diagnostic.S1151.severity = warning
@@ -1383,9 +1393,6 @@ dotnet_diagnostic.S109.severity = suggestion
13831393
# Sections of code should not be commented out
13841394
dotnet_diagnostic.S125.severity = suggestion
13851395

1386-
# Unused private types or members should be removed
1387-
dotnet_diagnostic.S1144.severity = suggestion
1388-
13891396
# Unused assignments should be removed
13901397
dotnet_diagnostic.S1854.severity = suggestion
13911398

@@ -1401,16 +1408,11 @@ dotnet_diagnostic.S4018.severity = suggestion
14011408
# Exceptions should provide standard constructorss
14021409
dotnet_diagnostic.S4027.severity = suggestion
14031410

1404-
# Properties should be preferred
1405-
dotnet_diagnostic.S4049.severity = suggestion
1406-
14071411
# Use "DateTimeOffset" instead of "DateTime"
14081412
dotnet_diagnostic.S6566.severity = suggestion
14091413

14101414
# # Boolean literals should not be redundant
14111415
# dotnet_diagnostic.S1125.severity = suggestion
1412-
# # Unused method parameters should be removed
1413-
# dotnet_diagnostic.S1172.severity = suggestion
14141416
# # Redundant casts should not be used
14151417
# dotnet_diagnostic.S1905.severity = suggestion
14161418

@@ -1443,6 +1445,9 @@ dotnet_diagnostic.S2360.severity = none
14431445
# Types and methods should not have too many generic parameters
14441446
dotnet_diagnostic.S2436.severity = none
14451447

1448+
# Properties should be preferred, duplicate with CA1024
1449+
dotnet_diagnostic.S4049.severity = none
1450+
14461451
# Literals should not be passed as localized parameters
14471452
dotnet_diagnostic.S4055.severity = none
14481453

@@ -1463,12 +1468,12 @@ dotnet_diagnostic.S1123.severity = none
14631468
# Track uses of "TODO" tags
14641469
dotnet_diagnostic.S1135.severity = none
14651470

1471+
# Unused method parameters should be removed, duplicate with IDE0060
1472+
dotnet_diagnostic.S1172.severity = none
1473+
14661474
# Composite format strings should not lead to unexpected behavior at runtime
14671475
dotnet_diagnostic.S2275.severity = none
14681476

1469-
# Trivial properties should be auto-implemented
1470-
dotnet_diagnostic.S2325.severity = none
1471-
14721477
# Logging templates should be constant
14731478
dotnet_diagnostic.S2629.severity = none
14741479

@@ -1560,6 +1565,9 @@ dotnet_diagnostic.S3923.severity = error
15601565
# S4158: Empty collections should not be accessed or iterated
15611566
dotnet_diagnostic.S4158.severity = error
15621567

1568+
# S5034: "ValueTask" should be consumed correctly
1569+
dotnet_diagnostic.S5034.severity = error
1570+
15631571
##########################################
15641572
# MessagePack-CSharp
15651573
# https://github.com/MessagePack-CSharp/MessagePack-CSharp/blob/master/doc/analyzers/index.md
@@ -1601,13 +1609,32 @@ resharper_indent_nested_while_stmt = true
16011609
resharper_indent_raw_literal_string = do_not_change
16021610
resharper_outdent_statement_labels = true
16031611

1612+
##########################################
1613+
# change when AnalysisMode is All
1614+
##########################################
1615+
1616+
# Consider making public types internal
1617+
dotnet_diagnostic.CA1515.severity = suggestion
1618+
1619+
# Avoid unused private fields
1620+
dotnet_diagnostic.CA1823.severity = none
1621+
1622+
# CA2007: Do not directly await a Task
1623+
dotnet_diagnostic.CA2007.severity = none
1624+
1625+
# duplicate with IDE0059
1626+
# Unused local variables should be removed
1627+
dotnet_diagnostic.S1481.severity = none
1628+
1629+
# duplicate with CA2213
1630+
# Classes should "Dispose" of members from the classes' own "Dispose" methods
1631+
dotnet_diagnostic.S2952.severity = none
1632+
16041633
[*{Benchmark,Benchmarks}.cs]
16051634
# CA1707: Identifiers should not contain underscores
16061635
dotnet_diagnostic.CA1707.severity = none
16071636
# CRR0035 - No CancellationToken parameter in the asynchronous method
16081637
dotnet_diagnostic.CRR0035.severity = none
1609-
# CA1822: Mark members as static
1610-
dotnet_diagnostic.CA1822.severity = none
16111638

16121639
[*{Test,Tests}.cs]
16131640
# CA1707: Identifiers should not contain underscores

template/src/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<ServerGarbageCollection>true</ServerGarbageCollection>
55
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
66
<UseArtifactsOutput>true</UseArtifactsOutput>
7+
<AnalysisMode>All</AnalysisMode>
78
</PropertyGroup>
89

910
</Project>

0 commit comments

Comments
 (0)