diff --git a/.editorconfig b/.editorconfig index 1c1b1008f..1148e2a81 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,156 +1,38 @@ +# top-most EditorConfig file +root = true + +# global baselines [*] charset = utf-8 +end_of_line = lf + indent_style = space indent_size = 2 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -max_line_length = 150 +tab_width = 2 -[*.{cs,csx,vb,vbx}] -indent_size = 4 +line_length = 150 max_line_length = 150 +trim_trailing_whitespace = true +insert_final_newline = true -[*.cs] -csharp_indent_block_contents = true - -# IDE0161 Convert to file-scoped namespace -csharp_style_namespace_declarations = file_scoped:suggestion -csharp_using_directive_placement = outside_namespace:warning -dotnet_style_namespace_match_folder = false:none - -# CA1051: Do not declare visible instance fields -dotnet_diagnostic.CA1051.severity = silent - -# CA1303: Do not pass literals as localized parameters -dotnet_diagnostic.CA1303.severity = none - -# CA1720: Identifier contains type name -dotnet_diagnostic.CA1720.severity = silent -dotnet_diagnostic.IDE0090.severity = suggestion -dotnet_diagnostic.SA1413.severity = silent -dotnet_diagnostic.SA1200.severity = silent - -# CS1591 Missing XML comment for publicly visible type -dotnet_diagnostic.CS1591.severity = none - -# SA0001: XML comment analysis disabled -dotnet_diagnostic.SA0001.severity = none - -# SA1000: Keywords should be spaced correctly -dotnet_diagnostic.SA1000.severity = silent - -# SA1101: Prefix local calls with this -dotnet_diagnostic.SA1101.severity = none - -# SA1108: Block statements should not contain embedded comments -dotnet_diagnostic.SA1108.severity = silent - -# SA1117: Parameters should be on same line or separate lines -dotnet_diagnostic.SA1117.severity = none - -# SA1118: Parameter should not span multiple lines -dotnet_diagnostic.SA1118.severity = silent - -# SA1202: Elements should be ordered by access -dotnet_diagnostic.SA1202.severity = silent - -# SA1208: Using directive sorting -dotnet_sort_system_directives_first = true - -# SA1512: Single-line comments should not be followed by blank line -dotnet_diagnostic.SA1512.severity = silent - -# SA1514: Element documentation header should be preceded by blank line -dotnet_diagnostic.SA1514.severity = silent - -# SA1516: Elements should be separated by blank line -dotnet_diagnostic.SA1516.severity = silent - -# SA1600: Elements should be documented -dotnet_diagnostic.SA1600.severity = none - -# SA1601: Partial elements should be documented -dotnet_diagnostic.SA1601.severity = silent - -# SA1602: Enumeration items should be documented -dotnet_diagnostic.SA1602.severity = silent - -# SA1633: File should have header -dotnet_diagnostic.SA1633.severity = none - -# Misc IDE -dotnet_diagnostic.IDE0055.severity = suggestion -dotnet_diagnostic.IDE0059.severity = suggestion -dotnet_diagnostic.IDE0060.severity = suggestion -dotnet_diagnostic.IDE0062.severity = suggestion -dotnet_diagnostic.IDE0063.severity = suggestion -dotnet_diagnostic.IDE0065.severity = suggestion -dotnet_diagnostic.IDE0066.severity = suggestion -dotnet_diagnostic.IDE0071.severity = suggestion -dotnet_diagnostic.IDE0047.severity = suggestion -csharp_indent_labels = no_change -csharp_prefer_simple_using_statement = true:suggestion -csharp_prefer_braces = true:suggestion -csharp_style_prefer_method_group_conversion = true:silent -csharp_style_expression_bodied_methods = true:suggestion -csharp_style_expression_bodied_constructors = false:suggestion -csharp_style_expression_bodied_operators = false:silent -csharp_style_expression_bodied_properties = true:silent -csharp_style_expression_bodied_indexers = true:silent -csharp_style_expression_bodied_accessors = true:silent -csharp_style_expression_bodied_lambdas = true:warning -csharp_style_expression_bodied_local_functions = true:silent -csharp_style_throw_expression = true:suggestion -csharp_style_prefer_null_check_over_type_check = true:suggestion -dotnet_diagnostic.IDE0161.severity = suggestion -csharp_space_around_binary_operators = before_and_after -csharp_prefer_simple_default_expression = true:suggestion -csharp_style_prefer_local_over_anonymous_function = true:suggestion -csharp_style_prefer_index_operator = true:suggestion -csharp_style_prefer_range_operator = true:suggestion -csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion -csharp_style_prefer_tuple_swap = true:suggestion -csharp_style_inlined_variable_declaration = true:suggestion -csharp_style_deconstructed_variable_declaration = true:suggestion -csharp_style_unused_value_assignment_preference = discard_variable:suggestion -csharp_style_unused_value_expression_statement_preference = discard_variable:none -csharp_prefer_static_local_function = true:suggestion -csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:silent -csharp_style_conditional_delegate_call = true:suggestion -csharp_style_prefer_parameter_null_checking = true:suggestion -csharp_style_prefer_switch_expression = true:suggestion -csharp_style_prefer_pattern_matching = true:silent -csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion -csharp_style_pattern_matching_over_as_with_null_check = true:suggestion -csharp_style_prefer_not_pattern = true:suggestion -csharp_style_prefer_extended_property_pattern = true:suggestion -csharp_style_var_for_built_in_types = false:warning -csharp_style_var_when_type_is_apparent = false:warning -csharp_style_var_elsewhere = false:suggestion -csharp_indent_case_contents = true -csharp_style_prefer_top_level_statements = false:silent -csharp_style_prefer_utf8_string_literals = true:suggestion -csharp_preserve_single_line_statements = false -csharp_style_prefer_primary_constructors = true:suggestion +[*.{csproj,props,targets}] +indent_style = space +indent_size = 2 -# IDE0058: Expression value is never used -dotnet_diagnostic.IDE0058.severity = none -dotnet_diagnostic.IDE0077.severity = warning -dotnet_diagnostic.IDE0100.severity = suggestion +[*.yml] +indent_style = space +indent_size = 2 [*.{cs,vb}] tab_width = 4 -end_of_line = crlf +indent_size = 4 +end_of_line = lf #### Naming styles #### # Naming rules -dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning +dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i @@ -192,33 +74,49 @@ dotnet_naming_style.pascal_case.required_prefix = dotnet_naming_style.pascal_case.required_suffix = dotnet_naming_style.pascal_case.word_separator = dotnet_naming_style.pascal_case.capitalization = pascal_case + +dotnet_code_quality_unused_parameters = all:suggestion + +dotnet_sort_system_directives_first = true + dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_predefined_type_for_locals_parameters_members = true:silent +dotnet_style_namespace_match_folder = false:none dotnet_style_coalesce_expression = true:suggestion dotnet_style_null_propagation = true:suggestion -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning +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_prefer_simplified_boolean_expressions = true:suggestion -dotnet_style_prefer_conditional_expression_over_assignment = true:silent -dotnet_style_prefer_conditional_expression_over_return = true:silent -dotnet_style_explicit_tuple_names = true:suggestion -dotnet_style_prefer_inferred_tuple_names = true:suggestion -dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion -dotnet_style_prefer_compound_assignment = true:suggestion -dotnet_style_prefer_simplified_interpolation = true:suggestion -dotnet_style_readonly_field = true:suggestion -dotnet_style_predefined_type_for_locals_parameters_members = true:silent -dotnet_style_predefined_type_for_member_access = true:silent -dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent -dotnet_code_quality_unused_parameters = all:suggestion -dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent -dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent -dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent -dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent -dotnet_style_qualification_for_field = false:silent -dotnet_style_qualification_for_property = false:silent -dotnet_style_qualification_for_method = false:silent -dotnet_style_qualification_for_event = false:silent -dotnet_style_allow_multiple_blank_lines_experimental = false:suggestion -dotnet_style_allow_statement_immediately_after_block_experimental = false:suggestion +dotnet_style_prefer_collection_expression = true:suggestion + +[*.cs] +csharp_indent_labels = one_less_than_current +csharp_using_directive_placement = outside_namespace:warning +csharp_prefer_simple_using_statement = true:suggestion +csharp_prefer_static_local_function = true:suggestion +csharp_prefer_braces = true:suggestion +csharp_style_namespace_declarations = file_scoped:suggestion +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_top_level_statements = true:silent +csharp_style_prefer_primary_constructors = true:suggestion +csharp_style_expression_bodied_methods = true:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent +csharp_style_prefer_local_over_anonymous_function = true:suggestion +csharp_style_unused_value_assignment_preference = unused_local_variable:suggestion +csharp_style_prefer_switch_expression = true:suggestion +csharp_style_prefer_pattern_matching = true:silent +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion +csharp_style_prefer_extended_property_pattern = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion + +dotnet_diagnostic.CA1303.severity = none +dotnet_diagnostic.CS1591.severity = silent +dotnet_diagnostic.IDE0058.severity = none diff --git a/.github/workflows/build-indicators.yml b/.github/workflows/build-indicators.yml index 04f3137d3..3f0f65931 100644 --- a/.github/workflows/build-indicators.yml +++ b/.github/workflows/build-indicators.yml @@ -71,7 +71,6 @@ jobs: results-path: ./test-indicators/**/*.trx coverage-path: ./test-indicators/**/coverage.cobertura.xml coverage-type: cobertura - coverage-threshold: 95 - name: Post coverage to Codacy uses: codacy/codacy-coverage-reporter-action@v1 diff --git a/Stock.Indicators.sln b/Stock.Indicators.sln index 0337bb528..10a0bbd4f 100644 --- a/Stock.Indicators.sln +++ b/Stock.Indicators.sln @@ -19,13 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Other", "tests\other\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests.Performance", "tests\performance\Tests.Performance.csproj", "{3BD4837B-D197-41FD-A286-A3256D0770E1}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{3A4158F9-4165-4823-9526-0CFAACCF1ACC}" - ProjectSection(SolutionItems) = preProject - .github\build.main.yml = .github\build.main.yml - .github\workflows\build.yml = .github\workflows\build.yml - .github\dependabot.yml = .github\dependabot.yml - EndProjectSection -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/src/GlobalSuppressions.cs b/src/GlobalSuppressions.cs index 76fb16060..7d50eec5e 100644 --- a/src/GlobalSuppressions.cs +++ b/src/GlobalSuppressions.cs @@ -21,6 +21,12 @@ Scope = "member", Target = "~P:Skender.Stock.Indicators.IBasicData.Date")] +[assembly: SuppressMessage("Naming", + "CA1720:Identifier contains type name" + , Justification = "Not really an issue.", + Scope = "type", + Target = "~T:Skender.Stock.Indicators.ChandelierType")] + [assembly: SuppressMessage( "Naming", "CA1720:Identifier contains type name", @@ -44,3 +50,4 @@ "StyleCop.CSharp.SpacingRules", "SA1010:Opening square brackets should be spaced correctly", Justification = "Invalid for new C# 12 [ collection ] syntax.")] + diff --git a/src/Indicators.csproj b/src/Indicators.csproj index 3c9961ff0..a1e1a8ad7 100644 --- a/src/Indicators.csproj +++ b/src/Indicators.csproj @@ -72,10 +72,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/tests/indicators/Tests.Indicators.csproj b/tests/indicators/Tests.Indicators.csproj index 7c032e42d..07d210c97 100644 --- a/tests/indicators/Tests.Indicators.csproj +++ b/tests/indicators/Tests.Indicators.csproj @@ -22,10 +22,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/tests/other/CustomIndicator.Tests.cs b/tests/other/CustomIndicator.Tests.cs index c9250d63c..328909e2f 100644 --- a/tests/other/CustomIndicator.Tests.cs +++ b/tests/other/CustomIndicator.Tests.cs @@ -84,9 +84,6 @@ public class CustomIndicatorTests { private static readonly CultureInfo EnglishCulture = new("en-US", false); -#pragma warning disable SA1307 // Accessible fields should begin with upper-case letter -#pragma warning disable SA1304 // Non-private readonly fields should begin with upper-case letter -#pragma warning disable SA1311 // Static readonly fields should begin with upper-case letter internal static readonly IEnumerable quotes = TestData.GetDefault(); internal static readonly IEnumerable otherQuotes = TestData.GetCompare(); internal static readonly IEnumerable badQuotes = TestData.GetBad(); @@ -100,9 +97,6 @@ public class CustomIndicatorTests internal static readonly IEnumerable randomQuotes = TestData.GetRandom(1000); internal static readonly IEnumerable zeroesQuotes = TestData.GetZeros(); internal static readonly IEnumerable<(DateTime, double)> tupleNanny = TestData.GetTupleNaN(); -#pragma warning restore SA1307 // Accessible fields should begin with upper-case letter -#pragma warning restore SA1304 // Non-private readonly fields should begin with upper-case letter -#pragma warning restore SA1311 // Static readonly fields should begin with upper-case letter [TestMethod] public void Standard() diff --git a/tests/other/Tests.Other.csproj b/tests/other/Tests.Other.csproj index 0a90d5f6d..7da941782 100644 --- a/tests/other/Tests.Other.csproj +++ b/tests/other/Tests.Other.csproj @@ -17,10 +17,6 @@ - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - diff --git a/tests/performance/GlobalSuppressions.cs b/tests/performance/GlobalSuppressions.cs index 3a263f58b..0d913b5dc 100644 --- a/tests/performance/GlobalSuppressions.cs +++ b/tests/performance/GlobalSuppressions.cs @@ -16,3 +16,9 @@ Justification = "Required for BenchmarkDotNet", Scope = "member", Target = "~F:Tests.Performance.InternalsPerformance.Periods")] + +[assembly: SuppressMessage("Design", + "CA1051:Do not declare visible instance fields", + Justification = "Required for BenchmarkDotNet", + Scope = "member", + Target = "~F:Tests.Performance.InternalsPerformance.Periods")] diff --git a/tests/performance/Tests.Performance.csproj b/tests/performance/Tests.Performance.csproj index ec1a5c91b..6fac7a425 100644 --- a/tests/performance/Tests.Performance.csproj +++ b/tests/performance/Tests.Performance.csproj @@ -14,16 +14,12 @@ - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + +