Skip to content

Commit d7639d8

Browse files
committed
Add metrics config
1 parent f3cd714 commit d7639d8

7 files changed

Lines changed: 474 additions & 13 deletions

File tree

src/.editorconfig

Lines changed: 42 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,36 @@ dotnet_diagnostic.CA2241.severity = error
778778
# IDE0043: 无效的格式字符串
779779
dotnet_diagnostic.IDE0043.severity = none
780780

781+
#### Maintainability rules ####
782+
# https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/maintainability-warnings
783+
784+
# CA1501: Avoid excessive inheritance
785+
dotnet_diagnostic.CA1501.severity = warning
786+
# CA1502: Avoid excessive complexity
787+
dotnet_diagnostic.CA1502.severity = warning
788+
# CA1505: Avoid unmaintainable code
789+
dotnet_diagnostic.CA1505.severity = warning
790+
# CA1506: Avoid excessive class coupling
791+
dotnet_diagnostic.CA1506.severity = warning
792+
793+
# CA1508: Avoid dead conditional code
794+
dotnet_diagnostic.CA1508.severity = error
795+
796+
# CA1509: Invalid entry in code metrics configuration file
797+
dotnet_diagnostic.CA1509.severity = error
798+
799+
# CA1510: Use ArgumentNullException throw helper
800+
dotnet_diagnostic.CA1510.severity = error
801+
# CA1511: Use ArgumentException throw helper
802+
dotnet_diagnostic.CA1511.severity = error
803+
# CA1512: Use ArgumentOutOfRangeException throw helper
804+
dotnet_diagnostic.CA1512.severity = error
805+
# CA1513: Use ObjectDisposedException throw helper
806+
dotnet_diagnostic.CA1513.severity = error
807+
808+
# Consider making public types internal
809+
dotnet_diagnostic.CA1515.severity = none
810+
781811
##########################################
782812
# dotnet extensions
783813
# https://github.com/dotnet/extensions/blob/d494f06e36affa83f5d216ddfe0bef2eb3f37c0d/docs/list-of-diagnostics.md
@@ -1420,11 +1450,6 @@ dotnet_diagnostic.S4027.severity = suggestion
14201450
# Use "DateTimeOffset" instead of "DateTime"
14211451
dotnet_diagnostic.S6566.severity = suggestion
14221452

1423-
# # Boolean literals should not be redundant
1424-
# dotnet_diagnostic.S1125.severity = suggestion
1425-
# # Redundant casts should not be used
1426-
# dotnet_diagnostic.S1905.severity = suggestion
1427-
14281453
#### Turn it on when needed ####
14291454

14301455
# Remove this use of 'goto'
@@ -1475,6 +1500,15 @@ dotnet_diagnostic.S6585.severity = none
14751500
# Controllers should not have mixed responsibilities
14761501
dotnet_diagnostic.S6960.severity = none
14771502

1503+
#### maintainability ####
1504+
1505+
# Functions should not have too many lines of code
1506+
# dotnet_diagnostic.S138.severity = none
1507+
1508+
# Methods and properties should not be too complex
1509+
# instead of S3776
1510+
dotnet_diagnostic.S1541.severity = none
1511+
14781512
#### duplicate with dotnet analyzer ####
14791513

14801514
# Types should be named in PascalCase
@@ -1549,8 +1583,8 @@ dotnet_diagnostic.S2184.severity = error
15491583
dotnet_diagnostic.S2190.severity = error
15501584

15511585
# S2259: Null pointers should not be dereferenced
1552-
# 不生效?
1553-
# dotnet_diagnostic.S2259.severity = none
1586+
# 经测试没有效果!
1587+
dotnet_diagnostic.S2259.severity = error
15541588

15551589
# S2328: "GetHashCode" should not reference mutable fields
15561590
dotnet_diagnostic.S2328.severity = error
@@ -1620,7 +1654,7 @@ dotnet_diagnostic.MsgPack017.severity = error
16201654
dotnet_diagnostic.MsgPack018.severity = error
16211655

16221656
##########################################
1623-
# mapperly
1657+
# Mapperly
16241658
# https://github.com/riok/mapperly/blob/main/src/Riok.Mapperly/Diagnostics/DiagnosticDescriptors.cs
16251659
##########################################
16261660

@@ -1734,9 +1768,6 @@ resharper_outdent_statement_labels = true
17341768
# change when AnalysisMode is All
17351769
##########################################
17361770

1737-
# Consider making public types internal
1738-
dotnet_diagnostic.CA1515.severity = none
1739-
17401771
# Avoid unused private fields
17411772
dotnet_diagnostic.CA1823.severity = none
17421773

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CA1501: 5
2+
CA1502: 25
3+
CA1505: 40
4+
CA1506: 40
5+
CA1506(Type): 95

0 commit comments

Comments
 (0)