Skip to content

Commit 36eb562

Browse files
authored
Add new rules from Visual Studio 16.9 (#49)
1 parent 32dcfd1 commit 36eb562

1 file changed

Lines changed: 60 additions & 66 deletions

File tree

.editorconfig

Lines changed: 60 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Version: 2.0.1 (Using https://semver.org/)
2-
# Updated: 2020-12-11
1+
# Version: 2.1.0 (Using https://semver.org/)
2+
# Updated: 2021-03-03
33
# See https://github.com/RehanSaeed/EditorConfig/releases for release notes.
44
# See https://github.com/RehanSaeed/EditorConfig for updates to this file.
55
# See http://EditorConfig.org for more information about .editorconfig files.
@@ -73,84 +73,64 @@ indent_style = tab
7373
dotnet_analyzer_diagnostic.severity = warning
7474

7575
##########################################
76-
# File Header (Uncomment to support file headers)
77-
# https://docs.microsoft.com/visualstudio/ide/reference/add-file-header
76+
# Language Rules
77+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules
7878
##########################################
7979

80-
# [*.{cs,csx,cake,vb,vbx}]
81-
# file_header_template = <copyright file="{fileName}" company="PROJECT-AUTHOR">\n© PROJECT-AUTHOR\n</copyright>
82-
83-
# SA1636: File header copyright text should match
84-
# Justification: .editorconfig supports file headers. If this is changed to a value other than "none", a stylecop.json file will need to added to the project.
85-
# dotnet_diagnostic.SA1636.severity = none
86-
87-
##########################################
88-
# .NET Language Conventions
89-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions
90-
##########################################
91-
92-
# .NET Code Style Settings
93-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#net-code-style-settings
80+
# .NET Style Rules
81+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#net-style-rules
9482
[*.{cs,csx,cake,vb,vbx}]
9583
# "this." and "Me." qualifiers
96-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#this-and-me
9784
dotnet_style_qualification_for_field = true:warning
9885
dotnet_style_qualification_for_property = true:warning
9986
dotnet_style_qualification_for_method = true:warning
10087
dotnet_style_qualification_for_event = true:warning
10188
# Language keywords instead of framework type names for type references
102-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#language-keywords
10389
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
10490
dotnet_style_predefined_type_for_member_access = true:warning
10591
# Modifier preferences
106-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#normalize-modifiers
10792
dotnet_style_require_accessibility_modifiers = always:warning
10893
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:warning
10994
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:warning
11095
dotnet_style_readonly_field = true:warning
11196
# Parentheses preferences
112-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#parentheses-preferences
11397
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:warning
11498
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:warning
11599
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:warning
116100
dotnet_style_parentheses_in_other_operators = always_for_clarity:suggestion
117101
# Expression-level preferences
118-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-level-preferences
119102
dotnet_style_object_initializer = true:warning
120103
dotnet_style_collection_initializer = true:warning
121104
dotnet_style_explicit_tuple_names = true:warning
122105
dotnet_style_prefer_inferred_tuple_names = true:warning
123106
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
124107
dotnet_style_prefer_auto_properties = true:warning
125-
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
126108
dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion
127109
dotnet_diagnostic.IDE0045.severity = suggestion
128110
dotnet_style_prefer_conditional_expression_over_return = false:suggestion
129111
dotnet_diagnostic.IDE0046.severity = suggestion
130112
dotnet_style_prefer_compound_assignment = true:warning
113+
dotnet_style_prefer_simplified_interpolation = true:warning
114+
dotnet_style_prefer_simplified_boolean_expressions = true:warning
131115
# Null-checking preferences
132-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#null-checking-preferences
133116
dotnet_style_coalesce_expression = true:warning
134117
dotnet_style_null_propagation = true:warning
135-
# Parameter preferences
136-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#parameter-preferences
137-
dotnet_code_quality_unused_parameters = all:warning
138-
# More style options (Undocumented)
139-
# https://github.com/MicrosoftDocs/visualstudio-docs/issues/3641
118+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
119+
# File header preferences
120+
# file_header_template = <copyright file="{fileName}" company="PROJECT-AUTHOR">\n© PROJECT-AUTHOR\n</copyright>
121+
# If you use StyleCop, you'll need to disable SA1636: File header copyright text should match.
122+
# dotnet_diagnostic.SA1636.severity = none
123+
# Undocumented
140124
dotnet_style_operator_placement_when_wrapping = end_of_line
141-
# https://github.com/dotnet/roslyn/pull/40070
142-
dotnet_style_prefer_simplified_interpolation = true:warning
143125

144-
# C# Code Style Settings
145-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-code-style-settings
126+
# C# Style Rules
127+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/language-rules#c-style-rules
146128
[*.{cs,csx,cake}]
147-
# Implicit and explicit types
148-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#implicit-and-explicit-types
129+
# 'var' preferences
149130
csharp_style_var_for_built_in_types = true:warning
150131
csharp_style_var_when_type_is_apparent = true:warning
151132
csharp_style_var_elsewhere = true:warning
152133
# Expression-bodied members
153-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-bodied-members
154134
csharp_style_expression_bodied_methods = true:warning
155135
csharp_style_expression_bodied_constructors = true:warning
156136
csharp_style_expression_bodied_operators = true:warning
@@ -159,50 +139,64 @@ csharp_style_expression_bodied_indexers = true:warning
159139
csharp_style_expression_bodied_accessors = true:warning
160140
csharp_style_expression_bodied_lambdas = true:warning
161141
csharp_style_expression_bodied_local_functions = true:warning
162-
# Pattern matching
163-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#pattern-matching
142+
# Pattern matching preferences
164143
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
165144
csharp_style_pattern_matching_over_as_with_null_check = true:warning
166-
# Inlined variable declarations
167-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#inlined-variable-declarations
168-
csharp_style_inlined_variable_declaration = true:warning
145+
csharp_style_prefer_switch_expression = true:warning
146+
csharp_style_prefer_pattern_matching = true:warning
147+
csharp_style_prefer_not_pattern = true:warning
169148
# Expression-level preferences
170-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#expression-level-preferences
149+
csharp_style_inlined_variable_declaration = true:warning
171150
csharp_prefer_simple_default_expression = true:warning
151+
csharp_style_pattern_local_over_anonymous_function = true:warning
152+
csharp_style_deconstructed_variable_declaration = true:warning
153+
csharp_style_prefer_index_operator = true:warning
154+
csharp_style_prefer_range_operator = true:warning
155+
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
172156
# "Null" checking preferences
173-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#c-null-checking-preferences
174157
csharp_style_throw_expression = true:warning
175158
csharp_style_conditional_delegate_call = true:warning
176159
# Code block preferences
177-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#code-block-preferences
178160
csharp_prefer_braces = true:warning
179-
# Unused value preferences
180-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#unused-value-preferences
161+
csharp_prefer_simple_using_statement = true:suggestion
162+
dotnet_diagnostic.IDE0063.severity = suggestion
163+
# 'using' directive preferences
164+
csharp_using_directive_placement = inside_namespace:warning
165+
# Modifier preferences
166+
csharp_prefer_static_local_function = true:warning
167+
168+
##########################################
169+
# Unnecessary Code Rules
170+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/unnecessary-code-rules
171+
##########################################
172+
173+
# .NET Unnecessary code rules
174+
[*.{cs,csx,cake,vb,vbx}]
175+
dotnet_code_quality_unused_parameters = all:warning
176+
dotnet_remove_unnecessary_suppression_exclusions = none:warning
177+
178+
# C# Unnecessary code rules
179+
[*.{cs,csx,cake}]
181180
csharp_style_unused_value_expression_statement_preference = discard_variable:suggestion
182181
dotnet_diagnostic.IDE0058.severity = suggestion
183182
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
184183
dotnet_diagnostic.IDE0059.severity = suggestion
185-
# Index and range preferences
186-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#index-and-range-preferences
187-
csharp_style_prefer_index_operator = true:warning
188-
csharp_style_prefer_range_operator = true:warning
189-
# Miscellaneous preferences
190-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-language-conventions#miscellaneous-preferences
191-
csharp_style_deconstructed_variable_declaration = true:warning
192-
csharp_style_pattern_local_over_anonymous_function = true:warning
193-
csharp_using_directive_placement = inside_namespace:warning
194-
csharp_prefer_static_local_function = true:warning
195-
csharp_prefer_simple_using_statement = true:suggestion
196-
dotnet_diagnostic.IDE0063.severity = suggestion
197184

198185
##########################################
199-
# .NET Formatting Conventions
200-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-code-style-settings-reference#formatting-conventions
186+
# Formatting Rules
187+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules
201188
##########################################
202189

203-
# Organize usings
204-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#organize-using-directives
190+
# .NET formatting rules
191+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#net-formatting-rules
192+
[*.{cs,csx,cake,vb,vbx}]
193+
# Organize using directives
205194
dotnet_sort_system_directives_first = true
195+
dotnet_separate_import_directive_groups = false
196+
197+
# C# formatting rules
198+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/formatting-rules#c-formatting-rules
199+
[*.{cs,csx,cake}]
206200
# Newline options
207201
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#new-line-options
208202
csharp_new_line_before_open_brace = all
@@ -244,14 +238,14 @@ csharp_space_around_declaration_statements = false
244238
csharp_space_before_open_square_brackets = false
245239
csharp_space_between_empty_square_brackets = false
246240
csharp_space_between_square_brackets = false
247-
# Wrapping options
241+
# Wrap options
248242
# https://docs.microsoft.com/visualstudio/ide/editorconfig-formatting-conventions#wrap-options
249243
csharp_preserve_single_line_statements = false
250244
csharp_preserve_single_line_blocks = true
251245

252246
##########################################
253-
# .NET Naming Conventions
254-
# https://docs.microsoft.com/visualstudio/ide/editorconfig-naming-conventions
247+
# .NET Naming Rules
248+
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/naming-rules
255249
##########################################
256250

257251
[*.{cs,csx,cake,vb,vbx}]

0 commit comments

Comments
 (0)