From 44c535bf183d5cdb76d905c338d93d2a3328014f Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Mon, 13 Jan 2025 21:11:09 +1300 Subject: [PATCH 01/14] Change from .globalconfig to .editorconfig --- .editorconfig | 277 +++++++++++++++++++++++++++++++++++++++++++++----- .globalconfig | 259 ---------------------------------------------- 2 files changed, 253 insertions(+), 283 deletions(-) delete mode 100644 .globalconfig diff --git a/.editorconfig b/.editorconfig index c9d1c36c..824ab12f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,37 +9,266 @@ indent_style = space # (Please don't specify an indent_size here; that has too many unintended consequences.) spelling_exclusion_path = SpellingExclusions.dic max_line_length = 150 +insert_final_newline = true +indent_size = 2 +tab_width = 2 + +# Shell script files +[*.sh] +end_of_line = lf # Code files [*.{cs,csx,vb,vbx}] -indent_size = 2 -tab_width = 2 end_of_line = crlf -insert_final_newline = true charset = utf-8-bom -# XML project files -[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] -indent_size = 2 -tab_width = 2 +# Sort using and Import directives with System.* appearing first +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = false +# Avoid "this." and "Me." if not necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion -# XML config files -[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] -indent_size = 2 -tab_width = 2 +# Use language keywords instead of framework type names for type references +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion -# JSON files -[*.json] -indent_size = 2 -tab_width = 2 +# Suggest more modern language features when available +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion -# Powershell files -[*.ps1] -indent_size = 2 -tab_width = 2 +# Whitespace options +dotnet_style_allow_multiple_blank_lines_experimental = false:suggestion -# Shell script files -[*.sh] -end_of_line = lf -indent_size = 2 -tab_width = 2 +# Non-private static fields are PascalCase +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields +dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected +dotnet_naming_symbols.non_private_static_fields.required_modifiers = static + +dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case + +# Non-private readonly fields are PascalCase +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields +dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected +dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly + +dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case + +# Constants are PascalCase +dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants +dotnet_naming_rule.constants_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.constants.applicable_kinds = field, local +dotnet_naming_symbols.constants.required_modifiers = const + +dotnet_naming_style.constant_style.capitalization = pascal_case + +# Static fields are camelCase and start with s_ +dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields +dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style + +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static + +dotnet_naming_style.static_field_style.capitalization = camel_case +dotnet_naming_style.static_field_style.required_prefix = s_ + +# Instance fields are camelCase and start with _ +dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion +dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields +dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style + +dotnet_naming_symbols.instance_fields.applicable_kinds = field + +dotnet_naming_style.instance_field_style.capitalization = camel_case +dotnet_naming_style.instance_field_style.required_prefix = _ + +# Locals and parameters are camelCase +dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion +dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters +dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style + +dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local + +dotnet_naming_style.camel_case_style.capitalization = camel_case + +# Local functions are PascalCase +dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions +dotnet_naming_rule.local_functions_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.local_functions.applicable_kinds = local_function + +dotnet_naming_style.local_function_style.capitalization = pascal_case + +# By default, name items with PascalCase +dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members +dotnet_naming_rule.members_should_be_pascal_case.style = non_private_static_field_style + +dotnet_naming_symbols.all_members.applicable_kinds = * + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# RS0016: Only enable if API files are present +dotnet_public_api_analyzer.require_api_files = true +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:warning +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion +dotnet_style_prefer_conditional_expression_over_return = 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_namespace_match_folder = true:suggestion +dotnet_style_readonly_field = true:suggestion +dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion +dotnet_style_allow_statement_immediately_after_block_experimental = false:suggestion +dotnet_code_quality_unused_parameters = all:suggestion +dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion +dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:suggestion +dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion +dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion +dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion + +# Newline settings +csharp_new_line_before_open_brace = types,methods,properties +csharp_new_line_before_else = false +csharp_new_line_before_catch = false +csharp_new_line_before_finally = false +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_case_contents_when_block = true +csharp_indent_switch_labels = true +csharp_indent_labels = flush_left + +# Whitespace options +csharp_style_allow_embedded_statements_on_same_line_experimental = false:none +csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion +csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:suggestion +csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false:silent +csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false:silent + +# Prefer "var" everywhere +csharp_style_var_for_built_in_types = false:suggestion +csharp_style_var_when_type_is_apparent = false:suggestion +csharp_style_var_elsewhere = false:suggestion + +# Prefer method-like constructs to have a block body +csharp_style_expression_bodied_methods = when_on_single_line:suggestion +csharp_style_expression_bodied_constructors = when_on_single_line:suggestion +csharp_style_expression_bodied_operators = true:suggestion + +# Prefer property-like constructs to have an expression-body +csharp_style_expression_bodied_properties = true:suggestion +csharp_style_expression_bodied_indexers = true:suggestion +csharp_style_expression_bodied_accessors = true:suggestion + +# Suggest more modern language features when available +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion +csharp_style_prefer_extended_property_pattern = true:suggestion + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# Blocks are allowed +csharp_prefer_braces = true:silent +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = true + +csharp_using_directive_placement = outside_namespace:warning +csharp_prefer_simple_using_statement = true:suggestion +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_prefer_method_group_conversion = true:suggestion +csharp_style_prefer_top_level_statements = true:suggestion +csharp_style_prefer_primary_constructors = true:suggestion +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = true:suggestion +csharp_style_prefer_null_check_over_type_check = true:suggestion +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_prefer_utf8_string_literals = true:suggestion +csharp_style_deconstructed_variable_declaration = true:suggestion +csharp_style_unused_value_assignment_preference = discard_variable:silent +csharp_style_unused_value_expression_statement_preference = discard_variable:silent +csharp_prefer_static_local_function = true:suggestion +csharp_style_prefer_readonly_struct = true:suggestion +csharp_style_prefer_readonly_struct_member = true:suggestion +csharp_style_prefer_switch_expression = true:suggestion +csharp_style_prefer_pattern_matching = true:suggestion +csharp_style_prefer_not_pattern = true:suggestion + +dotnet_diagnostic.CA1000.severity = warning +dotnet_diagnostic.CA1001.severity = warning +dotnet_diagnostic.CA1010.severity = warning +dotnet_diagnostic.CA1036.severity = suggestion +dotnet_diagnostic.CA1310.severity = warning +dotnet_diagnostic.CA1708.severity = warning +dotnet_diagnostic.CA1716.severity = warning +dotnet_diagnostic.CA1725.severity = warning +dotnet_diagnostic.CA1727.severity = warning +dotnet_diagnostic.CA1805.severity = warning +dotnet_diagnostic.CA1812.severity = none + +# CA1852: Type can be sealed +dotnet_diagnostic.CA1852.severity = warning + +dotnet_diagnostic.CS9107.severity = none + +# IDE0060: Remove unused parameter +dotnet_diagnostic.IDE0060.severity = warning + +# IDE2001: Embedded statements must be on their own line +dotnet_diagnostic.IDE2001.severity = none diff --git a/.globalconfig b/.globalconfig deleted file mode 100644 index 7d6c4c4f..00000000 --- a/.globalconfig +++ /dev/null @@ -1,259 +0,0 @@ -is_global = true - -indent_style = space -spelling_exclusion_path = SpellingExclusions.dic -max_line_length = 150 -insert_final_newline = true -indent_size = 2 -tab_width = 2 - -# Sort using and Import directives with System.* appearing first -dotnet_sort_system_directives_first = true -dotnet_separate_import_directive_groups = false -# Avoid "this." and "Me." if not necessary -dotnet_style_qualification_for_field = false:suggestion -dotnet_style_qualification_for_property = false:suggestion -dotnet_style_qualification_for_method = false:suggestion -dotnet_style_qualification_for_event = false:suggestion - -# Use language keywords instead of framework type names for type references -dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion -dotnet_style_predefined_type_for_member_access = true:suggestion - -# Suggest more modern language features when available -dotnet_style_object_initializer = true:suggestion -dotnet_style_collection_initializer = true:suggestion -dotnet_style_coalesce_expression = true:suggestion -dotnet_style_null_propagation = true:suggestion -dotnet_style_explicit_tuple_names = true:suggestion - -# Whitespace options -dotnet_style_allow_multiple_blank_lines_experimental = false:suggestion - -# Non-private static fields are PascalCase -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields -dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style - -dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field -dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected -dotnet_naming_symbols.non_private_static_fields.required_modifiers = static - -dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case - -# Non-private readonly fields are PascalCase -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields -dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_static_field_style - -dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field -dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected -dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly - -dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case - -# Constants are PascalCase -dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants -dotnet_naming_rule.constants_should_be_pascal_case.style = non_private_static_field_style - -dotnet_naming_symbols.constants.applicable_kinds = field, local -dotnet_naming_symbols.constants.required_modifiers = const - -dotnet_naming_style.constant_style.capitalization = pascal_case - -# Static fields are camelCase and start with s_ -dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion -dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields -dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style - -dotnet_naming_symbols.static_fields.applicable_kinds = field -dotnet_naming_symbols.static_fields.required_modifiers = static - -dotnet_naming_style.static_field_style.capitalization = camel_case -dotnet_naming_style.static_field_style.required_prefix = s_ - -# Instance fields are camelCase and start with _ -dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion -dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields -dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style - -dotnet_naming_symbols.instance_fields.applicable_kinds = field - -dotnet_naming_style.instance_field_style.capitalization = camel_case -dotnet_naming_style.instance_field_style.required_prefix = _ - -# Locals and parameters are camelCase -dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion -dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters -dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style - -dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local - -dotnet_naming_style.camel_case_style.capitalization = camel_case - -# Local functions are PascalCase -dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions -dotnet_naming_rule.local_functions_should_be_pascal_case.style = non_private_static_field_style - -dotnet_naming_symbols.local_functions.applicable_kinds = local_function - -dotnet_naming_style.local_function_style.capitalization = pascal_case - -# By default, name items with PascalCase -dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion -dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members -dotnet_naming_rule.members_should_be_pascal_case.style = non_private_static_field_style - -dotnet_naming_symbols.all_members.applicable_kinds = * - -dotnet_naming_style.pascal_case_style.capitalization = pascal_case - -# RS0016: Only enable if API files are present -dotnet_public_api_analyzer.require_api_files = true -dotnet_style_operator_placement_when_wrapping = beginning_of_line -dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion -dotnet_style_prefer_auto_properties = true:warning -dotnet_style_prefer_simplified_boolean_expressions = true:suggestion -dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion -dotnet_style_prefer_conditional_expression_over_return = 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_namespace_match_folder = true:suggestion -dotnet_style_readonly_field = true:suggestion -dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion -dotnet_style_allow_statement_immediately_after_block_experimental = false:suggestion -dotnet_code_quality_unused_parameters = all:suggestion -dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion -dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:suggestion -dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion -dotnet_style_parentheses_in_other_operators = never_if_unnecessary:suggestion -dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion - -# Newline settings -csharp_new_line_before_open_brace = types,methods,properties -csharp_new_line_before_else = false -csharp_new_line_before_catch = false -csharp_new_line_before_finally = false -csharp_new_line_before_members_in_object_initializers = true -csharp_new_line_before_members_in_anonymous_types = true -csharp_new_line_between_query_expression_clauses = true - -# Indentation preferences -csharp_indent_block_contents = true -csharp_indent_braces = false -csharp_indent_case_contents = true -csharp_indent_case_contents_when_block = true -csharp_indent_switch_labels = true -csharp_indent_labels = flush_left - -# Whitespace options -csharp_style_allow_embedded_statements_on_same_line_experimental = false:none -csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:suggestion -csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false:suggestion -csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false:silent -csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false:silent - -# Prefer "var" everywhere -csharp_style_var_for_built_in_types = false:suggestion -csharp_style_var_when_type_is_apparent = false:suggestion -csharp_style_var_elsewhere = false:suggestion - -# Prefer method-like constructs to have a block body -csharp_style_expression_bodied_methods = when_on_single_line:suggestion -csharp_style_expression_bodied_constructors = when_on_single_line:suggestion -csharp_style_expression_bodied_operators = true:suggestion - -# Prefer property-like constructs to have an expression-body -csharp_style_expression_bodied_properties = true:suggestion -csharp_style_expression_bodied_indexers = true:suggestion -csharp_style_expression_bodied_accessors = true:suggestion - -# Suggest more modern language features when available -csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion -csharp_style_pattern_matching_over_as_with_null_check = true:suggestion -csharp_style_inlined_variable_declaration = true:suggestion -csharp_style_throw_expression = true:suggestion -csharp_style_conditional_delegate_call = true:suggestion -csharp_style_prefer_extended_property_pattern = true:suggestion - -# Space preferences -csharp_space_after_cast = false -csharp_space_after_colon_in_inheritance_clause = true -csharp_space_after_comma = true -csharp_space_after_dot = false -csharp_space_after_keywords_in_control_flow_statements = true -csharp_space_after_semicolon_in_for_statement = true -csharp_space_around_binary_operators = before_and_after -csharp_space_around_declaration_statements = do_not_ignore -csharp_space_before_colon_in_inheritance_clause = true -csharp_space_before_comma = false -csharp_space_before_dot = false -csharp_space_before_open_square_brackets = false -csharp_space_before_semicolon_in_for_statement = false -csharp_space_between_empty_square_brackets = false -csharp_space_between_method_call_empty_parameter_list_parentheses = false -csharp_space_between_method_call_name_and_opening_parenthesis = false -csharp_space_between_method_call_parameter_list_parentheses = false -csharp_space_between_method_declaration_empty_parameter_list_parentheses = false -csharp_space_between_method_declaration_name_and_open_parenthesis = false -csharp_space_between_method_declaration_parameter_list_parentheses = false -csharp_space_between_parentheses = false -csharp_space_between_square_brackets = false - -# Blocks are allowed -csharp_prefer_braces = true:silent -csharp_preserve_single_line_blocks = true -csharp_preserve_single_line_statements = true - -csharp_using_directive_placement = outside_namespace:warning -csharp_prefer_simple_using_statement = true:suggestion -csharp_style_namespace_declarations = file_scoped:warning -csharp_style_prefer_method_group_conversion = true:suggestion -csharp_style_prefer_top_level_statements = true:suggestion -csharp_style_prefer_primary_constructors = true:suggestion -csharp_style_expression_bodied_lambdas = true:suggestion -csharp_style_expression_bodied_local_functions = true:suggestion -csharp_style_prefer_null_check_over_type_check = true:suggestion -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_prefer_utf8_string_literals = true:suggestion -csharp_style_deconstructed_variable_declaration = true:suggestion -csharp_style_unused_value_assignment_preference = discard_variable:silent -csharp_style_unused_value_expression_statement_preference = discard_variable:silent -csharp_prefer_static_local_function = true:suggestion -csharp_style_prefer_readonly_struct = true:suggestion -csharp_style_prefer_readonly_struct_member = true:suggestion -csharp_style_prefer_switch_expression = true:suggestion -csharp_style_prefer_pattern_matching = true:suggestion -csharp_style_prefer_not_pattern = true:suggestion - -dotnet_diagnostic.CA1000.severity = warning -dotnet_diagnostic.CA1001.severity = warning -dotnet_diagnostic.CA1010.severity = warning -dotnet_diagnostic.CA1036.severity = suggestion -dotnet_diagnostic.CA1310.severity = warning -dotnet_diagnostic.CA1708.severity = warning -dotnet_diagnostic.CA1716.severity = warning -dotnet_diagnostic.CA1725.severity = warning -dotnet_diagnostic.CA1727.severity = warning -dotnet_diagnostic.CA1805.severity = warning -dotnet_diagnostic.CA1812.severity = none - -# CA1852: Type can be sealed -dotnet_diagnostic.CA1852.severity = warning - -dotnet_diagnostic.CS9107.severity = none - -# IDE0060: Remove unused parameter -dotnet_diagnostic.IDE0060.severity = warning - -# IDE2001: Embedded statements must be on their own line -dotnet_diagnostic.IDE2001.severity = none From 14ded65b07d7d99490a87b14fb7ad10799311e7f Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Mon, 13 Jan 2025 22:46:56 +1300 Subject: [PATCH 02/14] Update analyzers and resolve warnings etc # Conflicts: # src/GqlPlus.Modeller/Models/GlobalsModels.cs # test/GqlPlus.ComponentTestBase/OperationData.gen.cs # test/GqlPlus.ComponentTestBase/SampleData.gen.cs # test/GqlPlus.ComponentTestBase/SchemaData.gen.cs # test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeOperationsTests.cs --- .editorconfig | 26 +++++++++++++++++++ .gitignore | 2 +- Directory.Build.props | 2 +- GqlPlus.sln | 3 +-- format.ps1 | 4 ++- .../Rendering/RenderStructure.cs | 2 +- src/GqlPlus.Parser/Ast/Schema/SchemaAst.cs | 4 +-- src/GqlPlus.Parser/Parsing/ValueListParser.cs | 9 +++---- src/GqlPlus.Parser/Result/ResultArrayOk.cs | 9 +++---- src/GqlPlus.Parser/Result/ResultError.cs | 9 +++---- .../Verifying/Schema/AstParentVerifier.cs | 1 + .../Schema/Simple/VerifyUnionTypes.cs | 8 +++--- test/GqlPlus.ComponentTestBase/BuildData.t4 | 2 +- .../BuiltInTests.cs | 1 - .../Ast/AstDirectivesTests.cs | 15 +++++------ .../Schema/Objects/AstObjectAlternateTests.cs | 21 ++++++--------- .../Ast/Schema/Objects/AstObjectBaseTests.cs | 19 +++++--------- .../Ast/Schema/Objects/AstObjectFieldTests.cs | 21 ++++++--------- .../Ast/Schema/Objects/AstObjectTests.cs | 14 ++++------ .../Merging/Globals/MergeCategoriesTests.cs | 4 +-- .../Merging/Globals/MergeDirectivesTests.cs | 4 +-- .../Merging/Globals/MergeOptionsTests.cs | 4 +-- .../Merging/Objects/MergeDualFieldsTests.cs | 4 +-- .../Merging/Objects/MergeInputFieldsTests.cs | 4 +-- .../Objects/MergeInputParametersTests.cs | 4 +-- .../Merging/Objects/MergeOutputFieldsTests.cs | 4 +-- .../Objects/MergeTypeParametersTests.cs | 4 +-- .../Merging/Objects/TestAlternatesMerger.cs | 4 +-- .../Merging/Simple/MergeEnumMembersTests.cs | 4 +-- .../Merging/Simple/MergeEnumsTests.cs | 2 +- .../Merging/TestTyped.cs | 4 +-- .../Parsing/Schema/Simple/BaseDomainTests.cs | 11 ++++---- .../Parsing/Schema/Simple/BaseSimpleTests.cs | 2 +- .../Parsing/Schema/Simple/ParseEnumTests.cs | 8 +++--- 34 files changed, 119 insertions(+), 120 deletions(-) diff --git a/.editorconfig b/.editorconfig index 824ab12f..ebfd37a5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -12,6 +12,27 @@ max_line_length = 150 insert_final_newline = true indent_size = 2 tab_width = 2 +csharp_indent_labels = flush_left +csharp_using_directive_placement = outside_namespace:warning +csharp_prefer_simple_using_statement = true:suggestion +csharp_prefer_braces = true:silent +csharp_style_namespace_declarations = file_scoped:warning +csharp_style_prefer_method_group_conversion = true:suggestion +csharp_style_prefer_top_level_statements = true:suggestion +csharp_style_prefer_primary_constructors = true:suggestion +csharp_prefer_system_threading_lock = true:suggestion +csharp_style_expression_bodied_methods = when_on_single_line:suggestion +csharp_style_expression_bodied_constructors = when_on_single_line:suggestion +csharp_style_expression_bodied_operators = true:suggestion +csharp_style_expression_bodied_properties = true:suggestion +csharp_style_expression_bodied_indexers = true:suggestion +csharp_style_expression_bodied_accessors = true:suggestion +csharp_style_expression_bodied_lambdas = true:suggestion +csharp_style_expression_bodied_local_functions = true:suggestion +csharp_prefer_static_local_function = true:suggestion +csharp_prefer_static_anonymous_function = true:suggestion +csharp_style_prefer_readonly_struct = true:suggestion +csharp_style_prefer_readonly_struct_member = true:suggestion # Shell script files [*.sh] @@ -255,6 +276,7 @@ dotnet_diagnostic.CA1001.severity = warning dotnet_diagnostic.CA1010.severity = warning dotnet_diagnostic.CA1036.severity = suggestion dotnet_diagnostic.CA1310.severity = warning +dotnet_diagnostic.CA1515.severity = none dotnet_diagnostic.CA1708.severity = warning dotnet_diagnostic.CA1716.severity = warning dotnet_diagnostic.CA1725.severity = warning @@ -272,3 +294,7 @@ dotnet_diagnostic.IDE0060.severity = warning # IDE2001: Embedded statements must be on their own line dotnet_diagnostic.IDE2001.severity = none + +# IDE0045: Convert to conditional expression +dotnet_diagnostic.IDE0045.severity = none +dotnet_diagnostic.IDE0046.severity = none diff --git a/.gitignore b/.gitignore index ee75afb0..8559e987 100644 --- a/.gitignore +++ b/.gitignore @@ -492,4 +492,4 @@ activities.yml per-class/ runs-*.yml Html/ -format-report.json +format/ diff --git a/Directory.Build.props b/Directory.Build.props index 02dd6926..78f965f7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,7 +6,7 @@ enable enable true - 8.0-all + latest-all false true GqlPlus diff --git a/GqlPlus.sln b/GqlPlus.sln index 2044ccf8..8c8167fe 100644 --- a/GqlPlus.sln +++ b/GqlPlus.sln @@ -18,14 +18,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .gitignore = .gitignore - .globalconfig = .globalconfig .prettierrc.yml = .prettierrc.yml .github\dependabot.yml = .github\dependabot.yml Directory.Build.props = Directory.Build.props .github\workflows\dotnet-test.yml = .github\workflows\dotnet-test.yml .config\dotnet-tools.json = .config\dotnet-tools.json - README.md = README.md format.ps1 = format.ps1 + README.md = README.md update.ps1 = update.ps1 EndProjectSection EndProject diff --git a/format.ps1 b/format.ps1 index a367b27e..8184e763 100644 --- a/format.ps1 +++ b/format.ps1 @@ -1,2 +1,4 @@ prettier -w . -dotnet format --verbosity detailed --report format-report.json +dotnet format whitespace --verbosity detailed --report format/whitespace-report.json +dotnet format style --verbosity detailed --report format/style-report.json +dotnet format analyzers --verbosity detailed --report format/analyzers-report.json diff --git a/src/GqlPlus.Modeller/Rendering/RenderStructure.cs b/src/GqlPlus.Modeller/Rendering/RenderStructure.cs index d876def0..8c7f061b 100644 --- a/src/GqlPlus.Modeller/Rendering/RenderStructure.cs +++ b/src/GqlPlus.Modeller/Rendering/RenderStructure.cs @@ -102,7 +102,7 @@ public RenderStructure AddSet(string key, TEnum set, string? tag = null, { Type type = typeof(TEnum); - if (type.GetCustomAttributes(typeof(FlagsAttribute)).Any()) { + if (type.GetCustomAttributes().Any()) { int flags = (int)(object)set; IDict result = NewDict; diff --git a/src/GqlPlus.Parser/Ast/Schema/SchemaAst.cs b/src/GqlPlus.Parser/Ast/Schema/SchemaAst.cs index bfd02353..aff16fe3 100644 --- a/src/GqlPlus.Parser/Ast/Schema/SchemaAst.cs +++ b/src/GqlPlus.Parser/Ast/Schema/SchemaAst.cs @@ -22,8 +22,8 @@ public string Show() { using StringWriter sw = new(); int indent = 0; - string[] begins = new[] { "(", "{", "[", "<" }; - string[] ends = new[] { ")", "}", "]", ">" }; + string[] begins = ["(", "{", "[", "<"]; + string[] ends = [")", "}", "]", ">"]; foreach (string? field in GetFields()) { if (string.IsNullOrWhiteSpace(field)) { continue; diff --git a/src/GqlPlus.Parser/Parsing/ValueListParser.cs b/src/GqlPlus.Parser/Parsing/ValueListParser.cs index c1a602a9..13c702de 100644 --- a/src/GqlPlus.Parser/Parsing/ValueListParser.cs +++ b/src/GqlPlus.Parser/Parsing/ValueListParser.cs @@ -3,12 +3,11 @@ namespace GqlPlus.Parsing; -public sealed class ValueListParser : Parser.IA +public sealed class ValueListParser( + Parser.D value +) : Parser.IA { - private readonly Parser.L _value; - - public ValueListParser(Parser.D value) - => _value = value; + private readonly Parser.L _value = value; public IResultArray Parse(TContext tokens, string label) where TContext : Tokenizer diff --git a/src/GqlPlus.Parser/Result/ResultArrayOk.cs b/src/GqlPlus.Parser/Result/ResultArrayOk.cs index b7b5700b..96493315 100644 --- a/src/GqlPlus.Parser/Result/ResultArrayOk.cs +++ b/src/GqlPlus.Parser/Result/ResultArrayOk.cs @@ -1,11 +1,10 @@ namespace GqlPlus.Result; -public readonly struct ResultArrayOk - : IResultArray, IResultOk> +public readonly struct ResultArrayOk( + IEnumerable result +) : IResultArray, IResultOk> { - public IEnumerable Result { get; } - - public ResultArrayOk(IEnumerable result) => Result = result; + public IEnumerable Result { get; } = result; public IResult AsPartial(TResult result, Action>? withValue = null, Action? action = null) { diff --git a/src/GqlPlus.Parser/Result/ResultError.cs b/src/GqlPlus.Parser/Result/ResultError.cs index 767a8e3f..17caf74b 100644 --- a/src/GqlPlus.Parser/Result/ResultError.cs +++ b/src/GqlPlus.Parser/Result/ResultError.cs @@ -2,12 +2,11 @@ namespace GqlPlus.Result; -public readonly struct ResultError - : IResultError +public readonly struct ResultError( + TokenMessage message +) : IResultError { - public TokenMessage Message { get; } - - public ResultError(TokenMessage message) => Message = message; + public TokenMessage Message { get; } = message; public IResult AsPartial(TResult result, Action? withValue = null, Action? action = null) { diff --git a/src/GqlPlus.Verifier/Verifying/Schema/AstParentVerifier.cs b/src/GqlPlus.Verifier/Verifying/Schema/AstParentVerifier.cs index 3e806d27..98353ed7 100644 --- a/src/GqlPlus.Verifier/Verifying/Schema/AstParentVerifier.cs +++ b/src/GqlPlus.Verifier/Verifying/Schema/AstParentVerifier.cs @@ -57,6 +57,7 @@ private void CheckTypedParentType(ParentUsage input, TContext context, boo onParent?.Invoke(parentType); } } + return; } diff --git a/src/GqlPlus.Verifier/Verifying/Schema/Simple/VerifyUnionTypes.cs b/src/GqlPlus.Verifier/Verifying/Schema/Simple/VerifyUnionTypes.cs index 945f64fc..4aea1b1f 100644 --- a/src/GqlPlus.Verifier/Verifying/Schema/Simple/VerifyUnionTypes.cs +++ b/src/GqlPlus.Verifier/Verifying/Schema/Simple/VerifyUnionTypes.cs @@ -31,9 +31,11 @@ protected override void UsageValue(IGqlpUnion usage, UsageContext context) } void CheckTypeLabel(string name, IGqlpType type) - { - context.AddError(usage, "union", $"Type kind mismatch for {name}. Found {type?.Label}", type is not IGqlpSimple and not IGqlpTypeSpecial); - } + => context.AddError( + usage, + "union", + $"Type kind mismatch for {name}. Found {type?.Label}", + type is not IGqlpSimple and not IGqlpTypeSpecial); } private static bool CheckMember(string name, IGqlpUnionItem member, UsageContext context, Action? checkType = null) diff --git a/test/GqlPlus.ComponentTestBase/BuildData.t4 b/test/GqlPlus.ComponentTestBase/BuildData.t4 index 08f8d42b..6bc465b9 100644 --- a/test/GqlPlus.ComponentTestBase/BuildData.t4 +++ b/test/GqlPlus.ComponentTestBase/BuildData.t4 @@ -17,7 +17,7 @@ private void BuildData(string directory, string prefix) { var gitFile = samplesDir.GetFiles("git-details.txt")[0]; string gitDetails; using (var gitText = gitFile.OpenText()) { - gitDetails = gitText.ReadToEnd(); + gitDetails = gitText.ReadToEnd().Trim(); }#> // Generated from <#= relative #> // Collected from <#= gitDetails #> diff --git a/test/GqlPlus.Modeller.ComponentTests/BuiltInTests.cs b/test/GqlPlus.Modeller.ComponentTests/BuiltInTests.cs index 9df7392a..f58360ce 100644 --- a/test/GqlPlus.Modeller.ComponentTests/BuiltInTests.cs +++ b/test/GqlPlus.Modeller.ComponentTests/BuiltInTests.cs @@ -69,7 +69,6 @@ public void ModelAllBasicTypes() Declarations = BuiltIn.Basic }; - ITypesContext context = renderer.Context(); RenderStructure result = renderer.RenderAst(schema, context); diff --git a/test/GqlPlus.Parser.ClassTests/Ast/AstDirectivesTests.cs b/test/GqlPlus.Parser.ClassTests/Ast/AstDirectivesTests.cs index f3c0a3a9..a10d385b 100644 --- a/test/GqlPlus.Parser.ClassTests/Ast/AstDirectivesTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Ast/AstDirectivesTests.cs @@ -47,21 +47,18 @@ private static string Directives(string[] directives) => " " + directives.Joined(d => $"( !d {d} )"); } -internal sealed class AstDirectivesChecks - : AstDirectivesChecks, IAstDirectivesChecks +internal sealed class AstDirectivesChecks( + BaseAstChecks.CreateBy create +) : AstDirectivesChecks(create), IAstDirectivesChecks where TAst : AstAbbreviated, IGqlpDirectives { - public AstDirectivesChecks(CreateBy create) - : base(create) { } } -internal class AstDirectivesChecks - : AstAbbreviatedChecks, IAstDirectivesChecks +internal class AstDirectivesChecks( + BaseAstChecks.CreateBy create +) : AstAbbreviatedChecks(create), IAstDirectivesChecks where TAst : AstAbbreviated, IGqlpDirectives { - public AstDirectivesChecks(CreateBy create) - : base(create) { } - public void HashCode(TInput input, string[] directives) => HashCode( () => CreateDirective(input, directives), diff --git a/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectAlternateTests.cs b/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectAlternateTests.cs index 824a33c9..726181ac 100644 --- a/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectAlternateTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectAlternateTests.cs @@ -39,8 +39,11 @@ public void ModifiedType_WithModifiersAndArgs(AlternateInput input, string[] arg internal abstract IAstObjectAlternateChecks AlternateChecks { get; } } -internal sealed class AstObjectAlternateChecks - : AstAbbreviatedChecks +internal sealed class AstObjectAlternateChecks( + AstObjectAlternateChecks.AlternateBy createAlternate, + AstObjectAlternateChecks.BaseBy createBase, + AstObjectAlternateChecks.ArgsBy createArgs +) : AstAbbreviatedChecks(input => createAlternate(input, createBase(input))) , IAstObjectAlternateChecks where TObjAltAst : AstObjAlternate where TObjBase : IGqlpObjBase @@ -48,22 +51,14 @@ internal sealed class AstObjectAlternateChecks createAlternate(input, createBase(input))) - { - _createAlternate = createAlternate; - _createBase = createBase; - _createArgs = createArgs; - } - public void HashCode_WithModifiers(AlternateInput input) => HashCode(() => CreateModifiers(input)); diff --git a/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectBaseTests.cs b/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectBaseTests.cs index 318a4de1..85319e5e 100644 --- a/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectBaseTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectBaseTests.cs @@ -59,25 +59,18 @@ public void FullType_WithIsTypeParamAndArgs(string input, string[] arguments) internal abstract IAstObjBaseChecks ObjBaseChecks { get; } } -internal sealed class AstObjBaseChecks - : AstAbbreviatedChecks +internal sealed class AstObjBaseChecks( +AstObjBaseChecks.BaseBy createBase, +AstObjBaseChecks.ArgsBy createArgs +) : AstAbbreviatedChecks(input => createBase(input)) , IAstObjBaseChecks where TObjBase : IGqlpObjBase where TObjBaseAst : AstObjBase, TObjBase where TObjArg : IGqlpObjArg where TObjArgAst : AstObjArg, TObjArg { - private readonly BaseBy _createBase; - private readonly ArgsBy _createArgs; - - public AstObjBaseChecks( - BaseBy createBase, - ArgsBy createArgs -) : base(input => createBase(input)) - { - _createBase = createBase; - _createArgs = createArgs; - } + private readonly BaseBy _createBase = createBase; + private readonly ArgsBy _createArgs = createArgs; internal delegate TObjBaseAst BaseBy(string input); internal delegate TObjArg[] ArgsBy(string[] argument); diff --git a/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectFieldTests.cs b/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectFieldTests.cs index 4f39537c..41d8b40e 100644 --- a/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectFieldTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectFieldTests.cs @@ -39,8 +39,11 @@ public void ModifiedType_WithModifiersAndArgs(FieldInput input, string[] argumen internal abstract IAstObjectFieldChecks FieldChecks { get; } } -internal sealed class AstObjectFieldChecks - : AstAliasedChecks +internal sealed class AstObjectFieldChecks( + AstObjectFieldChecks.FieldBy createField, + AstObjectFieldChecks.BaseBy createBase, + AstObjectFieldChecks.ArgsBy createArgs +) : AstAliasedChecks(input => createField(input, createBase(input))) , IAstObjectFieldChecks where TObjField : AstObjField where TObjBase : IGqlpObjBase @@ -48,22 +51,14 @@ internal sealed class AstObjectFieldChecks createField(input, createBase(input))) - { - _createField = createField; - _createBase = createBase; - _createArgs = createArgs; - } - public void HashCode_WithModifiers(FieldInput input) => HashCode(() => CreateModifiers(input)); diff --git a/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectTests.cs b/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectTests.cs index 572afa55..dba3c020 100644 --- a/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Ast/Schema/Objects/AstObjectTests.cs @@ -54,21 +54,17 @@ protected override string ParentString(string name, string parent) internal abstract IAstObjectChecks ObjectChecks { get; } } -internal abstract class AstObjectChecks - : AstTypeChecks +internal abstract class AstObjectChecks( +BaseAstChecks.CreateBy createInput, +AstTypeChecks.ParentCreator createParent, + [CallerArgumentExpression(nameof(createInput))] string createExpression = "" +) : AstTypeChecks(createInput, createParent, createExpression) , IAstObjectChecks where TObjectAst : AstObject where TObjBase : IGqlpObjBase where TObjField : IGqlpObjField where TObjAlt : IGqlpObjAlternate { - public AstObjectChecks( - CreateBy createInput, - ParentCreator createParent, - [CallerArgumentExpression(nameof(createInput))] string createExpression = "" -) : base(createInput, createParent, createExpression) - { } - public void Equality_WithAlternates(string name, AlternateInput[] alternates) => Equality(() => CreateInput(name) with { ObjAlternates = CreateAlternates(alternates) }); public void HashCode_WithAlternates(string name, AlternateInput[] alternates) diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeCategoriesTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeCategoriesTests.cs index ee553f6b..8c8fc6db 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeCategoriesTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeCategoriesTests.cs @@ -38,6 +38,6 @@ public void Merge_TwoAstsSameOutput_ReturnsExpected(string category) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpSchemaCategory MakeAliased(string name, string[]? aliases = null, string description = "") - => new CategoryDeclAst(AstNulls.At, name, description, name) { Aliases = aliases ?? [] }; + protected override IGqlpSchemaCategory MakeAliased(string input, string[]? aliases = null, string description = "") + => new CategoryDeclAst(AstNulls.At, input, description, input) { Aliases = aliases ?? [] }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeDirectivesTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeDirectivesTests.cs index c83b8256..71cd7dc0 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeDirectivesTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeDirectivesTests.cs @@ -59,6 +59,6 @@ public MergeDirectivesTests(ITestOutputHelper outputHelper) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpSchemaDirective MakeAliased(string name, string[]? aliases = null, string description = "") - => new DirectiveDeclAst(AstNulls.At, name, description) { Aliases = aliases ?? [] }; + protected override IGqlpSchemaDirective MakeAliased(string input, string[]? aliases = null, string description = "") + => new DirectiveDeclAst(AstNulls.At, input, description) { Aliases = aliases ?? [] }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeOptionsTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeOptionsTests.cs index 0e5f25de..f85bffef 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeOptionsTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeOptionsTests.cs @@ -43,6 +43,6 @@ public MergeOptionsTests(ITestOutputHelper outputHelper) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpSchemaOption MakeAliased(string name, string[]? aliases = null, string description = "") - => new OptionDeclAst(AstNulls.At, name, description) { Aliases = aliases ?? [] }; + protected override IGqlpSchemaOption MakeAliased(string input, string[]? aliases = null, string description = "") + => new OptionDeclAst(AstNulls.At, input, description) { Aliases = aliases ?? [] }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeDualFieldsTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeDualFieldsTests.cs index 64a4f380..2b48efc8 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeDualFieldsTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeDualFieldsTests.cs @@ -14,8 +14,8 @@ ITestOutputHelper outputHelper internal override AstObjectFieldsMerger MergerField => _merger; - protected override IGqlpDualField MakeAliased(string name, string[] aliases, string description = "") - => new DualFieldAst(AstNulls.At, name, description, new DualBaseAst(AstNulls.At, name, description)) { + protected override IGqlpDualField MakeAliased(string input, string[] aliases, string description = "") + => new DualFieldAst(AstNulls.At, input, description, new DualBaseAst(AstNulls.At, input, description)) { Aliases = aliases }; protected override IGqlpDualField MakeField(string name, string type, string fieldDescription = "", string typeDescription = "") diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputFieldsTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputFieldsTests.cs index c91187b2..556008c2 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputFieldsTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputFieldsTests.cs @@ -56,8 +56,8 @@ protected override IGqlpInputField MakeFieldModifiers(string name) => new InputFieldAst(AstNulls.At, name, new InputBaseAst(AstNulls.At, name)) { Modifiers = TestMods() }; - protected override IGqlpInputField MakeAliased(string name, string[] aliases, string description = "") - => new InputFieldAst(AstNulls.At, name, description, new InputBaseAst(AstNulls.At, name, description)) { + protected override IGqlpInputField MakeAliased(string input, string[] aliases, string description = "") + => new InputFieldAst(AstNulls.At, input, description, new InputBaseAst(AstNulls.At, input, description)) { Aliases = aliases }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputParametersTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputParametersTests.cs index 2e278c6a..7b20e0c0 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputParametersTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputParametersTests.cs @@ -45,8 +45,8 @@ public MergeInputParamsTests(ITestOutputHelper outputHelper) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpInputParam MakeDescribed(string name, string description = "") - => new InputParamAst(AstNulls.At, new InputBaseAst(AstNulls.At, name, description)); + protected override IGqlpInputParam MakeDescribed(string input, string description = "") + => new InputParamAst(AstNulls.At, new InputBaseAst(AstNulls.At, input, description)); private static InputParamAst MakeDefault(string name, string value) => new(AstNulls.At, new InputBaseAst(AstNulls.At, name)) { DefaultValue = new(value.FieldKey()) diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeOutputFieldsTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeOutputFieldsTests.cs index 17c1e130..508c3d19 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeOutputFieldsTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeOutputFieldsTests.cs @@ -126,8 +126,8 @@ protected override IGqlpOutputField MakeFieldModifiers(string name) => new OutputFieldAst(AstNulls.At, name, new OutputBaseAst(AstNulls.At, name)) { Modifiers = TestMods() }; - protected override IGqlpOutputField MakeAliased(string name, string[] aliases, string description = "") - => new OutputFieldAst(AstNulls.At, name, description, new OutputBaseAst(AstNulls.At, name, description)) { + protected override IGqlpOutputField MakeAliased(string input, string[] aliases, string description = "") + => new OutputFieldAst(AstNulls.At, input, description, new OutputBaseAst(AstNulls.At, input, description)) { Aliases = aliases }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeTypeParametersTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeTypeParametersTests.cs index ed14c556..07366209 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeTypeParametersTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeTypeParametersTests.cs @@ -23,6 +23,6 @@ public void Merge_ManyItems_ReturnsItem(string name) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpTypeParam MakeDescribed(string name, string description = "") - => new TypeParamAst(AstNulls.At, name, description); + protected override IGqlpTypeParam MakeDescribed(string input, string description = "") + => new TypeParamAst(AstNulls.At, input, description); } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/TestAlternatesMerger.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/TestAlternatesMerger.cs index 01c46fe4..7b94385c 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/TestAlternatesMerger.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/TestAlternatesMerger.cs @@ -30,8 +30,8 @@ public void Merge_TwoAstsSameModifers_ReturnsExpected(string input) internal abstract AstAlternatesMerger MergerAlternate { get; } internal override GroupsMerger MergerGroups => MergerAlternate; - protected override TObjAlt MakeDescribed(string name, string description = "") - => CheckAlternates.MakeAlternate(name, false, description); + protected override TObjAlt MakeDescribed(string input, string description = "") + => CheckAlternates.MakeAlternate(input, false, description); } internal abstract class CheckAlternatesMerger diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumMembersTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumMembersTests.cs index 264060bd..d9f15112 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumMembersTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumMembersTests.cs @@ -13,6 +13,6 @@ ITestOutputHelper outputHelper internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpEnumItem MakeAliased(string name, string[]? aliases = null, string description = "") - => new EnumMemberAst(AstNulls.At, name, description) { Aliases = aliases ?? [] }; + protected override IGqlpEnumItem MakeAliased(string input, string[]? aliases = null, string description = "") + => new EnumMemberAst(AstNulls.At, input, description) { Aliases = aliases ?? [] }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumsTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumsTests.cs index 96426b86..4416a6f3 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumsTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumsTests.cs @@ -21,7 +21,7 @@ public void CanMerge_TwoAstsValuesCantMerge_ReturnsErrors(string name, string[] [Theory, RepeatData(Repeats)] public void Merge_TwoAstsValues_ReturnsExpected(string name, string[] values1, string[] values2) { - EnumMemberAst[] combined = values1.EnumMembers().Concat(values2.EnumMembers()).ToArray(); + EnumMemberAst[] combined = [.. values1.EnumMembers(), .. values2.EnumMembers()]; Merge_Expected([ new EnumDeclAst(AstNulls.At, name, values1.EnumMembers()), diff --git a/test/GqlPlus.Parser.ClassTests/Merging/TestTyped.cs b/test/GqlPlus.Parser.ClassTests/Merging/TestTyped.cs index 6526e904..f7cd08cd 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/TestTyped.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/TestTyped.cs @@ -28,6 +28,6 @@ public void CanMerge_TwoAstsDifferentParents_ReturnsErrors(string name, string t protected abstract TType MakeTyped(string name, string[]? aliases = null, string description = "", TParent? parent = default); protected abstract TParent MakeParent(string parent); - protected override TType MakeAliased(string name, string[]? aliases = null, string description = "") - => MakeTyped(name, aliases, description); + protected override TType MakeAliased(string input, string[]? aliases = null, string description = "") + => MakeTyped(input, aliases, description); } diff --git a/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/BaseDomainTests.cs b/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/BaseDomainTests.cs index fe30f2e8..9d8fff7d 100644 --- a/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/BaseDomainTests.cs +++ b/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/BaseDomainTests.cs @@ -21,16 +21,15 @@ public void WithParentBad_ReturnsFalse(TInput input) => domainChecks.WithParentBad(input); } -internal abstract class BaseDomainChecks - : BaseAliasedChecks +internal abstract class BaseDomainChecks( + Parser.D parser, + DomainKind kind +) : BaseAliasedChecks(parser) , IBaseDomainChecks where TDomain : IGqlpDomain where TDomainAst : AstDomain, TDomain { - private readonly DomainKind _kind; - - protected BaseDomainChecks(Parser.D parser, DomainKind kind) - : base(parser) => _kind = kind; + private readonly DomainKind _kind = kind; public void WithKindBad(TInput input, string kind) => this. diff --git a/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/BaseSimpleTests.cs b/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/BaseSimpleTests.cs index 4a3dd8f1..60014249 100644 --- a/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/BaseSimpleTests.cs +++ b/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/BaseSimpleTests.cs @@ -26,7 +26,7 @@ Parser.D parser { public void WithParent(TInput input, string parent) // => TrueExpected(input.Type + "{:" + parent + " " + input.Member + "}", - => TrueExpected(ParentString(input, String.Empty, parent), + => TrueExpected(ParentString(input, string.Empty, parent), NamedFactory(input) with { Parent = parent, }); diff --git a/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/ParseEnumTests.cs b/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/ParseEnumTests.cs index a07b5784..855e8bdf 100644 --- a/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/ParseEnumTests.cs +++ b/test/GqlPlus.Parser.ComponentTests/Parsing/Schema/Simple/ParseEnumTests.cs @@ -33,12 +33,10 @@ public void WithAll_ReturnsCorrectAst(string name, string parent, string[] membe new EnumDeclAst(AstNulls.At, name, members.EnumMembers()) { Parent = parent }); } -internal sealed class ParseEnumChecks - : BaseSimpleChecks +internal sealed class ParseEnumChecks( + Parser.D parser +) : BaseSimpleChecks(parser) { - public ParseEnumChecks(Parser.D parser) - : base(parser) { } - protected internal override EnumDeclAst NamedFactory(EnumInput input) => new(AstNulls.At, input.Type, new[] { input.Member }.EnumMembers()); From ad0716853ce67be2fc6e63115ccd3f652461cce3 Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Tue, 14 Jan 2025 06:48:34 +1300 Subject: [PATCH 03/14] Add .Net 9.0 as target framework --- .github/workflows/dotnet-test.yml | 8 ++++---- Directory.Build.props | 2 +- GqlPlus.sln | 1 + test/GqlPlus.ComponentTestBase/OperationData.gen.cs | 1 - test/GqlPlus.ComponentTestBase/SampleData.gen.cs | 1 - test/GqlPlus.ComponentTestBase/SchemaData.gen.cs | 1 - .../Merging/Globals/MergeCategoriesTests.cs | 4 ++-- .../Merging/Globals/MergeDirectivesTests.cs | 4 ++-- .../Merging/Globals/MergeOptionsTests.cs | 4 ++-- .../Merging/Objects/MergeDualFieldsTests.cs | 4 ++-- .../Merging/Objects/MergeInputFieldsTests.cs | 4 ++-- .../Merging/Objects/MergeInputParametersTests.cs | 4 ++-- .../Merging/Objects/MergeOutputFieldsTests.cs | 4 ++-- .../Merging/Objects/MergeTypeParametersTests.cs | 4 ++-- .../Merging/Objects/TestAlternatesMerger.cs | 4 ++-- .../Merging/Simple/MergeEnumMembersTests.cs | 4 ++-- test/GqlPlus.Parser.ClassTests/Merging/TestTyped.cs | 4 ++-- 17 files changed, 28 insertions(+), 30 deletions(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 59bf6051..3a13d2b9 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -16,20 +16,20 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - dotnet-version: ["8.0.x"] + dotnet-version: ["8.0", "9.0"] steps: - uses: actions/checkout@v4 - name: Setup dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ matrix.dotnet-version }} + dotnet-version: ${{ matrix.dotnet-version }}.x - name: Install tools run: | dotnet tool restore --tool-manifest .config/dotnet-tools-ci.json - name: Install dependencies run: dotnet restore - name: Build - run: dotnet build + run: dotnet build -f net${{ matrix.dotnet-version }} - name: Tests with Coverage run: > dotnet coverage collect -o ${{ github.workspace }}/coverage/Coverage-${{ matrix.dotnet-version }}.xml -f cobertura -s coverage.runsettings @@ -81,7 +81,7 @@ jobs: path: coverage/ - name: Upload Pages artifact uses: actions/upload-pages-artifact@v3 - if: ${{ matrix.dotnet-version == '8.0.x' }} + if: ${{ matrix.dotnet-version == '8.0' }} with: path: test/Html diff --git a/Directory.Build.props b/Directory.Build.props index 78f965f7..d71a1e94 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@  - net8.0 + net8.0;net9.0 latest enable enable diff --git a/GqlPlus.sln b/GqlPlus.sln index 8c8167fe..6ba676e6 100644 --- a/GqlPlus.sln +++ b/GqlPlus.sln @@ -114,6 +114,7 @@ Global HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution + {B834B2ED-0D27-4281-8523-B706B42DCC15} = {4E1645F9-6194-4B1F-B93D-5B2CDDE5E6DE} {DDB8D682-23EA-48C4-A1AD-65F114533202} = {B834B2ED-0D27-4281-8523-B706B42DCC15} {D97ABCF2-E6C4-4384-AFB7-C55943EBE1E2} = {3B90AC37-1A6B-41AF-8490-E9D48E429ACD} {B73CDEC7-3F67-444E-8A06-16C20DF56DFB} = {3B90AC37-1A6B-41AF-8490-E9D48E429ACD} diff --git a/test/GqlPlus.ComponentTestBase/OperationData.gen.cs b/test/GqlPlus.ComponentTestBase/OperationData.gen.cs index 561e59ea..5370c246 100644 --- a/test/GqlPlus.ComponentTestBase/OperationData.gen.cs +++ b/test/GqlPlus.ComponentTestBase/OperationData.gen.cs @@ -1,7 +1,6 @@ // Generated from .\test\GqlPlus.ComponentTestBase\Samples\Operation // Collected from 5e5c83d (HEAD -> main, origin/main, origin/HEAD) 2024-09-24 Merge pull request #3 from graphql-plus/samples - namespace GqlPlus; public class OperationInvalidData diff --git a/test/GqlPlus.ComponentTestBase/SampleData.gen.cs b/test/GqlPlus.ComponentTestBase/SampleData.gen.cs index b3f52ded..009aa92b 100644 --- a/test/GqlPlus.ComponentTestBase/SampleData.gen.cs +++ b/test/GqlPlus.ComponentTestBase/SampleData.gen.cs @@ -1,7 +1,6 @@ // Generated from .\test\GqlPlus.ComponentTestBase\Samples // Collected from 5e5c83d (HEAD -> main, origin/main, origin/HEAD) 2024-09-24 Merge pull request #3 from graphql-plus/samples - namespace GqlPlus; public class SampleGraphQlData diff --git a/test/GqlPlus.ComponentTestBase/SchemaData.gen.cs b/test/GqlPlus.ComponentTestBase/SchemaData.gen.cs index 7ac271c5..25fad3b6 100644 --- a/test/GqlPlus.ComponentTestBase/SchemaData.gen.cs +++ b/test/GqlPlus.ComponentTestBase/SchemaData.gen.cs @@ -1,7 +1,6 @@ // Generated from .\test\GqlPlus.ComponentTestBase\Samples\Schema // Collected from 5e5c83d (HEAD -> main, origin/main, origin/HEAD) 2024-09-24 Merge pull request #3 from graphql-plus/samples - namespace GqlPlus; public class SchemaInvalidGlobalsData diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeCategoriesTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeCategoriesTests.cs index 8c8fc6db..ee553f6b 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeCategoriesTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeCategoriesTests.cs @@ -38,6 +38,6 @@ public void Merge_TwoAstsSameOutput_ReturnsExpected(string category) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpSchemaCategory MakeAliased(string input, string[]? aliases = null, string description = "") - => new CategoryDeclAst(AstNulls.At, input, description, input) { Aliases = aliases ?? [] }; + protected override IGqlpSchemaCategory MakeAliased(string name, string[]? aliases = null, string description = "") + => new CategoryDeclAst(AstNulls.At, name, description, name) { Aliases = aliases ?? [] }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeDirectivesTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeDirectivesTests.cs index 71cd7dc0..c83b8256 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeDirectivesTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeDirectivesTests.cs @@ -59,6 +59,6 @@ public MergeDirectivesTests(ITestOutputHelper outputHelper) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpSchemaDirective MakeAliased(string input, string[]? aliases = null, string description = "") - => new DirectiveDeclAst(AstNulls.At, input, description) { Aliases = aliases ?? [] }; + protected override IGqlpSchemaDirective MakeAliased(string name, string[]? aliases = null, string description = "") + => new DirectiveDeclAst(AstNulls.At, name, description) { Aliases = aliases ?? [] }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeOptionsTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeOptionsTests.cs index f85bffef..0e5f25de 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeOptionsTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Globals/MergeOptionsTests.cs @@ -43,6 +43,6 @@ public MergeOptionsTests(ITestOutputHelper outputHelper) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpSchemaOption MakeAliased(string input, string[]? aliases = null, string description = "") - => new OptionDeclAst(AstNulls.At, input, description) { Aliases = aliases ?? [] }; + protected override IGqlpSchemaOption MakeAliased(string name, string[]? aliases = null, string description = "") + => new OptionDeclAst(AstNulls.At, name, description) { Aliases = aliases ?? [] }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeDualFieldsTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeDualFieldsTests.cs index 2b48efc8..64a4f380 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeDualFieldsTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeDualFieldsTests.cs @@ -14,8 +14,8 @@ ITestOutputHelper outputHelper internal override AstObjectFieldsMerger MergerField => _merger; - protected override IGqlpDualField MakeAliased(string input, string[] aliases, string description = "") - => new DualFieldAst(AstNulls.At, input, description, new DualBaseAst(AstNulls.At, input, description)) { + protected override IGqlpDualField MakeAliased(string name, string[] aliases, string description = "") + => new DualFieldAst(AstNulls.At, name, description, new DualBaseAst(AstNulls.At, name, description)) { Aliases = aliases }; protected override IGqlpDualField MakeField(string name, string type, string fieldDescription = "", string typeDescription = "") diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputFieldsTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputFieldsTests.cs index 556008c2..c91187b2 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputFieldsTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputFieldsTests.cs @@ -56,8 +56,8 @@ protected override IGqlpInputField MakeFieldModifiers(string name) => new InputFieldAst(AstNulls.At, name, new InputBaseAst(AstNulls.At, name)) { Modifiers = TestMods() }; - protected override IGqlpInputField MakeAliased(string input, string[] aliases, string description = "") - => new InputFieldAst(AstNulls.At, input, description, new InputBaseAst(AstNulls.At, input, description)) { + protected override IGqlpInputField MakeAliased(string name, string[] aliases, string description = "") + => new InputFieldAst(AstNulls.At, name, description, new InputBaseAst(AstNulls.At, name, description)) { Aliases = aliases }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputParametersTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputParametersTests.cs index 7b20e0c0..2e278c6a 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputParametersTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeInputParametersTests.cs @@ -45,8 +45,8 @@ public MergeInputParamsTests(ITestOutputHelper outputHelper) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpInputParam MakeDescribed(string input, string description = "") - => new InputParamAst(AstNulls.At, new InputBaseAst(AstNulls.At, input, description)); + protected override IGqlpInputParam MakeDescribed(string name, string description = "") + => new InputParamAst(AstNulls.At, new InputBaseAst(AstNulls.At, name, description)); private static InputParamAst MakeDefault(string name, string value) => new(AstNulls.At, new InputBaseAst(AstNulls.At, name)) { DefaultValue = new(value.FieldKey()) diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeOutputFieldsTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeOutputFieldsTests.cs index 508c3d19..17c1e130 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeOutputFieldsTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeOutputFieldsTests.cs @@ -126,8 +126,8 @@ protected override IGqlpOutputField MakeFieldModifiers(string name) => new OutputFieldAst(AstNulls.At, name, new OutputBaseAst(AstNulls.At, name)) { Modifiers = TestMods() }; - protected override IGqlpOutputField MakeAliased(string input, string[] aliases, string description = "") - => new OutputFieldAst(AstNulls.At, input, description, new OutputBaseAst(AstNulls.At, input, description)) { + protected override IGqlpOutputField MakeAliased(string name, string[] aliases, string description = "") + => new OutputFieldAst(AstNulls.At, name, description, new OutputBaseAst(AstNulls.At, name, description)) { Aliases = aliases }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeTypeParametersTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeTypeParametersTests.cs index 07366209..ed14c556 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeTypeParametersTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/MergeTypeParametersTests.cs @@ -23,6 +23,6 @@ public void Merge_ManyItems_ReturnsItem(string name) internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpTypeParam MakeDescribed(string input, string description = "") - => new TypeParamAst(AstNulls.At, input, description); + protected override IGqlpTypeParam MakeDescribed(string name, string description = "") + => new TypeParamAst(AstNulls.At, name, description); } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Objects/TestAlternatesMerger.cs b/test/GqlPlus.Parser.ClassTests/Merging/Objects/TestAlternatesMerger.cs index 7b94385c..01c46fe4 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Objects/TestAlternatesMerger.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Objects/TestAlternatesMerger.cs @@ -30,8 +30,8 @@ public void Merge_TwoAstsSameModifers_ReturnsExpected(string input) internal abstract AstAlternatesMerger MergerAlternate { get; } internal override GroupsMerger MergerGroups => MergerAlternate; - protected override TObjAlt MakeDescribed(string input, string description = "") - => CheckAlternates.MakeAlternate(input, false, description); + protected override TObjAlt MakeDescribed(string name, string description = "") + => CheckAlternates.MakeAlternate(name, false, description); } internal abstract class CheckAlternatesMerger diff --git a/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumMembersTests.cs b/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumMembersTests.cs index d9f15112..264060bd 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumMembersTests.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/Simple/MergeEnumMembersTests.cs @@ -13,6 +13,6 @@ ITestOutputHelper outputHelper internal override GroupsMerger MergerGroups => _merger; - protected override IGqlpEnumItem MakeAliased(string input, string[]? aliases = null, string description = "") - => new EnumMemberAst(AstNulls.At, input, description) { Aliases = aliases ?? [] }; + protected override IGqlpEnumItem MakeAliased(string name, string[]? aliases = null, string description = "") + => new EnumMemberAst(AstNulls.At, name, description) { Aliases = aliases ?? [] }; } diff --git a/test/GqlPlus.Parser.ClassTests/Merging/TestTyped.cs b/test/GqlPlus.Parser.ClassTests/Merging/TestTyped.cs index f7cd08cd..6526e904 100644 --- a/test/GqlPlus.Parser.ClassTests/Merging/TestTyped.cs +++ b/test/GqlPlus.Parser.ClassTests/Merging/TestTyped.cs @@ -28,6 +28,6 @@ public void CanMerge_TwoAstsDifferentParents_ReturnsErrors(string name, string t protected abstract TType MakeTyped(string name, string[]? aliases = null, string description = "", TParent? parent = default); protected abstract TParent MakeParent(string parent); - protected override TType MakeAliased(string input, string[]? aliases = null, string description = "") - => MakeTyped(input, aliases, description); + protected override TType MakeAliased(string name, string[]? aliases = null, string description = "") + => MakeTyped(name, aliases, description); } From 3e4aae6724144ae82a5863c7575009e7bb2abef6 Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Tue, 14 Jan 2025 07:19:57 +1300 Subject: [PATCH 04/14] Restore target framework to .net8.0 --- Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.props b/Directory.Build.props index d71a1e94..78f965f7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@  - net8.0;net9.0 + net8.0 latest enable enable From bb3df1fc337aee2b2cae14bc32eb1fb6dfb52e6b Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Tue, 14 Jan 2025 07:22:26 +1300 Subject: [PATCH 05/14] Remove framework parameter from CI build --- .github/workflows/dotnet-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 3a13d2b9..303ae029 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -29,7 +29,7 @@ jobs: - name: Install dependencies run: dotnet restore - name: Build - run: dotnet build -f net${{ matrix.dotnet-version }} + run: dotnet build - name: Tests with Coverage run: > dotnet coverage collect -o ${{ github.workspace }}/coverage/Coverage-${{ matrix.dotnet-version }}.xml -f cobertura -s coverage.runsettings From da481bc1b5cce72cc878dfb087ed7067f8defbe0 Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Tue, 14 Jan 2025 07:51:12 +1300 Subject: [PATCH 06/14] Only use .net9.0 in CI --- .github/workflows/dotnet-test.yml | 2 +- Directory.Build.props | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 303ae029..fecf800f 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - dotnet-version: ["8.0", "9.0"] + dotnet-version: ["9.0"] steps: - uses: actions/checkout@v4 - name: Setup dotnet diff --git a/Directory.Build.props b/Directory.Build.props index 78f965f7..988b6665 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@  - net8.0 + net9.0;net8.0 latest enable enable From c435cf1c6416e3d269d60cb0f7636ca871c488ef Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Tue, 14 Jan 2025 09:27:14 +1300 Subject: [PATCH 07/14] Remove matrix --- .github/workflows/dotnet-test.yml | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index fecf800f..72df4b56 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -1,5 +1,8 @@ name: Dotnet Build and Test +env: + dotnet-version: 9.0 + on: - push - workflow_dispatch @@ -14,15 +17,14 @@ permissions: jobs: build: runs-on: ubuntu-latest - strategy: - matrix: - dotnet-version: ["9.0"] steps: - uses: actions/checkout@v4 - name: Setup dotnet uses: actions/setup-dotnet@v4 with: - dotnet-version: ${{ matrix.dotnet-version }}.x + dotnet-version: | + ${{ env.dotnet-version }}.x + 8.0.x - name: Install tools run: | dotnet tool restore --tool-manifest .config/dotnet-tools-ci.json @@ -32,13 +34,13 @@ jobs: run: dotnet build - name: Tests with Coverage run: > - dotnet coverage collect -o ${{ github.workspace }}/coverage/Coverage-${{ matrix.dotnet-version }}.xml -f cobertura -s coverage.runsettings - dotnet test --no-build --logger "trx;LogFileName=TestResults-${{ matrix.dotnet-version }}.trx" + dotnet coverage collect -o ${{ github.workspace }}/coverage/Coverage-${{ env.dotnet-version }}.xml -f cobertura -s coverage.runsettings + dotnet test --no-build --logger "trx;LogFileName=TestResults-${{ env.dotnet-version }}.trx" - name: Generate Coverage Report if: always() run: > dotnet reportgenerator - -reports:${{ github.workspace }}/coverage/Coverage-${{ matrix.dotnet-version }}.xml + -reports:${{ github.workspace }}/coverage/Coverage-${{ env.dotnet-version }}.xml -targetdir:"${{ github.workspace }}/coverage/" -reporttypes:'MarkdownSummaryGithub;Html' - name: Tests and Coverage Summary @@ -49,15 +51,15 @@ jobs: uses: dorny/test-reporter@v1 if: always() with: - name: DotNET Tests (${{ matrix.dotnet-version }}) - path: "**/TestResults-${{ matrix.dotnet-version }}.trx" + name: DotNET Tests (${{ env.dotnet-version }}) + path: "**/TestResults-${{ env.dotnet-version }}.trx" reporter: dotnet-trx - name: Coverage Report uses: LouisBrunner/checks-action@v2.0.0 if: always() with: token: ${{ secrets.GITHUB_TOKEN }} - name: DotNET Coverage (${{ matrix.dotnet-version }}) + name: DotNET Coverage (${{ env.dotnet-version }}) conclusion: success output: '{"summary":"${{ steps.coverage.outputs.coverage_badge }}"}' output_text_description_file: coverage/SummaryGithub.md @@ -71,17 +73,16 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: tests-${{ matrix.dotnet-version }} - path: "**/TestResults-${{ matrix.dotnet-version }}.trx" + name: tests-${{ env.dotnet-version }} + path: "**/TestResults-${{ env.dotnet-version }}.trx" - name: Upload Coverage artifact uses: actions/upload-artifact@v4 if: always() with: - name: coverage-${{ matrix.dotnet-version }} + name: coverage-${{ env.dotnet-version }} path: coverage/ - name: Upload Pages artifact uses: actions/upload-pages-artifact@v3 - if: ${{ matrix.dotnet-version == '8.0' }} with: path: test/Html From 6737c295215ded8d4ad07a40e7236b3b63cfd82b Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Wed, 15 Jan 2025 13:12:33 +1300 Subject: [PATCH 08/14] Update packages to latest patch version --- src/GqlPlus.Abstractions/GqlPlus.Abstractions.csproj | 2 +- src/GqlPlus.Parser/GqlPlus.Parser.csproj | 2 +- test/Directory.Build.targets | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/GqlPlus.Abstractions/GqlPlus.Abstractions.csproj b/src/GqlPlus.Abstractions/GqlPlus.Abstractions.csproj index 51882ec7..b538b424 100644 --- a/src/GqlPlus.Abstractions/GqlPlus.Abstractions.csproj +++ b/src/GqlPlus.Abstractions/GqlPlus.Abstractions.csproj @@ -1,5 +1,5 @@  - + diff --git a/src/GqlPlus.Parser/GqlPlus.Parser.csproj b/src/GqlPlus.Parser/GqlPlus.Parser.csproj index 1a86711b..d65bcf03 100644 --- a/src/GqlPlus.Parser/GqlPlus.Parser.csproj +++ b/src/GqlPlus.Parser/GqlPlus.Parser.csproj @@ -1,6 +1,6 @@  - + diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets index 733d1dab..9f97ebbe 100644 --- a/test/Directory.Build.targets +++ b/test/Directory.Build.targets @@ -5,7 +5,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 9a90d62aaf79902ce6a52e7ebcba8c29e037d52b Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Sat, 8 Feb 2025 10:03:11 +1300 Subject: [PATCH 09/14] Upgrade packages to latest minor version --- .../GqlPlus.ComponentTestBase.csproj | 6 +++--- test/GqlPlus.ComponentTestBase/SchemaDataBase.cs | 2 -- test/GqlPlus.TestBase/GqlPlus.TestBase.csproj | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/test/GqlPlus.ComponentTestBase/GqlPlus.ComponentTestBase.csproj b/test/GqlPlus.ComponentTestBase/GqlPlus.ComponentTestBase.csproj index b9477827..132299d6 100644 --- a/test/GqlPlus.ComponentTestBase/GqlPlus.ComponentTestBase.csproj +++ b/test/GqlPlus.ComponentTestBase/GqlPlus.ComponentTestBase.csproj @@ -13,10 +13,10 @@ - + - - + + diff --git a/test/GqlPlus.ComponentTestBase/SchemaDataBase.cs b/test/GqlPlus.ComponentTestBase/SchemaDataBase.cs index 52b79674..f8bd0528 100644 --- a/test/GqlPlus.ComponentTestBase/SchemaDataBase.cs +++ b/test/GqlPlus.ComponentTestBase/SchemaDataBase.cs @@ -4,8 +4,6 @@ using GqlPlus.Result; using GqlPlus.Token; -using Grpc.Core; - namespace GqlPlus; public class SchemaDataBase( diff --git a/test/GqlPlus.TestBase/GqlPlus.TestBase.csproj b/test/GqlPlus.TestBase/GqlPlus.TestBase.csproj index 8090d30f..a52bfc06 100644 --- a/test/GqlPlus.TestBase/GqlPlus.TestBase.csproj +++ b/test/GqlPlus.TestBase/GqlPlus.TestBase.csproj @@ -6,9 +6,9 @@ - - - + + + From ed0e08238971a36278e99de5caa853ed519b2ef5 Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Sat, 8 Feb 2025 11:52:32 +1300 Subject: [PATCH 10/14] Run tests for both versions --- .github/workflows/dotnet-test.yml | 52 ++++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 72df4b56..64670b14 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -1,8 +1,5 @@ name: Dotnet Build and Test -env: - dotnet-version: 9.0 - on: - push - workflow_dispatch @@ -23,7 +20,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - ${{ env.dotnet-version }}.x + 8.0.x 8.0.x - name: Install tools run: | @@ -32,15 +29,41 @@ jobs: run: dotnet restore - name: Build run: dotnet build + - name: Artifacts + uses: actions/upload-artifact@v4 + with: + name: build + path: . + + tests: + runs-on: ubuntu-latest + strategy: + matrix: + version: + - 8.0 + - 9.0 + steps: + - name: Setup dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + ${{ matrix.version }}.x + - name: Download a single artifact + uses: actions/download-artifact@v4 + with: + name: build + - name: Install tools + run: | + dotnet tool restore --tool-manifest .config/dotnet-tools-ci.json - name: Tests with Coverage run: > - dotnet coverage collect -o ${{ github.workspace }}/coverage/Coverage-${{ env.dotnet-version }}.xml -f cobertura -s coverage.runsettings - dotnet test --no-build --logger "trx;LogFileName=TestResults-${{ env.dotnet-version }}.trx" + dotnet coverage collect -o ${{ github.workspace }}/coverage/Coverage-${{ matrix.version }}.xml -f cobertura -s coverage.runsettings + dotnet test --no-build --logger "trx;LogFileName=TestResults-${{ matrix.version }}.trx" -f ${{ matrix.version }} - name: Generate Coverage Report if: always() run: > dotnet reportgenerator - -reports:${{ github.workspace }}/coverage/Coverage-${{ env.dotnet-version }}.xml + -reports:${{ github.workspace }}/coverage/Coverage-${{ matrix.version }}.xml -targetdir:"${{ github.workspace }}/coverage/" -reporttypes:'MarkdownSummaryGithub;Html' - name: Tests and Coverage Summary @@ -51,15 +74,15 @@ jobs: uses: dorny/test-reporter@v1 if: always() with: - name: DotNET Tests (${{ env.dotnet-version }}) - path: "**/TestResults-${{ env.dotnet-version }}.trx" + name: DotNET Tests (${{ matrix.version }}) + path: "**/TestResults-${{ matrix.version }}.trx" reporter: dotnet-trx - name: Coverage Report uses: LouisBrunner/checks-action@v2.0.0 if: always() with: token: ${{ secrets.GITHUB_TOKEN }} - name: DotNET Coverage (${{ env.dotnet-version }}) + name: DotNET Coverage (${{ matrix.version }}) conclusion: success output: '{"summary":"${{ steps.coverage.outputs.coverage_badge }}"}' output_text_description_file: coverage/SummaryGithub.md @@ -73,15 +96,16 @@ jobs: uses: actions/upload-artifact@v4 if: always() with: - name: tests-${{ env.dotnet-version }} - path: "**/TestResults-${{ env.dotnet-version }}.trx" + name: tests-${{ matrix.version }} + path: "**/TestResults-${{ matrix.version }}.trx" - name: Upload Coverage artifact uses: actions/upload-artifact@v4 if: always() with: - name: coverage-${{ env.dotnet-version }} + name: coverage-${{ matrix.version }} path: coverage/ - name: Upload Pages artifact + if: matrix.version == 9.0 uses: actions/upload-pages-artifact@v3 with: path: test/Html @@ -92,7 +116,7 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest - needs: build + needs: tests steps: - name: Deploy to GitHub Pages id: deployment From 5373f5ae9b7367de6c863cbd2c354040cf6d45a5 Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Sat, 8 Feb 2025 11:53:38 +1300 Subject: [PATCH 11/14] tests need build --- .github/workflows/dotnet-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 64670b14..c30227bd 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -37,6 +37,7 @@ jobs: tests: runs-on: ubuntu-latest + needs: build strategy: matrix: version: From 1d36b4c52ee1bd327e2f15c7ecf7f2d3eca14d6a Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Sat, 8 Feb 2025 11:55:24 +1300 Subject: [PATCH 12/14] Correct setup dotnet for build --- .github/workflows/dotnet-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index c30227bd..15ff6523 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -20,7 +20,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 8.0.x + 9.0.x 8.0.x - name: Install tools run: | From 606ed94c78afda246c02b51ea321dd35838410dd Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Sat, 8 Feb 2025 12:05:09 +1300 Subject: [PATCH 13/14] Improve step names and only have src and test in build artifact --- .github/workflows/dotnet-test.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 15ff6523..373c2562 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -16,24 +16,22 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Setup dotnet - uses: actions/setup-dotnet@v4 + - uses: actions/setup-dotnet@v4 with: dotnet-version: | 9.0.x 8.0.x - - name: Install tools - run: | - dotnet tool restore --tool-manifest .config/dotnet-tools-ci.json - name: Install dependencies run: dotnet restore - name: Build run: dotnet build - - name: Artifacts - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v4 with: name: build - path: . + path: | + src + test + retention-days: 1 tests: runs-on: ubuntu-latest @@ -44,13 +42,11 @@ jobs: - 8.0 - 9.0 steps: - - name: Setup dotnet - uses: actions/setup-dotnet@v4 + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 with: - dotnet-version: | - ${{ matrix.version }}.x - - name: Download a single artifact - uses: actions/download-artifact@v4 + dotnet-version: ${{ matrix.version }}.x + - uses: actions/download-artifact@v4 with: name: build - name: Install tools From fc1597f854117f9a1ed501ae0b09a22a818ef4db Mon Sep 17 00:00:00 2001 From: Struan Judd Date: Sat, 8 Feb 2025 12:13:16 +1300 Subject: [PATCH 14/14] Correct framework use in tests --- .github/workflows/dotnet-test.yml | 12 ++++++------ coverage.ps1 | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dotnet-test.yml b/.github/workflows/dotnet-test.yml index 373c2562..f6f7fdf1 100644 --- a/.github/workflows/dotnet-test.yml +++ b/.github/workflows/dotnet-test.yml @@ -32,15 +32,15 @@ jobs: src test retention-days: 1 - + tests: runs-on: ubuntu-latest needs: build strategy: matrix: - version: - - 8.0 - - 9.0 + version: + - "8.0" + - "9.0" steps: - uses: actions/checkout@v4 - uses: actions/setup-dotnet@v4 @@ -55,7 +55,7 @@ jobs: - name: Tests with Coverage run: > dotnet coverage collect -o ${{ github.workspace }}/coverage/Coverage-${{ matrix.version }}.xml -f cobertura -s coverage.runsettings - dotnet test --no-build --logger "trx;LogFileName=TestResults-${{ matrix.version }}.trx" -f ${{ matrix.version }} + dotnet test --no-build --logger "trx;LogFileName=TestResults-${{ matrix.version }}.trx" --framework "net${{ matrix.version }}" - name: Generate Coverage Report if: always() run: > @@ -102,7 +102,7 @@ jobs: name: coverage-${{ matrix.version }} path: coverage/ - name: Upload Pages artifact - if: matrix.version == 9.0 + if: matrix.version == '9.0' uses: actions/upload-pages-artifact@v3 with: path: test/Html diff --git a/coverage.ps1 b/coverage.ps1 index fe0ca435..ae91069c 100644 --- a/coverage.ps1 +++ b/coverage.ps1 @@ -5,7 +5,7 @@ param ( $coverageFile = "$PWD/coverage/Coverage.xml" $collect = "collect","-o",$coverageFile,"-f","cobertura","-s","coverage.runsettings" -$test = "test","--no-build","--logger:trx;LogFileName=TestResults.trx" +$test = "test","--no-build","--logger:trx;LogFileName=TestResults.trx","--framework","net9.0" if ($Section) { $test = $test + @("--filter", "FullyQualifiedName~.$Section.")