-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.editorconfig
919 lines (726 loc) · 34.8 KB
/
.editorconfig
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
# https://editorconfig.org
root = true
###############################
# Global Options #
###############################
[*]
charset = utf-8
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
# https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelines
guidelines = 100 1px solid 40ff0000
# JSON Options
[*.json]
indent_size = 2
# Shell Script Options
[*.sh]
end_of_line = lf
[*.{cmd, bat, ps1}]
end_of_line = crlf
# Visual Studio Solution Files
[*.sln]
indent_style = tab
# XML Project Options
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2
# XML Options
[*.{xml,stylecop,resx,ruleset}]
indent_size = 2
# XML Config Options
[*.{props,targets,config,nuspec}]
indent_size = 2
# YAML Files
[*.{yml,yaml}]
indent_size = 2
[*.cs]
# Configure all rules as errors by default
# Justification: Improves code quality
# NOTE: This does not enable rules that are marked as "disabled by default":
# https://github.com/dotnet/roslyn-analyzers/issues/5077#issuecomment-830023545
# https://github.com/dotnet/roslyn/issues/47046#issuecomment-678474546
dotnet_analyzer_diagnostic.severity = error
##############################################################################################
# Built-in Code Style Analyzers #
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options #
##############################################################################################
# IDE0003/IDE0009: this and Me preferences
# Justification: Handled by StyleCop SA1101, which is more descriptive
dotnet_style_qualification_for_field = true
dotnet_style_qualification_for_property = true
dotnet_style_qualification_for_method = true
dotnet_style_qualification_for_event = true
dotnet_naming_symbols.fields.applicable_kinds = field
dotnet_naming_style.camel_case.capitalization = camel_case
dotnet_naming_rule.fields_camel_case.style = camel_case
dotnet_naming_rule.fields_camel_case.symbols = fields
dotnet_diagnostic.IDE0003.severity = none
dotnet_diagnostic.IDE0009.severity = none
# IDE0007/IDE0008: 'var' preferences
# Justification: Removes unnecessary code
csharp_style_var_for_built_in_types = true
csharp_style_var_when_type_is_apparent = true
csharp_style_var_elsewhere = true
dotnet_diagnostic.IDE0008.severity = none
# IDE0010: Add missing cases to switch statement
# Justification: This can cause a lot of bloat. We may consider enabling
# this later but right now it is not needed.
dotnet_diagnostic.IDE0010.severity = suggestion
# IDE0011: Add braces
# Justification: Handled by StyleCop SA1519, which is more descriptive
csharp_prefer_braces = when_multiline
dotnet_diagnostic.IDE0011.severity = none
# IDE0016: Use throw expression
# Justification: Improves readability
csharp_style_throw_expression = true
# IDE0017: Use object initializers
# Justification: Improves readability
dotnet_style_object_initializer = true
# IDE0018: Inline variable declaration
# Justification: Improves readability
csharp_style_inlined_variable_declaration = true
# IDE0019: Use pattern matching to avoid 'as' followed by a 'null' check
# Justification: Improves readability
csharp_style_pattern_matching_over_as_with_null_check = true
# IDE0020/IDE0038: Use pattern matching to avoid 'is' check followed by a cast
# Justification: Improves readability
csharp_style_pattern_matching_over_is_with_cast_check = true
dotnet_diagnostic.IDE0038.severity = none
# IDE0021: Use expression body for constructors
# Justification: Improves readability
csharp_style_expression_bodied_constructors = true
# IDE0022: Use expression body for methods
# Justification: Improves readability
csharp_style_expression_bodied_methods = true
# IDE0023/IDE0024: Use expression body for operators
# Justification: Improves readability
csharp_style_expression_bodied_operators = true
# IDE0025: Use expression body for properties
# Justification: Improves readability
csharp_style_expression_bodied_properties = true
# IDE0026: Use expression body for indexers
# Justification: Improves readability
csharp_style_expression_bodied_indexers = true
# IDE0027: Use expression body for accessors
# Justification: Improves readability
csharp_style_expression_bodied_accessors = true
# IDE0028: Use collection initializers
# Justification: Improves readability
dotnet_style_collection_initializer = true
# IDE0029/IDE0030: Use coalesce expression
# Justification: Improves readability
dotnet_style_coalesce_expression = true
# IDE0031: Use null propagation
# Justification: Improves readability
dotnet_style_null_propagation = true
# IDE0032: Use auto property
# Justification: Improves readability
dotnet_style_prefer_auto_properties = true
# IDE0033: Use explicitly provided tuple name
# Justification: Improves readability
dotnet_style_explicit_tuple_names = true
# IDE0034: Simplify 'default' expression
# Justification: Improves readability
csharp_prefer_simple_default_expression = true
# IDE0036: Order modifiers
# Justification: Handled by StyleCop SA1206 and we want to avoid duplicating the configuration
dotnet_diagnostic.IDE0036.severity = none
# IDE0037: Use inferred member name
# Justification: Reduces redundancy
dotnet_style_prefer_inferred_tuple_names = true
dotnet_style_prefer_inferred_anonymous_type_member_names = true
# IDE0039: Use local function instead of lambda
# Justification: Improves readability
csharp_style_pattern_local_over_anonymous_function = true
# IDE0040: Add accessibility modifiers
# Justification: Handled by StyleCop SA1400, which is more descriptive
dotnet_style_require_accessibility_modifiers = for_non_interface_members
dotnet_diagnostic.IDE0040.severity = none
# IDE0041: Use is null check
# Justification: Improves readability
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
# IDE0042: Deconstruct variable declaration
# Justification: Not smart enough (sometimes reduces readability)
csharp_style_deconstructed_variable_declaration = true
dotnet_diagnostic.IDE0042.severity = suggestion
# IDE0044: Add readonly modifier
# Justification: There is no reason not to use readonly in this instance
dotnet_style_readonly_field = true
# IDE0045: Use conditional expression for assignment
# Justification: Improves readability in some cases but can be a little too aggressive. For example,
# this rule might suggest a method with a dozen `if else` statements be converted to a dozen nested
# conditional expressions (see also Roslynator RCS1238)
dotnet_style_prefer_conditional_expression_over_assignment = true
dotnet_diagnostic.IDE0045.severity = suggestion
# IDE0046: Use conditional expression for return
# Justification: Improves readability in some cases but can be a little too aggressive. For example,
# this rule might suggest a method with a dozen `if` statements be converted to an expression-bodied
# method with a dozen nested conditional expressions (see also Roslynator RCS1238)
dotnet_style_prefer_conditional_expression_over_return = true
dotnet_diagnostic.IDE0046.severity = suggestion
# IDE0047/IDE0048: Parentheses preferences
# Justification: Matches StyleCop SA1407, SA1408, & SA1119
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity # SA1407
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity # Not covered by StyleCop
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity # SA1408
dotnet_style_parentheses_in_other_operators = never_if_unnecessary # SA1119
# IDE0049: Use language keywords instead of framework type names for type references
# Justification: Handled by StyleCop SA1121
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
dotnet_diagnostic.IDE0049.severity = none
# IDE0053: Use expression body for lambdas
# Justification: Improves readability
csharp_style_expression_bodied_lambdas = true
# IDE0054/IDE0074: Use compound assignment
# Justification: Improves readability
dotnet_style_prefer_compound_assignment = true
# IDE0055: Fix formatting
# Justification: Matches StyleCop SA1028 and SA1208
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
#dotnet_style_namespace_match_folder = true
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
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents_when_block = false
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = true
csharp_space_between_method_declaration_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_call_parameter_list_parentheses = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_after_comma = true
csharp_space_before_comma = false
csharp_space_after_dot = false
csharp_space_before_dot = false
csharp_space_after_semicolon_in_for_statement = true
csharp_space_before_semicolon_in_for_statement = false
csharp_space_around_declaration_statements = false
csharp_space_before_open_square_brackets = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_square_brackets = false
#csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true
# IDE0056: Use index operator
# Justification: Improves readability
csharp_style_prefer_index_operator = true
# IDE0057: Use range operator
csharp_style_prefer_range_operator = true
# IDE0058: Unused value expression statement
# Justification: Too noisy for `*Builder` types. Reconsider when certain types may be excluded.
# https://github.com/dotnet/roslyn/issues/47832
dotnet_diagnostic.IDE0058.severity = suggestion
# IDE0059: Remove unnecessary value assignment
csharp_style_unused_value_assignment_preference = discard_variable
# IDE0060: Remove unused parameter
# Justification: Handled by RCS1163. Normally we would prefer the built-in rules,
# but IDE0060 does not cover unused parameters in lambda expressions.
# TODO: Consider re-enabling when a code fix is available since RCS1163 does not provide one.
# We would have to write our own analyzer to handle the lambda expression case.
# https://github.com/dotnet/roslyn/issues/49868#issuecomment-761024176
dotnet_code_quality_unused_parameters = all
dotnet_diagnostic.IDE0060.severity = none
# IDE0061: Use expression body for local functions
# Justification: Improves readability
csharp_style_expression_bodied_local_functions = true
# IDE0062: Make local function static
# Justification: Improves performance
csharp_prefer_static_local_function = true
# IDE0063: Use simple 'using' statement
# Justification: Improves readability; Reduces nesting
csharp_prefer_simple_using_statement = true
# IDE0065: 'using' directive placement
# Justification: Handled by StyleCop SA1200, which is more descriptive
csharp_using_directive_placement = inside_namespace
dotnet_diagnostic.IDE0065.severity = none
# IDE0066: Use switch expression
# Justification: This can cause a lot of bloat. We may consider enabling
# this later but right now it is not needed.
csharp_style_prefer_switch_expression = true
dotnet_diagnostic.IDE0066.severity = suggestion
# IDE0071: Simplify interpolation
# Justification: Improves readability
dotnet_style_prefer_simplified_interpolation = true
# IDE0072: Populate switch
# Justification: This can cause a lot of bloat. We may consider enabling
# this later but right now it is not needed.
dotnet_diagnostic.IDE0072.severity = suggestion
# IDE0073: The file header is missing or not located at the top of the file
# Justification: Not required by company
file_header_template = unset
dotnet_diagnostic.IDE0073.severity = none
# IDE0075: Simplify conditional expression
# Justification: Improves readability
dotnet_style_prefer_simplified_boolean_expressions = true
# IDE0078: Use pattern matching
# Justification: Improves readability
csharp_style_prefer_pattern_matching = true
# IDE0079: Remove unnecessary suppressions
# Justification: Removes unnecessary code; Prevent false positive warnings for ReSharper suppressions
# https://github.com/dotnet/roslyn/issues/47288
dotnet_remove_unnecessary_suppression_exclusions = category: ReSharper
# IDE0083: Use pattern matching (not operator)
# Justification: Improves readability
csharp_style_prefer_not_pattern = true
# IDE0090: Simplify new expression
# Justification: Removes unnecessary code
csharp_style_implicit_object_creation_when_type_is_apparent = true
# IDE0160: Convert to block scoped namespace
# Justification: Reduced nesting
csharp_style_namespace_declarations = file_scoped
# IDE1005: Use conditional delegate call
# Justification: Improves readability
csharp_style_conditional_delegate_call = true
##########################################################################################################
# Built-in Code Quality Analyzers #
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ #
# https://github.com/dotnet/roslyn-analyzers/blob/main/src/NetAnalyzers/Core/AnalyzerReleases.Shipped.md #
##########################################################################################################
# CA1002: Do not expose generic lists
# Justification: Disabled by default
dotnet_diagnostic.CA1002.severity = error
# CA1003: Use generic event handler instances
# Justification: Disabled by default
dotnet_diagnostic.CA1003.severity = error
# CA1005: Avoid excessive parameters on generic types
# Justification: Disabled by default
dotnet_diagnostic.CA1005.severity = error
# CA1008: Enums should have zero value
# Justification: Disabled by default
dotnet_diagnostic.CA1008.severity = error
# CA1012: Abstract types should not have public constructors
# Justification: Disabled by default
dotnet_diagnostic.CA1012.severity = error
# CA1014: Mark assemblies with CLSCompliantAttribute
# Justification: Not applicable to us
dotnet_diagnostic.CA1014.severity = none
# CA1017: Mark assemblies with ComVisibleAttribute
# Justification: Not applicable to us
dotnet_diagnostic.CA1017.severity = none
# CA1019: Define accessors for attribute arguments
# Justification: Triggers for arguments passed to base constructor. If the
# argument is used in some way, I don't see a reason it needs to have an attribute.
dotnet_diagnostic.CA1019.severity = suggestion
# CA1021: Avoid out parameters
# Justification: Disabled by default
dotnet_diagnostic.CA1021.severity = error
# CA1024: Use properties where appropriate
# Justification: Disabled by default
dotnet_diagnostic.CA1024.severity = error
# CA1027: Mark enums with FlagsAttribute
# Justification: Disabled by default
dotnet_diagnostic.CA1027.severity = error
# CA1028: Enum storage should be Int32
# Justification: Disabled by default
dotnet_diagnostic.CA1028.severity = error
# CA1030: Use events where appropriate
# Justification: Disabled by default
dotnet_diagnostic.CA1030.severity = error
# CA1031: Do not catch general exception types
# Justification: Disabled by default
dotnet_diagnostic.CA1031.severity = error
# CA1032: Implement standard exception constructors
# Justification: Disabled by Default
dotnet_diagnostic.CA1032.severity = error
# CA1033: Interface methods should be callable by child types
# Justification: Disabled by default
dotnet_diagnostic.CA1033.severity = error
# CA1034: Nested types should not be visible
# Justification: Disabled by default; Avoids proliferation of similar classes
dotnet_diagnostic.CA1034.severity = none
# CA1040: Avoid empty interfaces
# Justification: Disabled by default
dotnet_diagnostic.CA1040.severity = suggestion
# CA1043: Use integral or string argument for indexers
# Justification: Disabled by default
dotnet_diagnostic.CA1043.severity = error
# CA1044: Properties should not be write only
# Justification: Disabled by default; Not a big deal
dotnet_diagnostic.CA1044.severity = suggestion
# CA1045: Do not pass types by reference
# Justification: Disabled by default
dotnet_diagnostic.CA1045.severity = error
# CA1046: Do not overload operator equals on reference types
# Justification: Disabled by default
dotnet_diagnostic.CA1046.severity = none
# CA1052: Static holder types should be Static or NotInheritable
# Justification: Disabled by default
dotnet_diagnostic.CA1052.severity = error
# CA1054: URI parameters should not be strings
# Justification: Disabled by default; Not a big deal
dotnet_diagnostic.CA1054.severity = suggestion
# CA1055: URI return values should not be strings
# Justification: Disabled by default; Not a big deal
dotnet_diagnostic.CA1055.severity = suggestion
# CA1056: URI properties should not be strings
# Justification: Disabled by default; Not a big deal
dotnet_diagnostic.CA1056.severity = suggestion
# CA1058: Types should not extend certain base types
# Justification: Disabled by default
dotnet_diagnostic.CA1058.severity = error
# CA1060: Move P/Invokes to NativeMethods class
# Justification: Disabled by default
dotnet_diagnostic.CA1060.severity = error
# CA1062: Validate arguments of public methods
# Justification: Disabled by default; Handled by NullGuard.Fody; Expensive analysis
dotnet_diagnostic.CA1062.severity = none
# CA1063: Implement IDisposable correctly
# Justification: Disabled by default
dotnet_diagnostic.CA1063.severity = error
# CA1064: Exceptions should be public
# Justification: Disabled by default
dotnet_diagnostic.CA1064.severity = error
# CA1065: Do not raise exceptions in unexpected locations
# Justification: Disabled by default
dotnet_diagnostic.CA1065.severity = error
# CA1066: Implement IEquatable when overriding equals
# Justification: Disabled by default
dotnet_diagnostic.CA1066.severity = error
# CA1303: Do not pass literals as localized parameters
# Justification: Disabled by default; Expensive analysis
dotnet_diagnostic.CA1303.severity = none
# CA1307: Specify StringComparison for clarity
# Justification: Disabled by default
dotnet_diagnostic.CA1307.severity = none
# CA1308: Normalize strings to uppercase
# Justification: Disabled by default
dotnet_diagnostic.CA1308.severity = suggestion
# CA1501: Avoid excessive inheritence
# Justification: Disabled by default
dotnet_diagnostic.CA1501.severity = error
# CA1502: Avoid excessive complexity
# Justification: Disabled by default
dotnet_diagnostic.CA1502.severity = error
# CA1505: Avoid unmaintainable code
# Justification: Disabled by default
dotnet_diagnostic.CA1505.severity = error
# CA1506: Avoid excessive class coupling
# Justification: Disabled by default
dotnet_diagnostic.CA1506.severity = error
# CA1508: Avoid dead conditional code
# Justification: Disabled by default: Expensive analysis
dotnet_diagnostic.CA1508.severity = none
# CA1509: Invalid entry in code metrics configuration file
# Justification: Disabled by default
dotnet_diagnostic.CA1509.severity = error
# CA1700: Do not name enum values 'Reserved'
# Justification: Disabled by default
dotnet_diagnostic.CA1700.severity = error
# CA1713: Events should not have before or after prefix
# Justification: Disabled by default
dotnet_diagnostic.CA1713.severity = error
# CA1721: Property names should not match get methods
# Justification: Disabled by default
dotnet_diagnostic.CA1721.severity = error
# CA1724: Type names should not match namespaces
# Justification: Disabled by default
dotnet_diagnostic.CA1724.severity = error
# CA1801: Review unused parameters
# Justification: Disabled by default; Deprecated in favor of IDE0060
dotnet_diagnostic.CA1801.severity = none
# CA1802: Use Literals Where appropriate
# Justification: Disabled by default
dotnet_diagnostic.CA1802.severity = error
# CA1810: Initialize reference type static fields inline
# Justification: Disabled by default
dotnet_diagnostic.CA1810.severity = error
# CA1812: Avoid uninstantiated internal classes
# Justification: Disabled by default; InternalsVisibleToAttribute is used for every assembly so this
# rule would not apply; False positives for implicit use via dependency injection
dotnet_diagnostic.CA1812.severity = none
# CA1813: Avoid unsealed attributes
# Justification: Disabled by default
dotnet_diagnostic.CA1813.severity = error
# CA1814: Prefer jagged arrays over multidimensional
# Justification: Disabled by default
dotnet_diagnostic.CA1814.severity = error
# CA1815: Override equals and operator equals on value types
# Justification: Disabled by default
dotnet_diagnostic.CA1815.severity = error
# CA1819: Properties should not return arrays
# Justification: Disabled by default; False positives for data transfer objects
dotnet_diagnostic.CA1819.severity = suggestion
# CA1820: Test for empty strings using string length
# Justification: Disabled by default
dotnet_diagnostic.CA1820.severity = error
# CA1823: Avoid unused private fields
# Justification: Disabled by default
dotnet_diagnostic.CA1823.severity = error
# TODO: Consider only reducing severity for mobile projects
# CA2000: Dispose objects before losing scope
# Justification: Not all disposable objects require disposal (e.g. some Observable subscriptions);
# Potentially expensive analysis
dotnet_diagnostic.CA2000.severity = suggestion
# CA2002: Do not lock on objects with weak identity
# Justification: Disabled by default
dotnet_diagnostic.CA2002.severity = error
# TODO: Consider enabling for libraries only
# CA2007: Do not directly await a Task
# Justification: Disabled by default (see also Roslynator RCS1090)
dotnet_diagnostic.CA2007.severity = none
# TODO: Consider enabling for libraries only
# CA2008: Do not create tasks without passing a TaskScheduler
# Justification: Disabled by default (see also VSTHRD105)
dotnet_diagnostic.CA2008.severity = none
# CA2100: Review SQL queries for security vulnerabilities
# Justification: Disabled by default; Only really applicable to Ewn.FluentDb
dotnet_diagnostic.CA2100.severity = error
# CA2109: Review visible event handlers
# Justification: Disabled by default; Out of scope for our work
dotnet_diagnostic.CA2109.severity = none
# CA2119: Seal methods that satisfy private interfaces
# Justification: Disabled by default; Unnecessary
dotnet_diagnostic.CA2119.severity = none
# CA2153: Avoid handling Corrupted State exceptions
# Justification: Disabled by default
dotnet_diagnostic.CA2153.severity = error
# CA2201: Do not raise reserved exception types
# Justification: We may rethrow `Exception` to add context to caught exceptions. However,
# we should prefer adding information to `Exception.Data` instead.
dotnet_diagnostic.CA2201.severity = suggestion
# CA2207: Initialize value type static fields inline
# Justification: Disabled by default
dotnet_diagnostic.CA2207.severity = error
# TODO: Consider only reducing severity for mobile projects
# CA2213: Disposable fields should be disposed
# Justification: Disabled by default; Not all disposable objects require disposal (e.g. some
# Observable subscriptions); Potentially expensive analysis
dotnet_diagnostic.CA2213.severity = suggestion
# CA2214: Do not call overridable methods in constructors
# Justification: Disabled by default
dotnet_diagnostic.CA2214.severity = error
# CA2216: Disposable types should declare finalizer
# Justification: Disabled by default
dotnet_diagnostic.CA2216.severity = error
# CA2217: Do not mark enums with FlagsAttribute
# Justification: Disabled by default
dotnet_diagnostic.CA2217.severity = error
# CA2225: Operator overloads have named alternates
# Justification: Disabled by default; Out of scope for our work
dotnet_diagnostic.CA2225.severity = none
# CA2226: Operators should have symmetrical overloads
# Justification: Disabled by default; Not always desirable
dotnet_diagnostic.CA2226.severity = suggestion
# CA2227: Collection properties should be read only
# Justification: Disabled by default; False positives for data transfer objects
dotnet_diagnostic.CA2227.severity = suggestion
# CA2234: Pass System.Uri objects instead of strings
# Justification: Disabled by default; Not a big deal
dotnet_diagnostic.CA2234.severity = suggestion
# CA2235: Mark all non-serializable fields
# Justification: Disabled by default
dotnet_diagnostic.CA2235.severity = error
# CA2237: Mark ISerializable types with SerializableAttribute
# Justification: Disabled by default
dotnet_diagnostic.CA2237.severity = error
# CA2243: Attribute string literals should parse correctly
# Justification: Disabled by default
dotnet_diagnostic.CA2243.severity = error
# TODO: Review CA2300-CA3012 as they might be performance intensive
# TODO: Review CA5358-CA5403 as they might not be applicable to us
########################################################
# StyleCop Analyzers #
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers #
########################################################
# SA1028: Code should not contain trailing whitespace
# This is handled by IDE0055 but that rule can't be disabled because it covers many other
# formatting rules. This rule is intentionally left enabled because it is more descriptive.
# SA1134: Each attribute should be placed on its own line of code
# Justification: Property accessors are included in this and it greatly mucks up the code
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/1938
dotnet_diagnostic.SA1134.severity = suggestion
# SA1135: Using directives must be qualified
# Justification: Conflicts with IDE0001, which is more beneficial than this rule.
# There also doesn't appear to be a way to disable IDE0001 for "inside namespace" only.
dotnet_diagnostic.SA1135.severity = none
# SA1408: Conditional expressions should declare precedence
# This is handled by IDE0048 but that rule can't be disabled because it covers a few other
# parentheses rules that StyleCop doesn't. This rule is intentionally left enabled because
# it is more descriptive in regards to reasoning.
# SA1503: Braces should not be omitted
# Justification: This rule is too verbose for things like argument error handling and returns.
# Multi-line statements are covered by SA1137 and SA1519 to prevent the bugs addressed by this.
# Reconsider when options are added:
# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/2252
dotnet_diagnostic.SA1503.severity = none
# SA1633: File should have header
# Justification: Not required by our company
dotnet_diagnostic.SA1633.severity = none
############################################
# Roslynator Analyzers #
# https://github.com/JosefPihrt/Roslynator #
############################################
#dotnet_analyzer_diagnostic.category-Roslynator.severity = error
# RCS0006: Add empty line before using directive list
# Justification: Disabled by default; Consistency
dotnet_diagnostics.RCS0006.severity = error
# RCS0025: Put full access on its own line
# Justification: Disabled by default; Improves readability
dotnet_diagnostics.RCS0025.severity = error
# RCS0027: Place new line after/before binary operator
# Justification: Disabled by default; Consistency
roslynator_binary_operator_new_line = after
dotnet_diagnostic.RCS0027.severity = error
# RCS0028: Place new line after/before '?:' operator
# Justification: Disabled by default; Consistency
roslynator_condition_operator_new_line = before
dotnet_diagnostic.RCS0028.severity = error
# RCS0032: Place new line after/before arrow token
# Justification: Disabled by default; Consistency
roslynator_arrow_token_new_line = after
dotnet_diagnostic.RCS0032.severity = error
# RCS0033: Add new line before statement
# Justification: Disabled by default; Improves readability
dotnet_diagnostic.RCS0033.severity = error
# RCS0034: Put type parameter constraint on its own line
# Justification: Disabled by default; Improves readability
dotnet_diagnostic.RCS0034.severity = error
# RCS0038: Remove blank line between using directives with same root namespace
# Justification: Disabled by default; Removes unnecessary code
dotnet_diagnostic.RCS0038.severity = error
# RCS0041: Remove new line between 'if' keyword and 'else' keyword
# Justification: Disabled by default; Consistency
dotnet_diagnostic.RCS0041.severity = error
# RCS0052: Place new line after/before equals token
# Justification: Disabled by default; Consistency
roslynator_equals_token_new_line = after
dotnet_diagnostic.RCS0052.severity = error
# RCS0054: Fix formatting of a call chain
# Justification: Disabled by default; Improves readability
dotnet_diagnostic.RCS0054.severity = error
# RCS0055: Fix formatting of a binary expression chain
# Justification: Disabled by default; Consistency
dotnet_diagnostic.RCS0055.severity = error
# RCS0056: A line is too long
# Justification: Disabled by default; 80 is the historical recommendation due to punch cards but
# also has some basis in "reading ergonomics" (e.g. typography). 100 is chosen as a compromise
# between those coding full screen on larger monitors and those that aren't.
roslynator_max_line_length = 100
dotnet_diagnostic.RCS0056.severity = error
# RCS1001: Add braces to if statement (when expression spans over multiple lines)
# Justification: Handled by StyleCop SA1519, which is more descriptive
dotnet_diagnostic.RCS1001.severity = none
# RCS1037: Remove trailing white-space
# Justification: Handled by IDE0055 & SA1028
dotnet_diagnostic.RCS1037.severity = none
# RCS1038: Remove empty statment
# Justification: Handled by SA1106, which is more descriptive
dotnet_diagnostic.RCS1038.severity = none
# TODO: Consider enabling for libraries only
# RCS1090: Add/remove 'ConfigureAwait(false)' call
# Justification: Disabled by default; NuGet packages should always set this (see also CA2007)
dotnet_diagnostic.RCS1090.severity = none
# TODO: Only enable for build projects
# RCS1110: Declare type inside namespace
# Justification: There are situations where it is valid to not use a namespace.
# dotnet_diagnostic.RCS1110.severity = suggestion
# RCS1123: Add parentheses when necessary
# Justification: Handled by IDE0048 & SA1408
dotnet_diagnostic.RCS1123.severity = none
# RCS1158: Static member in generic type should use a type parameter
# Justification: Handled by CA1000; Triggers incorrectly for static fields anyway
dotnet_diagnostic.RCS1158.severity = none
# RCS1161: Enum should declare explicit values
# Justification: Unnecessary unless used as flags or serialized as numeric (not recommended)
dotnet_diagnostic.RCS1161.severity = none
# RCS1165: Unconstrained type parameter checked for null
# Justification: Unnecessary; Not smart enough to detect explicitly nullable type parameters (e.g. `T?`)
# https://github.com/JosefPihrt/Roslynator/issues/384
dotnet_diagnostic.RCS1165.severity = none
# RCS1169: Make field read-only
# Justification: Handled by IDE0044
dotnet_diagnostic.RCS1169.severity = none
# RCS1174: Remove redundant async/await
# Justification: Disabled by default; Removes unnecessary code
# See https://blog.stephencleary.com/2016/12/eliding-async-await.html regarding pass-through
# TODO: Convert to error when `using` declaration bug is fixed:
# https://github.com/JosefPihrt/Roslynator/issues/951
dotnet_diagnostic.RCS1174.severity = suggestion
# RCS1192: Unnecessary usage of verbatim string literal
# Justification: We use verbatim strings to tell ReSharper the string
# should not be analyzed for spelling errors.
dotnet_diagnostic.RCS1192.severity = none
# RCS1207: Use anonymous function or method group
# Justification: Disabled by default; Improves readability
roslynator_use_anonymous_function_or_method_group = method_group
dotnet_diagnostic.RCS1207.severity = error
# RCS1237: Use bit shift operator
# Justification: Deprecated. Replaced by RCS1254
dotnet_diagnostic.RCS1237.severity = none
# RCS1254: Normalize format of enum flag value
# Justification: Consistency
roslynator_enum_flag_value_style = decimal_number
#######################################
# Menees Analyzers #
# https://github.com/menees/Analyzers #
#######################################
# MEN002: Line is too long
# Justification: Handled by Roslynator RCS0056 with a code fix;
# This one handles XML comments whereas RCS0056 does not. We may
# consider switching back at some point for that benefit.
dotnet_diagnostic.MEN002.severity = none
# MEN007: Use a single return
# Justification: We adhere to the "fail fast" rule
# https://www.martinfowler.com/ieeeSoftware/failFast.pdf
dotnet_diagnostic.MEN007.severity = none
# MEN012: Flags should be powers of two
# Justification: Handled by Roslynator RCS1191/RCS1254
dotnet_diagnostic.MEN012.severity = none
# MEN013: Use UTC time
# Justification: We already use local time extensively
dotnet_diagnostic.MEN013.severity = none
####################################################################################
# JetBrains ReSharper #
# https://www.jetbrains.com/help/resharper/Reference__Code_Inspections_CSHARP.html #
####################################################################################
# The following settings are maintained in ReSharper.DotSettings because they don't
# support .editorconfig:
#
# Excluded file list
# - Setting: /Default/CodeInspection/ExcludedFiles
#
# Abbreviation list
# - Setting: /Default/CodeStyle/Naming/CSharpNaming/Abbreviations
# - Setting: /Default/CodeStyle/Naming/XamlNaming/Abbreviations
#
# Todo pattern list
# - Setting: /Default/PatternsAndTemplates/Todo/TodoPatterns
#
# Dictionary word list
# - Setting: /Default/UserDictionary/Words
#
# Don't check spelling for verbatim strings
# - Setting: /Default/ReSpeller/DontCheckVerbatimStrings
# - Justification: Verbatim strings are often used for code or other codified values
# so we choose to skip spelling checks. It is also cleaner than using disable comments.
# - Bug: You must use @$ instead of $@ for an interpolated verbatim string to be recognized
# https://youtrack.jetbrains.com/issue/RSRP-471861/ReSharper-reports-typo-in-literal-string-with-interpolation
####################################################################################
# Remove redundant parentheses
# Justification: Handled by IDE0047 and StyleCop SA1119
resharper_arrange_redundant_parentheses_highlighting = none
# Use preferred style for trailing comma before new line in multiline lists
# Justification: Matches StyleCop SA1413
resharper_trailing_comma_in_multiline_lists = true
# Redundant name qualifier
# Justification: Conflicts with StyleCop SA1101, which is more beneficial than this rule.
resharper_redundant_name_qualifier_highlighting = none
# XML line length
# Justification: Matches overall max line length (see also Roslynator RCS0056)
resharper_xmldoc_max_line_length = 100
resharper_xml_max_line_length = 100