Repository navigation
Expand file tree
/
Copy path.editorconfig
More file actions
1212 lines (1075 loc) · 64.9 KB
/
Copy path.editorconfig
File metadata and controls
1212 lines (1075 loc) · 64.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# =============================================================================
# .editorconfig - opencode-sdk-dotnet
# =============================================================================
# Analyzers: Microsoft.CodeAnalysis.NetAnalyzers, Meziantou.Analyzer,
# Roslynator, SonarAnalyzer, VSTHRD, BannedApiAnalyzers,
# NSubstitute.Analyzers.CSharp (tests only)
# Fail-closed policy: every enabled warning/error diagnostic breaks the build unless a comment
# beside it says otherwise. Suggestions are IDE guidance; none disables a rule deliberately.
# =============================================================================
# Top-most http://editorconfig.org/ file
root = true
# =============================================================================
# SECTION 1: FILE TYPE SETTINGS
# =============================================================================
[*]
insert_final_newline = true
indent_style = space
charset = utf-8
# LF everywhere (paired with .gitattributes): generated-output determinism and
# the file-based tool entry's shebang both depend on it.
end_of_line = lf
trim_trailing_whitespace = true
# Advisory (no C# tool enforces it): guidance for IDE rulers and code-writing agents.
# CI pairs the in-build IDE0055 wall with whitespace and warning-level style formatter passes.
max_line_length = 150
[*.{xml,config,*proj,nuspec,props,resx,targets,yml,tasks}]
indent_size = 2
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2
[*.json]
indent_size = 2
[*.{ps1,psm1}]
indent_size = 4
[*.sh]
indent_size = 4
# =============================================================================
# SECTION 2: C#/VB LANGUAGE PREFERENCES
# =============================================================================
[*.{cs,vb}]
# -----------------------------------------------------------------------------
# 2.1 Naming Conventions
# -----------------------------------------------------------------------------
dotnet_naming_symbols.local_symbol.applicable_kinds = parameter, local
dotnet_naming_style.local_style.capitalization = camel_case
dotnet_naming_rule.variables_are_camel_case.severity = error
dotnet_naming_rule.variables_are_camel_case.symbols = local_symbol
dotnet_naming_rule.variables_are_camel_case.style = local_style
# -----------------------------------------------------------------------------
# 2.2 Using Directives
# -----------------------------------------------------------------------------
# The warning-level style formatter gate owns deterministic import organization.
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = true
# -----------------------------------------------------------------------------
# 2.3 Qualification Preferences (this./Me.)
# -----------------------------------------------------------------------------
# IDE0003 is EnforceOnBuild.Never in Roslyn; the separate style formatter gate owns it.
dotnet_style_qualification_for_field = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_event = false:error
# -----------------------------------------------------------------------------
# 2.4 Type Preferences (keywords vs BCL)
# -----------------------------------------------------------------------------
# IDE0049 is EnforceOnBuild.Never in Roslyn; the separate style formatter gate owns it.
dotnet_style_predefined_type_for_locals_parameters_members = true:error
dotnet_style_predefined_type_for_member_access = true:error
# -----------------------------------------------------------------------------
# 2.5 Modifier Preferences
# -----------------------------------------------------------------------------
dotnet_style_require_accessibility_modifiers = always:error
dotnet_style_readonly_field = true:error
# -----------------------------------------------------------------------------
# 2.6 Parentheses Preferences
# -----------------------------------------------------------------------------
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:error
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:error
dotnet_style_parentheses_in_other_operators = always_for_clarity:error
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:error
# -----------------------------------------------------------------------------
# 2.7 Unused Parameters
# -----------------------------------------------------------------------------
dotnet_code_quality_unused_parameters = all
# -----------------------------------------------------------------------------
# 2.8 Multiple Blank Lines
# -----------------------------------------------------------------------------
dotnet_style_allow_multiple_blank_lines_experimental = false
# =============================================================================
# SECTION 3: C# FORMATTING
# =============================================================================
# -----------------------------------------------------------------------------
# 3.1 var Preferences
# -----------------------------------------------------------------------------
csharp_style_var_elsewhere = true:error
csharp_style_var_for_built_in_types = true:error
csharp_style_var_when_type_is_apparent = true:error
# -----------------------------------------------------------------------------
# 3.2 Newline Settings
# -----------------------------------------------------------------------------
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# -----------------------------------------------------------------------------
# 3.3 Indentation
# -----------------------------------------------------------------------------
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
# -----------------------------------------------------------------------------
# 3.4 Spacing
# -----------------------------------------------------------------------------
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
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_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
csharp_max_attribute_length_for_same_line = 80
# -----------------------------------------------------------------------------
# 3.5 Braces
# -----------------------------------------------------------------------------
csharp_prefer_braces = true:error
# -----------------------------------------------------------------------------
# 3.6 Using Directive Placement
# -----------------------------------------------------------------------------
csharp_using_directive_placement = outside_namespace:error
# -----------------------------------------------------------------------------
# 3.7 Wrapping (ReSharper)
# -----------------------------------------------------------------------------
resharper_wrap_object_and_collection_initializer_style = chop_always
# Intentional layout policy: declaration parameters stay on one line when they
# fit max_line_length; existing declaration-paren arrangements are not
# preserved; a wrapped fluent chain puts the receiver on its own line, the
# first call below it, and each following call on its own line with leading
# dots at the normal continuation indentation (no outdenting, no alignment).
# The broad keep_existing_linebreaks options are deliberately not set: they
# would freeze formatting outside the constructs this section controls.
resharper_csharp_keep_existing_declaration_parens_arrangement = false
resharper_csharp_wrap_parameters_style = wrap_if_long
resharper_csharp_wrap_after_declaration_lpar = false
resharper_csharp_wrap_before_declaration_rpar = false
resharper_csharp_wrap_chained_method_calls = chop_if_long
resharper_csharp_wrap_before_first_method_call = true
resharper_csharp_align_multiline_calls_chain = false
resharper_csharp_outdent_dots = false
# =============================================================================
# SECTION 4: C#-SPECIFIC PREFERENCES
# =============================================================================
[*.cs]
indent_size = 4
# -----------------------------------------------------------------------------
# 4.1 Namespace Declarations
# -----------------------------------------------------------------------------
csharp_style_namespace_declarations = file_scoped:error
# -----------------------------------------------------------------------------
# 4.2 Pattern Matching
# -----------------------------------------------------------------------------
csharp_style_pattern_matching_over_is_with_cast_check = true:error
csharp_style_pattern_matching_over_as_with_null_check = true:error
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_not_pattern = true:error
csharp_style_prefer_extended_property_pattern = true:suggestion
# -----------------------------------------------------------------------------
# 4.3 Expression-bodied Members
# -----------------------------------------------------------------------------
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
csharp_style_expression_bodied_lambdas = true:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
# -----------------------------------------------------------------------------
# 4.4 Null Checking
# -----------------------------------------------------------------------------
csharp_style_throw_expression = true:error
csharp_style_conditional_delegate_call = true:error
# -----------------------------------------------------------------------------
# 4.5 Local Functions & Using Statements
# -----------------------------------------------------------------------------
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_static_local_function = true:error
# -----------------------------------------------------------------------------
# 4.6 Roslynator Configuration
# -----------------------------------------------------------------------------
# Enable refactorings and compiler fixes in IDE (no build impact)
dotnet_analyzer_diagnostic.category-roslynator.severity = suggestion
roslynator_analyzers.enabled_by_default = true
roslynator_refactorings.enabled = true
roslynator_compiler_diagnostic_fixes.enabled = true
# =============================================================================
# SECTION 5: IDE STYLE ANALYZERS (IDE0xxx)
# =============================================================================
# -----------------------------------------------------------------------------
# 5.1 Simplification Rules
# -----------------------------------------------------------------------------
# Roslyn marks IDE0001-IDE0003 as EnforceOnBuild.Never; the style formatter gate owns them.
dotnet_diagnostic.IDE0001.severity = error
dotnet_diagnostic.IDE0002.severity = error
dotnet_diagnostic.IDE0003.severity = error
dotnet_diagnostic.IDE0004.severity = error
dotnet_diagnostic.IDE0034.severity = error
# IDE0035 is likewise owned by the style formatter gate.
dotnet_diagnostic.IDE0035.severity = error
dotnet_diagnostic.IDE0071.severity = error
dotnet_diagnostic.IDE0075.severity = error
dotnet_diagnostic.IDE0080.severity = error
dotnet_diagnostic.IDE0082.severity = error
dotnet_diagnostic.IDE0090.severity = error
dotnet_diagnostic.IDE0100.severity = error
dotnet_diagnostic.IDE0110.severity = error
dotnet_diagnostic.IDE0120.severity = error
# -----------------------------------------------------------------------------
# 5.2 Unused Code Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE0005.severity = error
dotnet_diagnostic.IDE0051.severity = error
dotnet_diagnostic.IDE0052.severity = error
dotnet_diagnostic.IDE0059.severity = error
dotnet_diagnostic.IDE0060.severity = error
# -----------------------------------------------------------------------------
# 5.3 Modern Syntax Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE0017.severity = error
dotnet_diagnostic.IDE0018.severity = error
dotnet_diagnostic.IDE0028.severity = error
dotnet_diagnostic.IDE0029.severity = error
dotnet_diagnostic.IDE0030.severity = error
dotnet_diagnostic.IDE0031.severity = error
dotnet_diagnostic.IDE0033.severity = error
dotnet_diagnostic.IDE0056.severity = error
dotnet_diagnostic.IDE0057.severity = error
dotnet_diagnostic.IDE0161.severity = error
dotnet_diagnostic.IDE0180.severity = error
dotnet_diagnostic.IDE0200.severity = error
# -----------------------------------------------------------------------------
# 5.4 Pattern Matching Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE0019.severity = error
dotnet_diagnostic.IDE0020.severity = error
dotnet_diagnostic.IDE0038.severity = error
dotnet_diagnostic.IDE0066.severity = error
dotnet_diagnostic.IDE0072.severity = error
dotnet_diagnostic.IDE0078.severity = error
dotnet_diagnostic.IDE0083.severity = error
# -----------------------------------------------------------------------------
# 5.5 Readonly/Static Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE0032.severity = suggestion
dotnet_diagnostic.IDE0044.severity = error
dotnet_diagnostic.IDE0062.severity = error
dotnet_diagnostic.IDE0250.severity = error
dotnet_diagnostic.IDE0251.severity = error
# -----------------------------------------------------------------------------
# 5.6 Nullable Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE0240.severity = error
dotnet_diagnostic.IDE0241.severity = error
# -----------------------------------------------------------------------------
# 5.7 Naming & Namespace Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE1006.severity = error
dotnet_diagnostic.IDE0130.severity = error
dotnet_style_namespace_match_folder = true
# -----------------------------------------------------------------------------
# 5.8 Formatting & Style Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE0007.severity = error
dotnet_diagnostic.IDE0011.severity = error
dotnet_diagnostic.IDE0036.severity = error
dotnet_diagnostic.IDE0040.severity = error
dotnet_diagnostic.IDE0041.severity = error
dotnet_diagnostic.IDE0055.severity = error
dotnet_diagnostic.IDE0065.severity = error
dotnet_diagnostic.IDE0160.severity = error
dotnet_diagnostic.IDE2000.severity = error
# -----------------------------------------------------------------------------
# 5.9 Collection Expression Rules (.NET 8+)
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE0300.severity = error
dotnet_diagnostic.IDE0301.severity = error
dotnet_diagnostic.IDE0302.severity = error
dotnet_diagnostic.IDE0303.severity = error
dotnet_diagnostic.IDE0304.severity = error
dotnet_diagnostic.IDE0305.severity = error
# -----------------------------------------------------------------------------
# 5.10 Primary Constructor & nameof Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE0290.severity = suggestion
dotnet_diagnostic.IDE0280.severity = error
# -----------------------------------------------------------------------------
# 5.11 Misc IDE Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.IDE0043.severity = error
dotnet_diagnostic.IDE0270.severity = error
# =============================================================================
# SECTION 6: CODE QUALITY - DESIGN (CA1xxx)
# =============================================================================
# -----------------------------------------------------------------------------
# 6.1 Type Design (CA1000-CA1099)
# -----------------------------------------------------------------------------
# Static members on generic types (MA0018 disabled in §10.6 in favor of this rule)
dotnet_diagnostic.CA1000.severity = error
dotnet_diagnostic.CA1008.severity = suggestion
dotnet_diagnostic.CA1012.severity = error
dotnet_diagnostic.CA1018.severity = error
# Mark enums with FlagsAttribute [opinionated]
dotnet_diagnostic.CA1027.severity = error
# Catch-general-exception: active rule, deliberately off [opinionated] -
# transport/pipeline code catches broadly by design
dotnet_diagnostic.CA1031.severity = none
dotnet_diagnostic.CA1032.severity = error
dotnet_diagnostic.CA1040.severity = suggestion
dotnet_diagnostic.CA1047.severity = error
# Null-guard externally visible parameters: generated methods emit throw-helper
# guards mechanically; hand-written code must match the same discipline
dotnet_diagnostic.CA1062.severity = error
dotnet_diagnostic.CA1063.severity = error
dotnet_diagnostic.CA1064.severity = error
dotnet_diagnostic.CA1068.severity = error
dotnet_diagnostic.CA1069.severity = error
# -----------------------------------------------------------------------------
# 6.2 Globalization (CA1300-CA1399)
# [OVERLAP GROUP] - CA culture rules vs MA0001/MA0011/MA0074/MA0075/MA0076
# Both sides kept at error (deliberate double coverage; MA side explicit in §10.2)
# -----------------------------------------------------------------------------
dotnet_diagnostic.CA1304.severity = error
dotnet_diagnostic.CA1305.severity = error
dotnet_diagnostic.CA1307.severity = error
dotnet_diagnostic.CA1308.severity = suggestion
dotnet_diagnostic.CA1309.severity = error
dotnet_diagnostic.CA1310.severity = error
dotnet_diagnostic.CA1311.severity = error
# -----------------------------------------------------------------------------
# 6.3 Maintainability (CA1500-CA1599)
# -----------------------------------------------------------------------------
dotnet_diagnostic.CA1501.severity = error
dotnet_diagnostic.CA1502.severity = error
dotnet_diagnostic.CA1505.severity = error
dotnet_diagnostic.CA1507.severity = error
dotnet_diagnostic.CA1508.severity = error
dotnet_diagnostic.CA1510.severity = error
dotnet_diagnostic.CA1511.severity = error
dotnet_diagnostic.CA1512.severity = error
dotnet_diagnostic.CA1513.severity = error
dotnet_diagnostic.CA1514.severity = error
dotnet_diagnostic.CA1515.severity = none
# -----------------------------------------------------------------------------
# 6.4 Naming (CA1700-CA1799)
# -----------------------------------------------------------------------------
dotnet_diagnostic.CA1707.severity = error
dotnet_diagnostic.CA1716.severity = error
dotnet_diagnostic.CA1725.severity = error
dotnet_diagnostic.CA1727.severity = error
# -----------------------------------------------------------------------------
# 6.5 Performance (CA1800-CA1899)
# [OVERLAP GROUP] - CA performance rules vs MA equivalents noted
# -----------------------------------------------------------------------------
dotnet_diagnostic.CA1802.severity = error
dotnet_diagnostic.CA1805.severity = error
dotnet_diagnostic.CA1806.severity = error
dotnet_diagnostic.CA1810.severity = error
# CA1812 has high false-positive rate for DI/reflection/source-generator/framework-created types.
# Keep it as an IDE hint, not as a CI gate.
dotnet_diagnostic.CA1812.severity = suggestion
dotnet_diagnostic.CA1813.severity = error
dotnet_diagnostic.CA1815.severity = error
# Properties should not return arrays [shipping API trade-off]
dotnet_diagnostic.CA1819.severity = suggestion
dotnet_diagnostic.CA1820.severity = error
dotnet_diagnostic.CA1821.severity = error
dotnet_diagnostic.CA1822.severity = error
dotnet_code_quality.CA1822.api_surface = private, internal
dotnet_diagnostic.CA1823.severity = error
dotnet_diagnostic.CA1825.severity = error
dotnet_diagnostic.CA1826.severity = error
dotnet_diagnostic.CA1827.severity = error
dotnet_diagnostic.CA1828.severity = error
dotnet_diagnostic.CA1829.severity = error
dotnet_diagnostic.CA1830.severity = error
dotnet_diagnostic.CA1831.severity = error
dotnet_diagnostic.CA1832.severity = error
dotnet_diagnostic.CA1833.severity = error
dotnet_diagnostic.CA1834.severity = error
dotnet_diagnostic.CA1835.severity = error
dotnet_diagnostic.CA1836.severity = error
dotnet_diagnostic.CA1837.severity = error
dotnet_diagnostic.CA1838.severity = error
dotnet_diagnostic.CA1839.severity = error
dotnet_diagnostic.CA1840.severity = error
dotnet_diagnostic.CA1841.severity = error
dotnet_diagnostic.CA1842.severity = error
dotnet_diagnostic.CA1843.severity = error
dotnet_diagnostic.CA1844.severity = error
dotnet_diagnostic.CA1845.severity = error
dotnet_diagnostic.CA1846.severity = error
dotnet_diagnostic.CA1847.severity = error
dotnet_diagnostic.CA1848.severity = none
dotnet_diagnostic.CA1849.severity = error
dotnet_diagnostic.CA1850.severity = error
dotnet_diagnostic.CA1851.severity = error
# Seal internal types [≈ MA0053]
dotnet_diagnostic.CA1852.severity = error
dotnet_diagnostic.CA1853.severity = error
dotnet_diagnostic.CA1854.severity = error
dotnet_diagnostic.CA1855.severity = error
dotnet_diagnostic.CA1858.severity = error
dotnet_diagnostic.CA1859.severity = error
dotnet_diagnostic.CA1860.severity = error
dotnet_diagnostic.CA1861.severity = error
dotnet_diagnostic.CA1862.severity = error
dotnet_diagnostic.CA1864.severity = error
dotnet_diagnostic.CA1865.severity = error
dotnet_diagnostic.CA1866.severity = error
dotnet_diagnostic.CA1867.severity = error
dotnet_diagnostic.CA1868.severity = error
dotnet_diagnostic.CA1869.severity = error
dotnet_diagnostic.CA1870.severity = error
# .NET 9/10 Performance Rules
dotnet_diagnostic.CA1871.severity = error
dotnet_diagnostic.CA1872.severity = error
# =============================================================================
# SECTION 7: CODE QUALITY - USAGE (CA2xxx)
# =============================================================================
# -----------------------------------------------------------------------------
# 7.1 Task/Async Usage (CA2007-CA2016)
# -----------------------------------------------------------------------------
# ConfigureAwait(false) is mandatory in library code (net472 in the TFM matrix).
# Triple-enforced with MA0004 (§10.3) and VSTHRD111 (§9.1); tests exempt (§15)
dotnet_diagnostic.CA2007.severity = error
dotnet_diagnostic.CA2008.severity = error
dotnet_diagnostic.CA2009.severity = error
dotnet_diagnostic.CA2011.severity = error
dotnet_diagnostic.CA2012.severity = error
dotnet_diagnostic.CA2013.severity = error
dotnet_diagnostic.CA2014.severity = error
dotnet_diagnostic.CA2016.severity = error
# -----------------------------------------------------------------------------
# 7.2 Security Rules (CA2100-CA2199)
# -----------------------------------------------------------------------------
dotnet_diagnostic.CA2100.severity = error
# -----------------------------------------------------------------------------
# 7.3 Exception/Dispose Rules (CA2200-CA2299)
# -----------------------------------------------------------------------------
dotnet_diagnostic.CA2200.severity = error
dotnet_diagnostic.CA2201.severity = error
dotnet_diagnostic.CA2208.severity = error
dotnet_diagnostic.CA2213.severity = error
dotnet_diagnostic.CA2215.severity = error
dotnet_diagnostic.CA2217.severity = error
dotnet_diagnostic.CA2244.severity = error
dotnet_diagnostic.CA2245.severity = error
dotnet_diagnostic.CA2246.severity = error
dotnet_diagnostic.CA2248.severity = error
dotnet_diagnostic.CA2249.severity = error
dotnet_diagnostic.CA2250.severity = error
dotnet_diagnostic.CA2251.severity = error
# =============================================================================
# SECTION 8: SECURITY RULES (CA3xxx, CA5xxx)
# =============================================================================
dotnet_diagnostic.CA3001.severity = error
dotnet_diagnostic.CA3002.severity = error
dotnet_diagnostic.CA3007.severity = error
dotnet_diagnostic.CA5394.severity = error
# =============================================================================
# SECTION 9: ASYNC/THREADING ANALYZERS
# =============================================================================
# -----------------------------------------------------------------------------
# 9.1 Microsoft.VisualStudio.Threading (VSTHRD) - PRIMARY
# -----------------------------------------------------------------------------
dotnet_diagnostic.VSTHRD002.severity = error
dotnet_diagnostic.VSTHRD100.severity = error
dotnet_diagnostic.VSTHRD101.severity = error
dotnet_diagnostic.VSTHRD103.severity = error
dotnet_diagnostic.VSTHRD107.severity = error
dotnet_diagnostic.VSTHRD110.severity = error
# ConfigureAwait(false) is mandatory in library code (net472 in the TFM matrix);
# only rule of the trio whose docs explicitly cover ValueTask awaits
dotnet_diagnostic.VSTHRD111.severity = error
dotnet_diagnostic.VSTHRD114.severity = error
dotnet_diagnostic.VSTHRD200.severity = suggestion
# =============================================================================
# SECTION 10: MEZIANTOU.ANALYZER (MAxxxx)
# =============================================================================
# -----------------------------------------------------------------------------
# 10.1 Configuration
# -----------------------------------------------------------------------------
MA0051.maximum_lines_per_method = 80
MA0051.maximum_statements_per_method = 60
MA0011.exclude_tostring_methods = true
# Align MA0004 coverage with CA2007 (default DetectContext goes quiet in
# context-dependent code; Always reports every await without ConfigureAwait)
MA0004.report = Always
# Public API ships sealed-by-default (extend-only design); CA1852 covers internal only.
# The stricter class_with_virtual_member_shoud_be_sealed option (sic, upstream typo) is
# deliberately NOT enabled: client facade types are unsealed with virtual members + a
# protected ctor as the consumer mocking seam — a class with virtual members is
# inheritance-by-design and must stay exempt from the seal rule.
MA0053.public_class_should_be_sealed = true
# -----------------------------------------------------------------------------
# 10.2 String/Culture Rules
# [OVERLAP GROUP] - Also enforced by CA1304-CA1311 (§6.2)
# Both sides kept at error; MA0075/MA0076 cover implicit ToString call sites
# (concatenation/interpolation) the CA rules do not see
# -----------------------------------------------------------------------------
# MA0001 ≈ CA1307, CA1309, CA1310 (StringComparison)
# MA0011 ≈ CA1304, CA1305, CA1311 (IFormatProvider/CultureInfo)
# MA0074 ≈ CA1307, CA1309 (Equals StringComparison)
dotnet_diagnostic.MA0001.severity = error
dotnet_diagnostic.MA0006.severity = suggestion
dotnet_diagnostic.MA0011.severity = error
dotnet_diagnostic.MA0074.severity = error
dotnet_diagnostic.MA0075.severity = error
dotnet_diagnostic.MA0076.severity = error
# -----------------------------------------------------------------------------
# 10.3 Async Rules
# [OVERLAP GROUP] - Also enforced by VSTHRD and CA
# MA0042 ≈ CA1849/VSTHRD103 (all error - deliberate double coverage);
# MA0045 is the stricter make-it-async sibling (Meziantou default: off)
# -----------------------------------------------------------------------------
# ConfigureAwait(false) mandatory in library code; report mode set in §10.1
dotnet_diagnostic.MA0004.severity = error
dotnet_diagnostic.MA0022.severity = error
dotnet_diagnostic.MA0042.severity = error
dotnet_diagnostic.MA0045.severity = error
dotnet_diagnostic.MA0080.severity = error
dotnet_diagnostic.MA0089.severity = error
dotnet_diagnostic.MA0152.severity = error
# -----------------------------------------------------------------------------
# 10.4 Performance Rules (unique to MA or stricter)
# -----------------------------------------------------------------------------
dotnet_diagnostic.MA0028.severity = error
dotnet_diagnostic.MA0029.severity = error
dotnet_diagnostic.MA0044.severity = error
dotnet_diagnostic.MA0063.severity = error
dotnet_diagnostic.MA0078.severity = error
dotnet_diagnostic.MA0105.severity = error
dotnet_diagnostic.MA0106.severity = error
dotnet_diagnostic.MA0111.severity = error
# -----------------------------------------------------------------------------
# 10.5 Design Rules
# -----------------------------------------------------------------------------
# File name must match type name (Go-style structure discipline)
dotnet_diagnostic.MA0048.severity = error
dotnet_diagnostic.MA0052.severity = error
# Seal classes including public ones (option in §10.1); CA1852 handles internal only
dotnet_diagnostic.MA0053.severity = error
dotnet_diagnostic.MA0067.severity = error
dotnet_diagnostic.MA0102.severity = error
dotnet_diagnostic.MA0110.severity = error
# -----------------------------------------------------------------------------
# 10.6 Disabled Rules (overlap with CA - using CA versions)
# -----------------------------------------------------------------------------
dotnet_diagnostic.MA0038.severity = none
dotnet_diagnostic.MA0041.severity = none
dotnet_diagnostic.MA0018.severity = none
# -----------------------------------------------------------------------------
# 10.7 Meziantou 3.x Rules
# -----------------------------------------------------------------------------
dotnet_diagnostic.MA0180.severity = suggestion
dotnet_diagnostic.MA0181.severity = none
dotnet_diagnostic.MA0182.severity = suggestion
dotnet_diagnostic.MA0183.severity = error
dotnet_diagnostic.MA0184.severity = error
# MA0185 is semantics-preserving: it removes string.Create(CultureInfo.InvariantCulture, ...)
# only when every interpolation is culture-invariant; RCS1140/RCS1141 stay suggestion (best-effort)
dotnet_diagnostic.MA0185.severity = error
dotnet_diagnostic.MA0186.severity = suggestion
dotnet_diagnostic.MA0187.severity = none
dotnet_diagnostic.MA0188.severity = suggestion
dotnet_diagnostic.MA0189.severity = suggestion
dotnet_diagnostic.MA0190.severity = suggestion
dotnet_diagnostic.MA0191.severity = suggestion
dotnet_diagnostic.MA0192.severity = suggestion
dotnet_diagnostic.MA0193.severity = suggestion
dotnet_diagnostic.MA0194.severity = suggestion
dotnet_diagnostic.MA0195.severity = error
dotnet_diagnostic.MA0196.severity = suggestion
dotnet_diagnostic.MA0197.severity = none
dotnet_diagnostic.MA0198.severity = suggestion
dotnet_diagnostic.MA0199.severity = suggestion
dotnet_diagnostic.MA0200.severity = suggestion
dotnet_diagnostic.MA0201.severity = error
dotnet_diagnostic.MA0202.severity = error
dotnet_diagnostic.MA0203.severity = suggestion
# =============================================================================
# SECTION 11: ROSLYNATOR (RCSxxxx)
# =============================================================================
dotnet_diagnostic.RCS1214.severity = error
dotnet_diagnostic.RCS1181.severity = error
dotnet_diagnostic.RCS1140.severity = suggestion
dotnet_diagnostic.RCS1141.severity = suggestion
# =============================================================================
# SECTION 12: SONARANALYZER (Sxxxx)
# =============================================================================
# Policy: only arbitrated rules are listed; everything else rides SonarWay
# defaults, which TreatWarningsAsErrors escalates to error. When a Sonar rule
# misfires, arbitrate it here with a
# comment naming the winner.
dotnet_diagnostic.S125.severity = suggestion
dotnet_diagnostic.S2094.severity = suggestion
dotnet_diagnostic.S2437.severity = error
dotnet_diagnostic.S2479.severity = suggestion
dotnet_diagnostic.S3925.severity = none
# Utility classes are static in this repo; keep disabled defensively
dotnet_diagnostic.S1118.severity = none
dotnet_diagnostic.S3963.severity = error
dotnet_diagnostic.S4457.severity = suggestion
dotnet_diagnostic.S6602.severity = none
# =============================================================================
# SECTION 13: COMPILER DIAGNOSTICS (CSxxxx)
# =============================================================================
# Every public member on the shipped surface is documented: generated docs come from the
# spec, hand-written docs by hand. Tests are exempted in Section 15.
dotnet_diagnostic.CS1591.severity = error
# =============================================================================
# SECTION 14: GENERATED CODE
# =============================================================================
# The model-layer generator emits plain .cs files that deliberately avoid every
# generated-code heuristic (no .g.cs name, no <auto-generated> header, no
# [GeneratedCode]) - its output faces the full analyzer wall on merit, so this
# section never matches it. It exists for genuine third-party generated files.
# None of this exempts compiler diagnostics - generated code must compile clean.
[*.{g.cs,generated.cs,designer.cs}]
generated_code = true
# =============================================================================
# SECTION 15: TEST PROJECT OVERRIDES
# =============================================================================
[tests/**/*.cs]
dotnet_diagnostic.CA1707.severity = none
dotnet_diagnostic.CS1591.severity = none
# TUnit Assert.That reports false positives for MA0042 because the analyzer cannot model the assertion API shape.
dotnet_diagnostic.MA0042.severity = none
# No SynchronizationContext in tests - the src-side ConfigureAwait triple
# (CA2007/MA0004/VSTHRD111) is noise here
dotnet_diagnostic.CA2007.severity = none
dotnet_diagnostic.MA0004.severity = none
dotnet_diagnostic.VSTHRD111.severity = none
# CA1716 judges names consumers see; test assemblies do not ship, so test namespaces such as Shared keep their names
dotnet_diagnostic.CA1716.severity = none
# =============================================================================
# FILE-BASED ENTRY ARBITRATION (MA0048)
# =============================================================================
# Placed after every global C# diagnostic section so the file-scoped glob never
# narrows a later section. MA0048 (file name = type name) cannot apply to the
# file-based tool entry: the SDK synthesizes the Program type, and the entry
# contract pins the file name (it is the tool name:
# ./tools/opencode-tool.cs). Winner: the entry contract; the rule stays error
# for every other file, generated output included (emission keeps file = type).
[tools/opencode-tool.cs]
dotnet_diagnostic.MA0048.severity = none
# The abstract adapter base carries shared, non-virtual mapping behavior for the
# generated response adapters, and default interface members cannot carry shared
# behavior on the net472/netstandard2.0 targets (CS8701). Winner: the
# abstract adapter base; S1694 remains enabled for every other file.
[src/OpenCode.Sdk/Internal/Operations/ResponseAdapter.cs]
dotnet_diagnostic.S1694.severity = none
# The owned downlevel handler changes redirect behavior only. CA5399 would require forcing
# certificate-revocation checks on, but that is a separate TLS policy and the property is absent
# from older .NET Framework implementations that can load the netstandard2.0 asset. Winner: the
# cross-runtime compatibility and unchanged TLS contract; CA5399 remains enabled elsewhere.
[src/OpenCode.Sdk/Internal/Transport/Pipeline.cs]
dotnet_diagnostic.CA5399.severity = none
# TerminalSocketCore deliberately never disposes its send-gate SemaphoreSlim. The BCL only requires
# disposal once AvailableWaitHandle has been read, which this class never does, and disposing it
# would break disposal itself: an in-flight write's Release would throw over its own mapped
# failure, and a writer already parked in WaitAsync would never wake, because Dispose does not
# complete pending async waiters. Winner: the disposal-race contract; CA2213 remains enabled for
# every other file.
[src/OpenCode.Sdk/Internal/Terminal/TerminalSocketCore.cs]
dotnet_diagnostic.CA2213.severity = none
# CallerStreamContent holds two disposables it does not own: the caller's request-body stream,
# which the SDK promises never to dispose or rewind, and the pipeline message whose progress
# window it restarts, which the pipeline disposes after the exchange. Disposing either would break
# that ownership. Winner: the ownership contract; CA2213 remains enabled for every other file.
[src/OpenCode.Sdk/Internal/Transport/CallerStreamContent.cs]
dotnet_diagnostic.CA2213.severity = none
# DriveController deliberately never disposes its send-gate and invocation-signal semaphores.
# The BCL only requires SemaphoreSlim disposal once AvailableWaitHandle has been read, which
# this class never does, and disposing them would break disposal itself: a WaitForRequestAsync
# caller parked in WaitAsync would never wake, because Dispose does not complete pending async
# waiters. Winner: the disposal-race contract; CA2213 remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/Harness/DriveController.cs]
dotnet_diagnostic.CA2213.severity = none
# DriveProtocol.Compose builds one JSON-RPC message into an in-memory MemoryStream through a
# `using var writer = new Utf8JsonWriter(buffer)`; Utf8JsonWriter implements IAsyncDisposable,
# which is what MA0045 reacts to, but the write is pure in-memory buffering with no I/O to await,
# and every composing method's public contract returns `byte[]` synchronously (the controller
# calls them as plain value transforms, not async operations). Making Compose async would ripple
# a needless Task allocation into every DriveProtocol call site for no real asynchrony. Winner:
# the synchronous protocol-composition contract; MA0045 remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/Harness/DriveProtocol.cs]
dotnet_diagnostic.MA0045.severity = none
# DriveManifest.Write has the same in-memory Utf8JsonWriter shape as DriveProtocol.Compose, plus
# an IFileSystem.WriteAllBytes call; its public contract is a synchronous `DriveManifest Write(...)`
# (DriveManifestTests calls it without awaiting), the manifest-writing seam the drive fixture
# composes synchronously. Winner: the synchronous manifest-writer contract; MA0045 remains enabled
# for every other file.
[tests/OpenCode.Sdk.Tests/Harness/DriveManifest.cs]
dotnet_diagnostic.MA0045.severity = none
# ServerIsolation.Environment seeds one empty shell startup file into the home it names, through
# IFileSystem. Its contract is a synchronous map the launch recipes compose from
# (SimulatedServerLaunch.Prepare and PinnedServerLaunch.Options are synchronous, and the launcher
# options they build are plain data), and the write is a zero-byte file in a directory this call
# just created, so there is nothing to await. Winner: the synchronous isolation-policy contract;
# MA0045 remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/Harness/ServerIsolation.cs]
dotnet_diagnostic.MA0045.severity = none
# The generated extensible enums nest one static Values class of wire-spelling constants, so that
# Type.Values.Name works as a case label and in a pattern, which a static property cannot. Every
# file under a Models folder, area folders included, is generated, and no generated model nests any
# other public type.
# Winner: the nested wire constants; CA1034 remains enabled for every other file.
[src/OpenCode.Sdk/**/Models/**.cs]
dotnet_diagnostic.CA1034.severity = none
# The pinned OpenAPI schemas declare these wire members as plain strings without
# format: uri. Winner: the sole protocol input's declared type; CA1056's name
# inference remains enabled for every other property.
[src/OpenCode.Sdk/**/{ArtifactInfo,ConfigInfoEnterprise,ConnectionStatus,ExperimentalIntegrationWellknownAddRequest,ExperimentalPushDeviceRegisterRequest,FormExternalField,IntegrationAttempt,MachineReach,McpOAuthConfig,McpRemoteConfig,McpResource,McpResourceTemplate,ProjectIcon,PromptFileSourceUri,PromptInputFileAttachment,PromptMediaFileAttachment,ToolFileContent,UsageLimitsInfoWorkspace,VoiceWebSocketTransport,WebSearchResult}.cs]
dotnet_diagnostic.CA1056.severity = none
# MediaReference.HashFromUri mirrors upstream's first-party mediaHashFromUri: its parameter
# carries the wire media: reference string under upstream's name, not a System.Uri, and it
# returns a hash, not a URI, so CA1055 fires on the method name alone.
# Winner: upstream's first-party spelling (ADR-0031); CA1054 and CA1055 remain enabled for
# every other file.
[src/OpenCode.Sdk/Common/MediaReference.cs]
dotnet_diagnostic.CA1054.severity = none
dotnet_diagnostic.CA1055.severity = none
# The SDK's namespaces are API surface, not placement: a public type declares OpenCode.Sdk or
# OpenCode.Sdk.Models wherever its file lives, and every internal type declares
# OpenCode.Sdk.Internal, so moving a file never changes a namespace. Winner: the SDK
# namespace-policy test, which checks every SDK file against that rule in both directions;
# IDE0130 remains error for every other project, the SDK's tests included.
[src/OpenCode.Sdk/**.cs]
dotnet_diagnostic.IDE0130.severity = none
# DI extension methods live in the Microsoft.Extensions.DependencyInjection namespace so
# consumers get AddOpenCode without an extra using - the ecosystem convention every
# companion DI package follows. Winner: the ecosystem
# namespace contract; IDE0130 remains error for every other Extensions file.
[src/OpenCode.Sdk.Extensions/OpenCodeServiceCollectionExtensions.cs]
dotnet_diagnostic.IDE0130.severity = none
# BlockingStream is a test double that stands still until cancellation, so read throughput
# is not a property it has. The memory-based ReadAsync is not virtual on the net472 leg of
# the test matrix, leaving the array-based override the only shape that compiles on every
# target the tests run on; the base memory-based read routes into it. Winner: the
# cross-target test double; CA1844 remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/Support/BlockingStream.cs]
dotnet_diagnostic.CA1844.severity = none
# Each scripted socket is handed to the PtySession under test, which owns and disposes it - and
# that ownership transfer is part of what these tests assert, through the fake's own dispose
# counter. An analyzer cannot see the transfer through the constructor. Winner: the
# ownership-transfer test; CA2000 remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/Ptys/PtySessionTests.cs]
dotnet_diagnostic.CA2000.severity = none
# The persistent PTY session tests hand the same scripted socket to the session under test, which
# owns and disposes it; here the transfer runs through PersistentPtySession.AttachAsync rather than
# a constructor, which an analyzer sees even less of. Disposing the fake from the test instead
# would assert an ownership the design denies and mask a session that leaked its socket. Winner:
# the ownership-transfer test; CA2000 remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/PersistentPtys/PersistentPtySessionTests.cs]
dotnet_diagnostic.CA2000.severity = none
# ScriptedTerminalWebSocket parks on TaskCompletionSource handles the test itself completes; that
# externally-owned completion is exactly the mechanism that makes a dispose-versus-read or
# cancellation-versus-read race deterministic without waiting on wall-clock time. Winner: the
# scripted test double; VSTHRD003 remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/Support/ScriptedTerminalWebSocket.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# LateCleanupFailureReport owns the TaskCompletionSource completed only by its registered
# fault-observation continuations. The bridge lets a deterministic test await an otherwise-late
# cleanup failure without sleeping. Winner: the bounded cleanup reporting contract; VSTHRD003
# remains enabled elsewhere.
[tests/OpenCode.Sdk.Tests/Harness/Ownership/LateCleanupFailureReport.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# Cleanup owners retain raw tasks until actual completion and separately bound observation.
# Awaiting those owned tasks directly preserves their original result/cancellation identity;
# callback invocation is isolated on the thread pool, with no foreign synchronization-context
# dependency. Winner: owned cleanup observation; VSTHRD003 remains enabled elsewhere.
[tests/OpenCode.Sdk.Tests/Harness/Ownership/OwnedCleanup.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# OwnedEventReader is the reader half of that same contract: it retains the enumeration task a
# caller handed it and observes it under its own bounded cleanup, so the awaited handle is owned
# work rather than a foreign task. Winner: owned event observation; VSTHRD003 remains enabled
# elsewhere.
[tests/OpenCode.Sdk.Tests/Support/OwnedEventReader.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# SessionEventProbe awaits TaskCompletionSource handles completed only by the reader loop this
# same object started and handed to its owning OwnedEventReader: the connected barrier and the
# per-arrival signal. That is the event-to-async bridge which lets a scenario act the moment the
# subscription is attached, and wait for a correlated event, without polling or sleeping. Its own
# proofs drive that bridge from a scripted stream, awaiting the same signals plus the scenario's
# stall handle, and release and drain every one of them in finally. Winner: the single-reader
# event probe; VSTHRD003 remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/Support/SessionEventProbe.cs]
dotnet_diagnostic.VSTHRD003.severity = none
[tests/OpenCode.Sdk.Tests/Support/SessionEventProbeTests.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# These per-scenario deadline helpers retain task handles and explicitly control entry, expiry
# and result delivery. Their caller releases signals and drains all owned work in finally;
# there is no foreign synchronization-context dependency. Winner: deterministic deadline control.
[tests/OpenCode.Sdk.Tests/Support/ControlledOperationDeadline.cs]
dotnet_diagnostic.VSTHRD003.severity = none
[tests/OpenCode.Sdk.Tests/Support/OperationDeadlineScenario.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# These cleanup proofs await their own externally-completed barriers/tasks to establish the
# exact ordering under test. Finally releases and observes stalled work and deadline signals;
# no foreign synchronization context is involved. Winner: causal owned-work proofs. Each entry
# names one file; VSTHRD003 remains enabled outside these explicitly owned proof families.
[tests/OpenCode.Sdk.Tests/Harness/Ownership/OwnedCleanupTests.cs]
dotnet_diagnostic.VSTHRD003.severity = none
[tests/OpenCode.Sdk.Tests/Support/OwnedCleanupDeadlineTests.cs]
dotnet_diagnostic.VSTHRD003.severity = none
[tests/OpenCode.Sdk.Tests/Support/OwnedEventReaderTests.cs]
dotnet_diagnostic.VSTHRD003.severity = none
[tests/OpenCode.Sdk.Tests/Harness/Ownership/OwnedOperationDeadlineTests.cs]
dotnet_diagnostic.VSTHRD003.severity = none
[tests/OpenCode.Sdk.Tests/Sessions/Support/SessionLogTranscriptTests.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# The session-removal fault proof controls interrupt entry and expiry, then drains cancellation
# and removal in finally. Its task handles have no foreign synchronization-context dependency.
# Winner: the same causal cleanup proof embedded beside its actual live consumer.
[tests/OpenCode.Sdk.Tests/Sessions/SessionMessagePaginationLiveTests.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# This fixture proof owns the disposal task and controls its deadline delivery. Its finally
# releases all signals and drains the raw operations. Winner: causal owned-process failure proof;
# VSTHRD003 remains enabled outside this exact file.
[tests/OpenCode.Sdk.Tests/Harness/PinnedOpenCodeServerFixtureFailureTests.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# These diagnostic proofs control their own operation deadlines and retain supplied disposal
# tasks until finally releases and drains them. Winner: causal fixture/status ownership proofs;
# the rule remains enabled outside these exact files.
[tests/OpenCode.Sdk.Tests/Ptys/Support/PtyFailureDiagnosticsTests.cs]
dotnet_diagnostic.VSTHRD003.severity = none
[tests/OpenCode.Sdk.Tests/Support/ServerDiagnosticScenario.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# StartAsync's readyLine TaskCompletionSource is completed only by this same method's own stdout
# line handler, wired to the very child process this method spawns — there is no
# externally-owned task lifetime for VSTHRD003 to protect against, the same shape already
# arbitrated for ScriptedTerminalWebSocket's TaskCompletionSource handles. TranslateAsync's await
# is the same shape: it awaits the Closed task of the child this handle spawned and owns. Winner: the
# event-to-async bridge for the readiness signal and the owned child's end; VSTHRD003 remains enabled
# for every other file.
[src/OpenCode.Sdk/Hosting/Launcher/OpenCodeServer.Launcher.cs]
dotnet_diagnostic.VSTHRD003.severity = none
# The progress window's expiry is a timer callback, synchronous by the ITimer contract, already
# running on a pool thread of its own, as a source's own CancelAfter timer cancels it. There is no
# caller to make async and no caller worker for CancelOnWorkerAsync to spare. Winner: the
# synchronous timer-callback contract; MA0045 remains enabled for every other file.
[src/OpenCode.Sdk/Internal/Transport/ProgressWindow.cs]
dotnet_diagnostic.MA0045.severity = none
# These rows prove that a handler's synchronous read of a request body works, so the blocking call is
# what they exercise, and making them async would stop proving it. Winner: the synchronous-read proof;
# MA0045 remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/Transport/PooledJsonContentSyncReadTests.cs]
dotnet_diagnostic.MA0045.severity = none
# OpenCodeServerContractTests exercises the processless friend-assembly seam
# (internal OpenCodeServer(Uri, string)) and the bare protected-ctor mock seam exclusively:
# neither holds a real child process, so DisposeAsync is a no-op and nothing physical leaks when
# a test does not dispose the door itself. Winner: the deterministic contract-test seam; CA2000
# remains enabled for every other file.
[tests/OpenCode.Sdk.Tests/Hosting/OpenCodeServerContractTests.cs]
dotnet_diagnostic.CA2000.severity = none
# ServiceLegacyFilename reproduces the pinned CLI's earlier registration filename,
# service-<sha1(channel)>.json (packages/util/src/hash.ts, createHash("sha1") over the raw channel
# name): a filename derivation over a public string, not a security primitive. Winner: byte-for-byte
# parity with the pinned CLI; CA5350 and its Sonar twin S4790 stay enabled for every other file.