Skip to content

Commit 29a5284

Browse files
StojanovicMilostyphoon41Milos Stojanovic
authored
editorconfig (#63)
* editorconfig fixes: use var * Fixing package publish --------- Co-authored-by: Nikola Dragićević <nda@enigmatry.com> Co-authored-by: Milos Stojanovic <mso@enigmatry.com>
1 parent 980e5d7 commit 29a5284

File tree

13 files changed

+150
-110
lines changed

13 files changed

+150
-110
lines changed

.editorconfig

Lines changed: 95 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
2-
###############################
3-
# Core EditorConfig Options #
4-
###############################
5-
# All files
6-
[*]
2+
###############################
3+
# Core EditorConfig Options #
4+
###############################
5+
# All files
6+
[*]
77
indent_style = space
8-
# Code files
8+
# Code files
99
[*.{cs,csx,vb,vbx}]
1010
indent_size = 4
1111
insert_final_newline = true
1212
charset = utf-8-bom
13-
###############################
14-
# .NET Coding Conventions #
15-
###############################
13+
###############################
14+
# .NET Coding Conventions #
15+
###############################
1616
[*.{cs,vb}]
1717
# Organize usings
1818
dotnet_sort_system_directives_first = true:suggestion
@@ -21,74 +21,96 @@ dotnet_style_qualification_for_field = false:silent
2121
dotnet_style_qualification_for_property = false:silent
2222
dotnet_style_qualification_for_method = false:silent
2323
dotnet_style_qualification_for_event = false:silent
24-
# Language keywords vs BCL types preferences
24+
# Language keywords vs BCL types preferences
2525
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
2626
dotnet_style_predefined_type_for_member_access = false:suggestion
27-
# Parentheses preferences
27+
# Parentheses preferences
2828
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
2929
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
3030
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
3131
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
32-
# Modifier preferences
32+
# Modifier preferences
3333
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
3434
dotnet_style_readonly_field = true:suggestion
35-
# Expression-level preferences
35+
# Expression-level preferences
3636
dotnet_style_object_initializer = true:suggestion
37-
dotnet_style_collection_initializer = true:suggestion
38-
dotnet_style_explicit_tuple_names = true:suggestion
39-
dotnet_style_null_propagation = true:suggestion
37+
dotnet_style_collection_initializer = true:warning
38+
dotnet_style_explicit_tuple_names = true:error
39+
dotnet_style_null_propagation = true:error
4040
dotnet_style_coalesce_expression = true:suggestion
41-
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
41+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
4242
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
4343
dotnet_style_prefer_inferred_tuple_names = true:suggestion
44-
dotnet_style_prefer_auto_properties = true:silent
45-
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
46-
dotnet_style_prefer_conditional_expression_over_return = true:silent
47-
###############################
48-
# C# Coding Conventions #
49-
###############################
44+
dotnet_style_prefer_auto_properties = true:suggestion
45+
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
46+
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
47+
dotnet_style_operator_placement_when_wrapping = beginning_of_line:suggestion
48+
dotnet_style_prefer_compound_assignment = true:error
49+
dotnet_style_prefer_simplified_boolean_expressions = true:warning
50+
dotnet_style_prefer_simplified_interpolation = true:warning
51+
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed:silent
52+
dotnet_style_prefer_collection_expression = true:suggestion
53+
###############################
54+
# C# Coding Conventions #
55+
###############################
5056
[*.cs]
51-
# var preferences
52-
csharp_style_var_for_built_in_types = true:silent
53-
csharp_style_var_when_type_is_apparent = true:silent
54-
csharp_style_var_elsewhere = false:silent
55-
# Expression-bodied members
56-
csharp_style_expression_bodied_methods = false:silent
57+
# var preferences
58+
csharp_style_var_elsewhere = true:suggestion
59+
csharp_style_var_for_built_in_types = true:warning
60+
csharp_style_var_when_type_is_apparent = true:warning
61+
csharp_style_prefer_tuple_swap = true:suggestion
62+
# Expression-bodied members
63+
csharp_style_expression_bodied_methods = true:suggestion
5764
csharp_style_expression_bodied_constructors = false:silent
5865
csharp_style_expression_bodied_operators = false:silent
59-
csharp_style_expression_bodied_properties = true:silent
66+
csharp_style_expression_bodied_properties = true:suggestion
6067
csharp_style_expression_bodied_indexers = true:silent
61-
csharp_style_expression_bodied_accessors = true:silent
62-
# Pattern matching preferences
68+
csharp_style_expression_bodied_accessors = true:suggestion
69+
csharp_style_expression_bodied_lambdas = true:silent
70+
csharp_style_expression_bodied_local_functions = false:silent
71+
# Expression-level preferences
72+
csharp_prefer_simple_default_expression = true:error
73+
csharp_style_deconstructed_variable_declaration = true:silent
74+
csharp_style_inlined_variable_declaration = true:warning
75+
csharp_style_pattern_local_over_anonymous_function = true:suggestion
76+
csharp_style_prefer_index_operator = true:warning
77+
csharp_style_prefer_range_operator = true:suggestion
78+
csharp_style_throw_expression = true:warning
79+
csharp_style_unused_value_assignment_preference = discard_variable:error
80+
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
81+
csharp_style_prefer_utf8_string_literals = true:suggestion
82+
csharp_style_prefer_readonly_struct = true:suggestion
83+
csharp_style_prefer_readonly_struct_member = true:suggestion
84+
# Pattern matching preferences
6385
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
6486
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
65-
# Null-checking preferences
87+
# Null-checking preferences
6688
csharp_style_throw_expression = true:suggestion
6789
csharp_style_conditional_delegate_call = true:suggestion
68-
# Modifier preferences
90+
# Modifier preferences
6991
csharp_preferred_modifier_order = public,internal,protected,private,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
70-
# Expression-level preferences
92+
# Expression-level preferences
7193
csharp_prefer_braces = true:silent
7294
csharp_style_deconstructed_variable_declaration = true:suggestion
7395
csharp_prefer_simple_default_expression = true:suggestion
7496
csharp_style_pattern_local_over_anonymous_function = true:suggestion
7597
csharp_style_inlined_variable_declaration = true:suggestion
76-
###############################
77-
# C# Formatting Rules #
78-
###############################
79-
# New line preferences
98+
###############################
99+
# C# Formatting Rules #
100+
###############################
101+
# New line preferences
80102
csharp_new_line_before_open_brace = all
81103
csharp_new_line_before_else = true
82104
csharp_new_line_before_catch = true
83105
csharp_new_line_before_finally = true
84106
csharp_new_line_before_members_in_object_initializers = true
85107
csharp_new_line_before_members_in_anonymous_types = true
86108
csharp_new_line_between_query_expression_clauses = true
87-
# Indentation preferences
109+
# Indentation preferences
88110
csharp_indent_case_contents = true
89111
csharp_indent_switch_labels = true
90112
csharp_indent_labels = flush_left
91-
# Space preferences
113+
# Space preferences
92114
csharp_space_after_cast = false
93115
csharp_space_after_keywords_in_control_flow_statements = true
94116
csharp_space_between_method_call_parameter_list_parentheses = false
@@ -100,60 +122,60 @@ csharp_space_around_binary_operators = before_and_after
100122
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
101123
csharp_space_between_method_call_name_and_opening_parenthesis = false
102124
csharp_space_between_method_call_empty_parameter_list_parentheses = false
103-
# Wrapping preferences
125+
# Wrapping preferences
104126
csharp_preserve_single_line_statements = false
105127
csharp_preserve_single_line_blocks = true
106-
###############################
107-
# Naming Conventions #
108-
###############################
109-
# Style Definitions
128+
###############################
129+
# Naming Conventions #
130+
###############################
131+
# Style Definitions
110132
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
111133
dotnet_naming_style.camel_case_style.capitalization = camel_case
112134
dotnet_naming_style.underscore_prefix_style.capitalization = camel_case
113135
dotnet_naming_style.underscore_prefix_style.required_prefix = _
114136
dotnet_naming_style.interface_prefix_style.capitalization = pascal_case
115137
dotnet_naming_style.interface_prefix_style.required_prefix = I
116138
# Use PascalCase for types
117-
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
118-
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
119-
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case_style
139+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
140+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
141+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case_style
120142
dotnet_naming_symbols.types.applicable_kinds = class,struct,enum
121-
dotnet_naming_symbols.types.applicable_accessibilities = *
143+
dotnet_naming_symbols.types.applicable_accessibilities = *
122144
# Use camelCase for parameters and local variables
123-
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
124-
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals
125-
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
145+
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
146+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals
147+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
126148
dotnet_naming_symbols.locals.applicable_kinds = parameter
127-
# Use PascalCase for constant fields
128-
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
149+
# Use PascalCase for constant fields
150+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
129151
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
130-
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
131-
dotnet_naming_symbols.constant_fields.applicable_kinds = field
132-
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
152+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
153+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
154+
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
133155
dotnet_naming_symbols.constant_fields.required_modifiers = const
134-
# Use PascalCase for readonly static fields
135-
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = suggestion
156+
# Use PascalCase for readonly static fields
157+
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = suggestion
136158
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields
137-
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case_style
138-
dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
139-
dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = *
159+
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case_style
160+
dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
161+
dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = *
140162
dotnet_naming_symbols.static_readonly_fields.required_modifiers = static,readonly
141163
# Use underscore prefix and camel case for (non-constant) fields
142-
dotnet_naming_rule.fields_should_be_prefixed_underscore.severity = suggestion
143-
dotnet_naming_rule.fields_should_be_prefixed_underscore.symbols = fields
144-
dotnet_naming_rule.fields_should_be_prefixed_underscore.style = underscore_prefix_style
145-
dotnet_naming_symbols.fields.applicable_kinds = field
164+
dotnet_naming_rule.fields_should_be_prefixed_underscore.severity = suggestion
165+
dotnet_naming_rule.fields_should_be_prefixed_underscore.symbols = fields
166+
dotnet_naming_rule.fields_should_be_prefixed_underscore.style = underscore_prefix_style
167+
dotnet_naming_symbols.fields.applicable_kinds = field
146168
dotnet_naming_symbols.fields.applicable_accessibilities = *
147169
# Use PascalCase for all members except fields
148-
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
149-
dotnet_naming_rule.members_should_be_pascal_case.symbols = members
150-
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
170+
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
171+
dotnet_naming_rule.members_should_be_pascal_case.symbols = members
172+
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
151173
dotnet_naming_symbols.members.applicable_kinds = property,method,event,delegate
152174
dotnet_naming_symbols.members.applicable_accessibilities = *
153175
# Use PascalCase and I prefix for interfaces
154-
dotnet_naming_rule.interfaces_should_be_prefixed_with_I.severity = suggestion
155-
dotnet_naming_rule.interfaces_should_be_prefixed_with_I.symbols = interfaces
156-
dotnet_naming_rule.interfaces_should_be_prefixed_with_I.style = interface_prefix_style
176+
dotnet_naming_rule.interfaces_should_be_prefixed_with_I.severity = suggestion
177+
dotnet_naming_rule.interfaces_should_be_prefixed_with_I.symbols = interfaces
178+
dotnet_naming_rule.interfaces_should_be_prefixed_with_I.style = interface_prefix_style
157179
dotnet_naming_symbols.interfaces.applicable_kinds = interface
158180
dotnet_naming_symbols.interfaces.applicable_accessibilities = *
159181

Enigmatry.Entry.CodeGeneration.Configuration.Tests/ExpressionExtensionsFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public void TestGetPropertyInfoFromPropertyExpression()
1212
{
1313
Expression<Func<Model1, string>> propertyExpression = model => model.Title;
1414

15-
System.Reflection.PropertyInfo propertyInfo = propertyExpression.GetPropertyInfo();
15+
var propertyInfo = propertyExpression.GetPropertyInfo();
1616

1717
propertyInfo.ShouldNotBeNull();
1818
propertyInfo.Name.ShouldBe(nameof(Model1.Title));

Enigmatry.Entry.CodeGeneration.Configuration.Tests/Form/FormComponentBuilderFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public void TestBuildFormComponentModel()
1212
{
1313
var builder = new FormComponentBuilder<Project1>();
1414

15-
FormComponentModel componentModel = builder.Build();
15+
var componentModel = builder.Build();
1616

1717
componentModel.ShouldNotBeNull();
1818
componentModel.ComponentInfo.ShouldNotBeNull();

Enigmatry.Entry.CodeGeneration.Configuration.Tests/Form/FormComponentConfigurationFixture.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ public void Setup()
2323
public void TestFormComponentConfiguration()
2424
{
2525
_configuration.Configure(_builder);
26-
FormComponentModel formComponent = _builder.Build();
26+
var formComponent = _builder.Build();
2727

2828
formComponent.ShouldNotBeNull();
2929
formComponent.ComponentInfo.Name.ShouldBe("ProjectDetails");
3030
formComponent.ComponentInfo.Feature.Name.ShouldBe("Projects");
3131

3232
formComponent.FormControls.Count.ShouldBe(5);
3333

34-
Configuration.Form.Controls.FormControl titleFormControl = formComponent.FormControls.Single(x => x.PropertyName == nameof(ProjectDetails.Title).ToLowerInvariant());
34+
var titleFormControl = formComponent.FormControls.Single(x => x.PropertyName == nameof(ProjectDetails.Title).ToLowerInvariant());
3535

3636
titleFormControl.ValidationRules.Count.ShouldBe(1);
3737
titleFormControl.ValidationRules.Single()
3838
.FormlyRuleName
3939
.ShouldBe("maxLength");
4040

41-
Configuration.Form.Controls.FormControl detailsFormControl = formComponent.FormControls.Single(x => x.PropertyName == nameof(ProjectDetails.Description).ToLowerInvariant());
41+
var detailsFormControl = formComponent.FormControls.Single(x => x.PropertyName == nameof(ProjectDetails.Description).ToLowerInvariant());
4242
detailsFormControl.ValidationRules.Count.ShouldBe(1);
4343
detailsFormControl.ValidationRules.Single()
4444
.FormlyRuleName
@@ -51,7 +51,7 @@ public void TestExcludedUnconfiguredProperties()
5151
_builder.Component().IncludeUnconfiguredProperties(false);
5252

5353
_configuration.Configure(_builder);
54-
FormComponentModel formComponent = _builder.Build();
54+
var formComponent = _builder.Build();
5555

5656
formComponent.ShouldNotBeNull();
5757
formComponent.FormControls.Count.ShouldBe(4);
@@ -63,7 +63,7 @@ public void TestOrderByModel()
6363
_builder.Component().OrderBy(OrderByType.Model);
6464

6565
_configuration.Configure(_builder);
66-
FormComponentModel formComponent = _builder.Build();
66+
var formComponent = _builder.Build();
6767

6868
formComponent.ShouldNotBeNull();
6969
formComponent.FormControls.Count.ShouldBe(5);
@@ -81,7 +81,7 @@ public void TestOrderByConfiguration()
8181
_builder.Component().OrderBy(OrderByType.Configuration);
8282

8383
_configuration.Configure(_builder);
84-
FormComponentModel formComponent = _builder.Build();
84+
var formComponent = _builder.Build();
8585

8686
formComponent.ShouldNotBeNull();
8787
formComponent.FormControls.Count.ShouldBe(5);

Enigmatry.Entry.CodeGeneration.Configuration.Tests/List/ListComponentBuilderFixture.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public void TestBuildListComponentModel()
1414
builder.Component().HasName("ProjectList");
1515
builder.Component().BelongsToFeature("Projects");
1616

17-
ListComponentModel componentModel = builder.Build();
17+
var componentModel = builder.Build();
1818

1919
componentModel.ComponentInfo.Name.ShouldBe("ProjectList");
2020
componentModel.ComponentInfo.Feature.Name.ShouldBe("Projects");
@@ -24,7 +24,7 @@ public void TestBuildListComponentModel()
2424
public void TestColumnsAreVisibleByDefault()
2525
{
2626
var builder = new ListComponentBuilder<Project1>();
27-
ListComponentModel componentModel = builder.Build();
27+
var componentModel = builder.Build();
2828
componentModel.Columns.Count.ShouldBe(2);
2929
}
3030

@@ -39,9 +39,9 @@ public void TestColumnsShouldBeConfigurable()
3939
.WithHeaderName("Test Title")
4040
.WithTranslationId("title");
4141

42-
ListComponentModel componentModel = builder.Build();
42+
var componentModel = builder.Build();
4343

44-
Configuration.List.Model.ColumnDefinition? column = componentModel.Columns.FirstOrDefault(c => c.HeaderName == "Test Title");
44+
var column = componentModel.Columns.FirstOrDefault(c => c.HeaderName == "Test Title");
4545
column.ShouldNotBeNull();
4646
column!.IsVisible.ShouldBeTrue();
4747
column.IsSortable.ShouldBeFalse();

0 commit comments

Comments
 (0)