Skip to content

Commit c7e07ca

Browse files
committed
Add complete editorconfig ruleset and enable style analyzers
1 parent cf370df commit c7e07ca

File tree

188 files changed

+1317
-1430
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+1317
-1430
lines changed

.editorconfig

Lines changed: 247 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ charset = utf-8
77
trim_trailing_whitespace = true
88
insert_final_newline = true
99

10-
[*.cs]
11-
indent_size = 4
12-
dotnet_sort_system_directives_first = true
13-
csharp_style_namespace_declarations = file_scoped:warning
14-
dotnet_diagnostic.IDE0005.severity = warning
15-
resharper_redundant_empty_object_creation_argument_list_highlighting = none
16-
1710
[*.{xml,config,*proj,nuspec,props,resx,targets,yml,tasks}]
1811
indent_size = 2
1912

@@ -37,4 +30,250 @@ charset = utf-8-bom
3730
indent_size = 2
3831

3932
[justfile]
40-
indent_size = 2
33+
indent_size = 2
34+
35+
[*.cs]
36+
indent_size = 4
37+
tab_width = 4
38+
39+
# Diagnostics
40+
dotnet_analyzer_diagnostic.category-Style.severity = warning
41+
dotnet_diagnostic.CA1032.severity = none
42+
dotnet_diagnostic.CA1822.severity = none
43+
dotnet_diagnostic.CA2007.severity = none
44+
dotnet_diagnostic.CA2227.severity = none
45+
dotnet_diagnostic.IDE0005.severity = warning
46+
dotnet_diagnostic.IDE0008.severity = none
47+
dotnet_diagnostic.IDE0022.severity = none
48+
dotnet_diagnostic.IDE0061.severity = none
49+
dotnet_diagnostic.IDE0058.severity = none
50+
51+
# Organize usings
52+
dotnet_separate_import_directive_groups = false
53+
dotnet_sort_system_directives_first = true
54+
file_header_template = unset
55+
56+
# this. and Me. preferences
57+
dotnet_style_qualification_for_event = false
58+
dotnet_style_qualification_for_field = false
59+
dotnet_style_qualification_for_method = false
60+
dotnet_style_qualification_for_property = false
61+
62+
# Language keywords vs BCL types preferences
63+
dotnet_style_predefined_type_for_locals_parameters_members = true
64+
dotnet_style_predefined_type_for_member_access = true
65+
66+
# Parentheses preferences
67+
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
68+
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
69+
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
70+
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
71+
72+
# Modifier preferences
73+
dotnet_style_require_accessibility_modifiers = for_non_interface_members
74+
75+
# Expression-level preferences
76+
dotnet_style_coalesce_expression = true
77+
dotnet_style_collection_initializer = true
78+
dotnet_style_explicit_tuple_names = true
79+
dotnet_style_namespace_match_folder = true
80+
dotnet_style_null_propagation = true
81+
dotnet_style_object_initializer = true
82+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
83+
dotnet_style_prefer_auto_properties = true
84+
dotnet_style_prefer_collection_expression = when_types_loosely_match
85+
dotnet_style_prefer_compound_assignment = true
86+
dotnet_style_prefer_conditional_expression_over_assignment = true
87+
dotnet_style_prefer_conditional_expression_over_return = true
88+
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
89+
dotnet_style_prefer_inferred_anonymous_type_member_names = true
90+
dotnet_style_prefer_inferred_tuple_names = true
91+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
92+
dotnet_style_prefer_simplified_boolean_expressions = true
93+
dotnet_style_prefer_simplified_interpolation = true
94+
95+
# Field preferences
96+
dotnet_style_readonly_field = true
97+
98+
# Parameter preferences
99+
dotnet_code_quality_unused_parameters = all:silent
100+
101+
# Suppression preferences
102+
dotnet_remove_unnecessary_suppression_exclusions = none
103+
104+
# New line preferences
105+
dotnet_style_allow_multiple_blank_lines_experimental = true
106+
dotnet_style_allow_statement_immediately_after_block_experimental = true
107+
108+
#### C# Coding Conventions ####
109+
110+
# var preferences
111+
csharp_style_var_elsewhere = false
112+
csharp_style_var_for_built_in_types = false
113+
csharp_style_var_when_type_is_apparent = false
114+
115+
# Expression-bodied members
116+
csharp_style_expression_bodied_accessors = true
117+
csharp_style_expression_bodied_constructors = false
118+
csharp_style_expression_bodied_indexers = true
119+
csharp_style_expression_bodied_lambdas = true
120+
csharp_style_expression_bodied_local_functions = false
121+
csharp_style_expression_bodied_methods = false
122+
csharp_style_expression_bodied_operators = false
123+
csharp_style_expression_bodied_properties = true
124+
125+
# Pattern matching preferences
126+
csharp_style_pattern_matching_over_as_with_null_check = true
127+
csharp_style_pattern_matching_over_is_with_cast_check = true
128+
csharp_style_prefer_extended_property_pattern = true
129+
csharp_style_prefer_not_pattern = true
130+
csharp_style_prefer_pattern_matching = true
131+
csharp_style_prefer_switch_expression = true
132+
133+
# Null-checking preferences
134+
csharp_style_conditional_delegate_call = true
135+
136+
# Modifier preferences
137+
csharp_prefer_static_local_function = true
138+
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
139+
csharp_style_prefer_readonly_struct = true
140+
csharp_style_prefer_readonly_struct_member = true
141+
142+
# Code-block preferences
143+
csharp_prefer_braces = true
144+
csharp_prefer_simple_using_statement = true
145+
csharp_style_namespace_declarations = file_scoped:warning
146+
csharp_style_prefer_method_group_conversion = true
147+
csharp_style_prefer_primary_constructors = true
148+
csharp_style_prefer_top_level_statements = true
149+
150+
# Expression-level preferences
151+
csharp_prefer_simple_default_expression = true
152+
csharp_style_deconstructed_variable_declaration = true
153+
csharp_style_implicit_object_creation_when_type_is_apparent = true
154+
csharp_style_inlined_variable_declaration = true
155+
csharp_style_prefer_index_operator = true
156+
csharp_style_prefer_local_over_anonymous_function = true
157+
csharp_style_prefer_null_check_over_type_check = true
158+
csharp_style_prefer_range_operator = true
159+
csharp_style_prefer_tuple_swap = true
160+
csharp_style_prefer_utf8_string_literals = true
161+
csharp_style_throw_expression = true
162+
csharp_style_unused_value_assignment_preference = discard_variable
163+
csharp_style_unused_value_expression_statement_preference = discard_variable
164+
165+
# 'using' directive preferences
166+
csharp_using_directive_placement = outside_namespace
167+
168+
# New line preferences
169+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
170+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
171+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
172+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
173+
csharp_style_allow_embedded_statements_on_same_line_experimental = true
174+
175+
#### C# Formatting Rules ####
176+
177+
# New line preferences
178+
csharp_new_line_before_catch = true
179+
csharp_new_line_before_else = true
180+
csharp_new_line_before_finally = true
181+
csharp_new_line_before_members_in_anonymous_types = true
182+
csharp_new_line_before_members_in_object_initializers = true
183+
csharp_new_line_before_open_brace = all
184+
csharp_new_line_between_query_expression_clauses = true
185+
186+
# Indentation preferences
187+
csharp_indent_block_contents = true
188+
csharp_indent_braces = false
189+
csharp_indent_case_contents = true
190+
csharp_indent_case_contents_when_block = true
191+
csharp_indent_labels = one_less_than_current
192+
csharp_indent_switch_labels = true
193+
194+
# Space preferences
195+
csharp_space_after_cast = false
196+
csharp_space_after_colon_in_inheritance_clause = true
197+
csharp_space_after_comma = true
198+
csharp_space_after_dot = false
199+
csharp_space_after_keywords_in_control_flow_statements = true
200+
csharp_space_after_semicolon_in_for_statement = true
201+
csharp_space_around_binary_operators = before_and_after
202+
csharp_space_around_declaration_statements = false
203+
csharp_space_before_colon_in_inheritance_clause = true
204+
csharp_space_before_comma = false
205+
csharp_space_before_dot = false
206+
csharp_space_before_open_square_brackets = false
207+
csharp_space_before_semicolon_in_for_statement = false
208+
csharp_space_between_empty_square_brackets = false
209+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
210+
csharp_space_between_method_call_name_and_opening_parenthesis = false
211+
csharp_space_between_method_call_parameter_list_parentheses = false
212+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
213+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
214+
csharp_space_between_method_declaration_parameter_list_parentheses = false
215+
csharp_space_between_parentheses = false
216+
csharp_space_between_square_brackets = false
217+
218+
# Wrapping preferences
219+
csharp_preserve_single_line_blocks = true
220+
csharp_preserve_single_line_statements = true
221+
222+
#### Naming styles ####
223+
224+
# Naming rules
225+
226+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
227+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
228+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
229+
230+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
231+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
232+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
233+
234+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
235+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
236+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
237+
238+
dotnet_naming_rule.const_fields.symbols = const_fields
239+
dotnet_naming_rule.const_fields.style = pascal_case
240+
dotnet_naming_rule.const_fields.severity = suggestion
241+
242+
dotnet_naming_rule.private_members_with_underscore.symbols = private_fields
243+
dotnet_naming_rule.private_members_with_underscore.style = prefix_underscore
244+
dotnet_naming_rule.private_members_with_underscore.severity = suggestion
245+
246+
# Symbol specifications
247+
248+
dotnet_naming_symbols.interface.applicable_kinds = interface
249+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
250+
dotnet_naming_symbols.interface.required_modifiers =
251+
252+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
253+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
254+
dotnet_naming_symbols.types.required_modifiers =
255+
256+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
257+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
258+
dotnet_naming_symbols.non_field_members.required_modifiers =
259+
260+
dotnet_naming_symbols.private_fields.applicable_kinds = field
261+
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
262+
263+
dotnet_naming_symbols.const_fields.applicable_kinds = field
264+
dotnet_naming_symbols.const_fields.required_modifiers = const
265+
266+
# Naming styles
267+
268+
dotnet_naming_style.pascal_case.required_prefix =
269+
dotnet_naming_style.pascal_case.required_suffix =
270+
dotnet_naming_style.pascal_case.word_separator =
271+
dotnet_naming_style.pascal_case.capitalization = pascal_case
272+
273+
dotnet_naming_style.begins_with_i.required_prefix = I
274+
dotnet_naming_style.begins_with_i.required_suffix =
275+
dotnet_naming_style.begins_with_i.word_separator =
276+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
277+
278+
dotnet_naming_style.prefix_underscore.capitalization = camel_case
279+
dotnet_naming_style.prefix_underscore.required_prefix = _

src/GovUk.Frontend.AspNetCore.DocSamples/Startup.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
namespace GovUk.Frontend.AspNetCore.DocSamples;
22

3-
public class Startup
3+
public class Startup(IConfiguration configuration)
44
{
5-
public Startup(IConfiguration configuration)
6-
{
7-
Configuration = configuration;
8-
}
9-
10-
public IConfiguration Configuration { get; }
5+
public IConfiguration Configuration { get; } = configuration;
116

127
public void ConfigureServices(IServiceCollection services)
138
{

0 commit comments

Comments
 (0)