Skip to content

Commit 585fa00

Browse files
authored
Cleaned all warnings in Core, .Blazor project + minor suggestions (#62)
Cleaned up warnings and code suggestions
1 parent f629ddf commit 585fa00

33 files changed

+832
-902
lines changed

src/.editorconfig

+7-4
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ dotnet_style_operator_placement_when_wrapping = beginning_of_line
5151
tab_width = 4
5252
indent_size = 4
5353
end_of_line = crlf
54-
dotnet_style_coalesce_expression = true:suggestion
54+
dotnet_style_coalesce_expression = false:suggestion
5555
dotnet_style_null_propagation = true:suggestion
5656
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
5757
dotnet_style_prefer_auto_properties = true:silent
5858
dotnet_style_object_initializer = true:suggestion
5959
dotnet_style_collection_initializer = true:suggestion
6060
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
61-
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
62-
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
61+
dotnet_style_prefer_conditional_expression_over_assignment = false:suggestion
62+
dotnet_style_prefer_conditional_expression_over_return = false:suggestion
6363
dotnet_style_explicit_tuple_names = true:suggestion
6464
dotnet_style_prefer_inferred_tuple_names = true:suggestion
6565
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
@@ -69,6 +69,9 @@ dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
6969
dotnet_style_namespace_match_folder = true:suggestion
7070
indent_style = tab
7171

72+
# Code Quality
73+
dotnet_code_quality.CA1826.exclude_ordefault_methods = true
74+
7275
[*.cs]
7376
csharp_indent_labels = one_less_than_current
7477
csharp_space_around_binary_operators = before_and_after
@@ -78,7 +81,7 @@ csharp_prefer_braces = true:silent
7881
csharp_style_namespace_declarations = block_scoped:silent
7982
csharp_style_prefer_method_group_conversion = true:silent
8083
csharp_style_prefer_top_level_statements = true:silent
81-
csharp_style_prefer_primary_constructors = true:suggestion
84+
csharp_style_prefer_primary_constructors = false:suggestion
8285
csharp_prefer_system_threading_lock = true:suggestion
8386
csharp_style_expression_bodied_methods = false:silent
8487
csharp_style_expression_bodied_constructors = false:silent

src/NodeDev.Blazor/Components/ClassExplorer.razor

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,9 @@
202202
}).Result;
203203

204204
NodeDev.Core.Types.TypeBase typeBase;
205-
if (result.Data is Type type)
205+
if (result?.Data is Type type)
206206
typeBase = Class.TypeFactory.Get(type, null);
207-
else if (result.Data is NodeDev.Core.Types.TypeBase t)
207+
else if (result?.Data is NodeDev.Core.Types.TypeBase t)
208208
typeBase = t;
209209
else
210210
return;
@@ -234,7 +234,7 @@
234234
{
235235
if (CurrentlyEditingItem!.Type == TreeItemType.Method)
236236
{
237-
var method = new Core.Class.NodeClassMethod(Class, Text, Class.TypeFactory.Get(typeof(void), null), new Core.Graph());
237+
var method = new Core.Class.NodeClassMethod(Class, Text, Class.TypeFactory.Get(typeof(void), null));
238238
Class.AddMethod(method, createEntryAndReturn: true);
239239

240240
Items.First(x => x.Value!.Type == TreeItemType.MethodsFolder).Children!.RemoveAll(x => x.Value == CurrentlyEditingItem);

src/NodeDev.Blazor/Components/DebuggerConsolePanel.razor.cs

+2
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,8 @@ private void AddText(string text)
7878

7979
public void Dispose()
8080
{
81+
GC.SuppressFinalize(this);
82+
8183
GraphExecutionChangedDisposable?.Dispose();
8284
RefreshRequiredDisposable?.Dispose();
8385

src/NodeDev.Blazor/Components/EditMethodMenu.razor

+4-4
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
</CellTemplate>
2020
</TemplateColumn>
2121

22-
<CallbackSetColumn Property="x => x.Name" SetCallback="(x, name) => x.Rename(name)" IsEditable="true" />
22+
<CallbackSetColumn Property="x => x.Name" SetCallback="(x, name) => x.Rename(name)" Editable="true" />
2323

2424
<TemplateColumn Title="IsOut">
2525
<EditTemplate>
2626
<MudCheckBox T="bool" Value="context.Item?.IsOut ?? false" ValueChanged="@(v => context.Item?.SetIsOut(v))"></MudCheckBox>
2727
</EditTemplate>
2828
</TemplateColumn>
2929

30-
<TemplateColumn IsEditable="false">
30+
<TemplateColumn Editable="false">
3131

3232
<CellTemplate>
3333

@@ -73,9 +73,9 @@
7373
}).Result;
7474

7575
NodeDev.Core.Types.TypeBase typeBase;
76-
if (result.Data is Type type)
76+
if (result?.Data is Type type)
7777
typeBase = Method.Class.TypeFactory.Get(type, null);
78-
else if (result.Data is NodeDev.Core.Types.TypeBase t)
78+
else if (result?.Data is NodeDev.Core.Types.TypeBase t)
7979
typeBase = t;
8080
else
8181
return;

0 commit comments

Comments
 (0)