Skip to content

Commit 1e989e2

Browse files
committed
Enable CA1063, disable S3881, fix ruleset comment ordering.
- CA1063 (Implement IDisposable correctly): enabled as Warning in both Source and Test rulesets for explicit enforcement. - S3881 (IDisposable pattern): disabled because Autofac uses non-standard dispose patterns for container lifecycle management. - Fixed comment/rule ordering where S1133 insertion displaced comments.
1 parent f59ad10 commit 1e989e2

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

build/Source.ruleset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
<Rules AnalyzerId="Microsoft.CodeAnalysis.Analyzers" RuleNamespace="Microsoft.CodeAnalysis.Analyzers">
55
<!-- Implement standard exception constructors - not all of the exception constructors are desired. -->
66
<Rule Id="CA1032" Action="None" />
7+
<!-- Implement IDisposable correctly (must be explicitly enabled). -->
8+
<Rule Id="CA1063" Action="Warning" />
79
<!-- Avoid excessive inheritance (must be explicitly enabled). -->
810
<Rule Id="CA1501" Action="Warning" />
911
<!-- Avoid excessive complexity (must be explicitly enabled). -->
@@ -44,6 +46,8 @@
4446
<!-- Loops should use LINQ - DI container hot paths intentionally avoid LINQ allocations. -->
4547
<Rule Id="S3267" Action="None" />
4648
<Rule Id="S3776" Action="Warning" />
49+
<!-- IDisposable pattern - Autofac uses non-standard dispose patterns for container lifecycle. -->
50+
<Rule Id="S3881" Action="None" />
4751
<!-- Split method for params check + iterator - overly prescriptive for our patterns. -->
4852
<Rule Id="S4456" Action="None" />
4953
<Rule Id="S6418" Action="Warning" />

build/Test.ruleset

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<Rule Id="CA1031" Action="None" />
77
<!-- Avoid empty interfaces - happens a lot in unit tests for service resolution. -->
88
<Rule Id="CA1040" Action="None" />
9+
<!-- Implement IDisposable correctly (must be explicitly enabled). -->
10+
<Rule Id="CA1063" Action="Warning" />
911
<!-- Do not pass literals as localized parameters - tests don't need to localize. -->
1012
<Rule Id="CA1303" Action="None" />
1113
<!-- Avoid excessive inheritance (must be explicitly enabled). -->
@@ -54,9 +56,9 @@
5456
<Rule Id="S1118" Action="None" />
5557
<!-- Don't call GC.Collect - required for weak reference and disposal tests. -->
5658
<Rule Id="S1215" Action="None" />
57-
<!-- Remove unused private members - reflection tests need non-public members. -->
5859
<!-- Do not use obsolete members - tests exercise deprecated APIs to verify backward compat. -->
5960
<Rule Id="S1133" Action="None" />
61+
<!-- Remove unused private members - reflection tests need non-public members. -->
6062
<Rule Id="S1144" Action="None" />
6163
<!-- Empty method bodies - test stubs often have no-op implementations. -->
6264
<Rule Id="S1186" Action="None" />
@@ -80,6 +82,8 @@
8082
<Rule Id="S2335" Action="None" />
8183
<!-- Cognitive complexity (must be explicitly enabled). -->
8284
<Rule Id="S3776" Action="Warning" />
85+
<!-- IDisposable pattern - test dispose implementations are intentionally simplified. -->
86+
<Rule Id="S3881" Action="None" />
8387
<!-- Split method for params check + iterator - overly prescriptive for our patterns. -->
8488
<Rule Id="S4456" Action="None" />
8589
<!-- Don't use Thread.Sleep - required for concurrency and timing tests. -->

0 commit comments

Comments
 (0)