From 0b150c5a909c7c258fd6a4784b577ff92be6f491 Mon Sep 17 00:00:00 2001 From: Joachim Dekker Date: Mon, 18 Mar 2024 14:33:31 +0100 Subject: [PATCH] Chore: Add extra analysis settings to csprojects (#9) Additionally, I have added labels to clearly indicate the function of every package. --- .editorconfig | 48 ++++++++++++++++++++++------------ .github/workflows/test.yml | 2 ++ Aplib.Core/Aplib.Core.csproj | 15 ++++++++++- Aplib.Tests/Aplib.Tests.csproj | 11 ++++++-- 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/.editorconfig b/.editorconfig index ae78fbbd..f9bff8bd 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,6 +1,9 @@ # Remove the line below if you want to inherit .editorconfig settings from higher directories root = true +# XMLDOC settings +xmldoc_indent_size = 0 + # C# files [*.cs] @@ -82,14 +85,14 @@ csharp_style_var_for_built_in_types = false csharp_style_var_when_type_is_apparent = false # Expression-bodied members -csharp_style_expression_bodied_accessors = when_on_single_line -csharp_style_expression_bodied_constructors = when_on_single_line -csharp_style_expression_bodied_indexers = when_on_single_line -csharp_style_expression_bodied_lambdas = when_on_single_line -csharp_style_expression_bodied_local_functions = when_on_single_line -csharp_style_expression_bodied_methods = when_on_single_line -csharp_style_expression_bodied_operators = when_on_single_line -csharp_style_expression_bodied_properties = when_on_single_line +csharp_style_expression_bodied_accessors = when_on_single_line:silent +csharp_style_expression_bodied_constructors = when_on_single_line:silent +csharp_style_expression_bodied_indexers = when_on_single_line:silent +csharp_style_expression_bodied_lambdas = when_on_single_line:silent +csharp_style_expression_bodied_local_functions = when_on_single_line:silent +csharp_style_expression_bodied_methods = when_on_single_line:silent +csharp_style_expression_bodied_operators = when_on_single_line:silent +csharp_style_expression_bodied_properties = when_on_single_line:silent # Pattern matching preferences csharp_style_pattern_matching_over_as_with_null_check = true @@ -109,12 +112,12 @@ csharp_style_prefer_readonly_struct = true csharp_style_prefer_readonly_struct_member = true # Code-block preferences -csharp_prefer_braces = when_multiline -csharp_prefer_simple_using_statement = true -csharp_style_namespace_declarations = file_scoped -csharp_style_prefer_method_group_conversion = true -csharp_style_prefer_primary_constructors = true -csharp_style_prefer_top_level_statements = true +csharp_prefer_braces = when_multiline:silent +csharp_prefer_simple_using_statement = true:suggestion +csharp_style_namespace_declarations = file_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_primary_constructors = true:suggestion +csharp_style_prefer_top_level_statements = true:silent # Expression-level preferences csharp_prefer_simple_default_expression = true @@ -132,7 +135,7 @@ csharp_style_unused_value_assignment_preference = discard_variable csharp_style_unused_value_expression_statement_preference = discard_variable # 'using' directive preferences -csharp_using_directive_placement = outside_namespace +csharp_using_directive_placement = outside_namespace:silent # New line preferences csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false @@ -236,6 +239,17 @@ dotnet_naming_style.begins_with_i.required_prefix = I dotnet_naming_style.begins_with_i.required_suffix = dotnet_naming_style.begins_with_i.word_separator = dotnet_naming_style.begins_with_i.capitalization = pascal_case - dotnet_naming_style.prefix_underscore.capitalization = camel_case -dotnet_naming_style.prefix_underscore.required_prefix = _ \ No newline at end of file +dotnet_naming_style.prefix_underscore.required_prefix = _ + +[*.{cs,vb}] +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_operator_placement_when_wrapping = beginning_of_line +tab_width = 4 +indent_size = 4 +end_of_line = crlf diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index feec7297..67388bc9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,8 @@ jobs: java-version: 17 distribution: 'zulu' - uses: actions/checkout@v4 + with: + fetch-depth: 1 - name: Cache SonarCloud packages uses: actions/cache@v4 with: diff --git a/Aplib.Core/Aplib.Core.csproj b/Aplib.Core/Aplib.Core.csproj index 7da3b872..bd6367c6 100644 --- a/Aplib.Core/Aplib.Core.csproj +++ b/Aplib.Core/Aplib.Core.csproj @@ -1,11 +1,24 @@  - + netstandard2.1 9.0 enable + + true + preview + true + + + + + all + runtime; build; native; contentfiles; analyzers + + + diff --git a/Aplib.Tests/Aplib.Tests.csproj b/Aplib.Tests/Aplib.Tests.csproj index 80c9f58c..b2470e8f 100644 --- a/Aplib.Tests/Aplib.Tests.csproj +++ b/Aplib.Tests/Aplib.Tests.csproj @@ -9,7 +9,7 @@ true - + @@ -23,7 +23,14 @@ - + + + all + runtime; build; native; contentfiles; analyzers + + + +