diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index dd2d063..fbe943e 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -3,22 +3,25 @@
"isRoot": true,
"tools": {
"cake.tool": {
- "version": "2.0.0",
+ "version": "6.1.0",
"commands": [
"dotnet-cake"
- ]
+ ],
+ "rollForward": false
},
"gitversion.tool": {
- "version": "5.8.1",
+ "version": "6.6.2",
"commands": [
"dotnet-gitversion"
- ]
+ ],
+ "rollForward": false
},
"gitissue.tool": {
"version": "0.1.1-alpha-01",
"commands": [
"gitissue"
- ]
+ ],
+ "rollForward": false
}
}
}
\ No newline at end of file
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8db8769..01d6450 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -5,7 +5,7 @@ on:
branches:
- main
pull_request:
- branches:
+ branches:
- '**'
jobs:
@@ -13,17 +13,17 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
- os: [windows-latest, ubuntu-18.04]
+ os: [windows-latest, ubuntu-latest]
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
with:
clean: true
fetch-depth: 0
- - name: Setup
- uses: actions/setup-dotnet@v1
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
with:
- dotnet-version: '6.0.x'
+ dotnet-version: '10.0.x'
- name: Build
uses: cake-build/cake-action@v1
with:
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index e160aa7..e1f2e85 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -8,14 +8,14 @@ jobs:
runs-on: windows-latest
steps:
- name: Checkout
- uses: actions/checkout@v2
+ uses: actions/checkout@v4
with:
clean: true
fetch-depth: 0
- - name: Setup
- uses: actions/setup-dotnet@v1
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v4
with:
- dotnet-version: '6.0.x'
+ dotnet-version: '10.0.x'
- name: Push
uses: cake-build/cake-action@v1
with:
diff --git a/GitVersion.yaml b/GitVersion.yaml
new file mode 100644
index 0000000..71fc986
--- /dev/null
+++ b/GitVersion.yaml
@@ -0,0 +1,5 @@
+workflow: GitFlow/v1
+next-version: 0.2.0
+branches:
+ main:
+ label: beta
diff --git a/README.md b/README.md
index 37e6dbe..67f950d 100644
--- a/README.md
+++ b/README.md
@@ -51,7 +51,7 @@ git issue help
# Compatibility
-This project runs on .NET 5 and is compatible with both Windows and Linux.
+This project runs on .NET 10 and is compatible with both Windows and Linux.
## Configuration
diff --git a/build.cake b/build.cake
index d54940a..48ab7cc 100644
--- a/build.cake
+++ b/build.cake
@@ -35,8 +35,8 @@ Task("Publish")
{
DotNetPublish("src/GitIssue.Tool/GitIssue.Tool.csproj", new DotNetPublishSettings
{
- Framework = "net6.0",
- Runtime = "win10-x64",
+ Framework = "net10.0",
+ Runtime = "win-x64",
PublishReadyToRun = false,
PublishTrimmed = false,
SelfContained = true,
diff --git a/src/.editorconfig b/src/.editorconfig
index 4b3a5d7..dccd6ed 100644
--- a/src/.editorconfig
+++ b/src/.editorconfig
@@ -1,5 +1,5 @@
-# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
+# Remove the line below if you want to inherit .editorconfig settings from higher directories
# C# files
[*.cs]
@@ -12,7 +12,6 @@ indent_style = space
tab_width = 4
# New line preferences
-end_of_line = crlf
insert_final_newline = false
#### .NET Coding Conventions ####
@@ -20,26 +19,26 @@ insert_final_newline = false
# Organize usings
dotnet_separate_import_directive_groups = false
dotnet_sort_system_directives_first = true
-file_header_template = unset
+file_header_template =
# this. and Me. preferences
-dotnet_style_qualification_for_event = false
-dotnet_style_qualification_for_field = false
-dotnet_style_qualification_for_method = false
-dotnet_style_qualification_for_property = false
+dotnet_style_qualification_for_event = true:warning
+dotnet_style_qualification_for_field = true:warning
+dotnet_style_qualification_for_method = true:warning
+dotnet_style_qualification_for_property = true:warning
# Language keywords vs BCL types preferences
-dotnet_style_predefined_type_for_locals_parameters_members = true
-dotnet_style_predefined_type_for_member_access = true
+dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
+dotnet_style_predefined_type_for_member_access = true:suggestion
# Parentheses preferences
-dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
-dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
+dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
-dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
+dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion
# Modifier preferences
-dotnet_style_require_accessibility_modifiers = for_non_interface_members
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
# Expression-level preferences
dotnet_style_coalesce_expression = true
@@ -70,9 +69,9 @@ dotnet_remove_unnecessary_suppression_exclusions = none
#### C# Coding Conventions ####
# var preferences
-csharp_style_var_elsewhere = false
-csharp_style_var_for_built_in_types = false
-csharp_style_var_when_type_is_apparent = true
+csharp_style_var_elsewhere = false:suggestion
+csharp_style_var_for_built_in_types = false:suggestion
+csharp_style_var_when_type_is_apparent = false:suggestion
# Expression-bodied members
csharp_style_expression_bodied_accessors = true
@@ -96,10 +95,9 @@ csharp_style_conditional_delegate_call = true
# Modifier preferences
csharp_prefer_static_local_function = true
-csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
+csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion
# Code-block preferences
-csharp_prefer_braces = true
csharp_prefer_simple_using_statement = true
# Expression-level preferences
@@ -115,7 +113,6 @@ csharp_style_unused_value_assignment_preference = discard_variable
csharp_style_unused_value_expression_statement_preference = discard_variable
# 'using' directive preferences
-csharp_using_directive_placement = outside_namespace
#### C# Formatting Rules ####
@@ -124,7 +121,7 @@ csharp_new_line_before_catch = true
csharp_new_line_before_else = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_anonymous_types = true
-csharp_new_line_before_members_in_object_initializers = true
+csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_open_brace = all
csharp_new_line_between_query_expression_clauses = true
@@ -205,3 +202,322 @@ dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case
+
+# Microsoft .NET properties
+csharp_style_namespace_declarations = block_scoped:warning
+csharp_style_prefer_utf8_string_literals = true:suggestion
+dotnet_naming_rule.private_constants_rule.import_to_resharper = True
+dotnet_naming_rule.private_constants_rule.resharper_description = Constant fields (private)
+dotnet_naming_rule.private_constants_rule.resharper_guid = 236f7aa5-7b06-43ca-bf2a-9b31bfcff09a
+dotnet_naming_rule.private_constants_rule.severity = warning
+dotnet_naming_rule.private_constants_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
+dotnet_naming_rule.private_instance_fields_rule.import_to_resharper = True
+dotnet_naming_rule.private_instance_fields_rule.resharper_description = Instance fields (private)
+dotnet_naming_rule.private_instance_fields_rule.resharper_guid = 4a98fdf6-7d98-4f5a-afeb-ea44ad98c70c
+dotnet_naming_rule.private_instance_fields_rule.severity = warning
+dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols
+dotnet_naming_rule.private_methods_override_rule.import_to_resharper = False
+dotnet_naming_rule.private_methods_override_rule.severity = warning
+dotnet_naming_rule.private_methods_override_rule.style = pascal_case
+dotnet_naming_rule.private_methods_override_rule.symbols = private_methods_override_symbols
+dotnet_naming_rule.private_methods_rule.import_to_resharper = True
+dotnet_naming_rule.private_methods_rule.resharper_description = Private methods
+dotnet_naming_rule.private_methods_rule.resharper_guid = 9fd73c3c-2baa-4abe-b19a-924d8ec71ca4
+dotnet_naming_rule.private_methods_rule.severity = warning
+dotnet_naming_rule.private_methods_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_methods_rule.symbols = private_methods_symbols
+dotnet_naming_rule.private_static_fields_rule.import_to_resharper = True
+dotnet_naming_rule.private_static_fields_rule.resharper_description = Static fields (private)
+dotnet_naming_rule.private_static_fields_rule.resharper_guid = f9fce829-e6f4-4cb2-80f1-5497c44f51df
+dotnet_naming_rule.private_static_fields_rule.severity = warning
+dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
+dotnet_naming_rule.private_static_readonly_rule.import_to_resharper = True
+dotnet_naming_rule.private_static_readonly_rule.resharper_description = Static readonly fields (private)
+dotnet_naming_rule.private_static_readonly_rule.resharper_guid = 15b5b1f1-457c-4ca6-b278-5615aedc07d3
+dotnet_naming_rule.private_static_readonly_rule.severity = warning
+dotnet_naming_rule.private_static_readonly_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
+dotnet_naming_rule.private_static_rule.import_to_resharper = True
+dotnet_naming_rule.private_static_rule.resharper_description = Private static
+dotnet_naming_rule.private_static_rule.resharper_guid = 1fa21c09-c5d8-42d5-82ba-9f245a59f967
+dotnet_naming_rule.private_static_rule.severity = warning
+dotnet_naming_rule.private_static_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_static_rule.symbols = private_static_symbols
+dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True
+dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field
+dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
+dotnet_naming_rule.unity_serialized_field_rule.severity = warning
+dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style
+dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols
+dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
+dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
+dotnet_naming_symbols.private_constants_symbols.resharper_applicable_kinds = constant_field
+dotnet_naming_symbols.private_constants_symbols.resharper_required_modifiers = any
+dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_instance_fields_symbols.resharper_applicable_kinds = field,readonly_field
+dotnet_naming_symbols.private_instance_fields_symbols.resharper_required_modifiers = instance
+dotnet_naming_symbols.private_methods_override_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_methods_override_symbols.applicable_kinds = class
+dotnet_naming_symbols.private_methods_override_symbols.required_modifiers = static
+dotnet_naming_symbols.private_methods_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_methods_symbols.applicable_kinds = class,field,method
+dotnet_naming_symbols.private_methods_symbols.resharper_applicable_kinds = async_method,field,readonly_field,class,method
+dotnet_naming_symbols.private_methods_symbols.resharper_required_modifiers = instance
+dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
+dotnet_naming_symbols.private_static_fields_symbols.resharper_applicable_kinds = field
+dotnet_naming_symbols.private_static_fields_symbols.resharper_required_modifiers = static
+dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = readonly,static
+dotnet_naming_symbols.private_static_readonly_symbols.resharper_applicable_kinds = readonly_field
+dotnet_naming_symbols.private_static_readonly_symbols.resharper_required_modifiers = static
+dotnet_naming_symbols.private_static_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_symbols.applicable_kinds = method
+dotnet_naming_symbols.private_static_symbols.required_modifiers = static
+dotnet_naming_symbols.private_static_symbols.resharper_applicable_kinds = method
+dotnet_naming_symbols.private_static_symbols.resharper_required_modifiers = static
+dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
+dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
+dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
+dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
+
+# ReSharper properties
+resharper_align_multiline_binary_expressions_chain = false
+resharper_align_multiple_declaration = true
+resharper_braces_for_for = required
+resharper_braces_for_foreach = required
+resharper_braces_for_ifelse = required
+resharper_braces_for_while = required
+resharper_cpp_insert_final_newline = true
+resharper_csharp_brace_style = next_line
+resharper_csharp_keep_blank_lines_in_code = 3
+resharper_csharp_keep_blank_lines_in_declarations = 3
+resharper_csharp_keep_existing_enum_arrangement = false
+resharper_csharp_max_line_length = 320
+resharper_csharp_use_indent_from_vs = false
+resharper_csharp_wrap_before_first_type_parameter_constraint = true
+resharper_default_value_when_type_not_evident = default_expression
+resharper_keep_existing_declaration_block_arrangement = false
+resharper_new_line_before_while = true
+resharper_object_creation_when_type_evident = explicitly_typed
+resharper_parentheses_non_obvious_operations = none, shift, relational, equality, bitwise_and, bitwise_exclusive_or, bitwise_inclusive_or, bitwise, conditional_and, conditional_or, conditional
+resharper_place_accessorholder_attribute_on_same_line = false
+resharper_place_field_attribute_on_same_line = if_owner_is_single_line
+resharper_place_simple_embedded_statement_on_same_line = false
+resharper_static_members_qualify_members = none, field, property, event, method
+resharper_trailing_comma_in_multiline_lists = true
+resharper_use_heuristics_for_body_style = true
+resharper_wrap_chained_binary_expressions = chop_if_long
+resharper_xmldoc_attribute_indent = align_by_first_attribute
+resharper_xmldoc_linebreaks_inside_tags_for_elements_longer_than = 80
+resharper_xmldoc_max_blank_lines_between_tags = 1
+resharper_xmldoc_max_line_length = 160
+resharper_xml_attribute_indent = single_indent
+resharper_xml_attribute_style = on_different_lines
+resharper_xml_max_line_length = 320
+resharper_xml_pi_attributes_indent = single_indent
+resharper_xml_use_indent_from_vs = false
+
+# ReSharper inspection severities
+resharper_arrange_attributes_highlighting = suggestion
+resharper_arrange_default_value_when_type_not_evident_highlighting = suggestion
+resharper_arrange_method_or_operator_body_highlighting = suggestion
+resharper_arrange_object_creation_when_type_not_evident_highlighting = suggestion
+resharper_arrange_static_member_qualifier_highlighting = warning
+resharper_arrange_trailing_comma_in_multiline_lists_highlighting = suggestion
+resharper_arrange_trailing_comma_in_singleline_lists_highlighting = suggestion
+resharper_arrange_type_member_modifiers_highlighting = hint
+resharper_arrange_type_modifiers_highlighting = hint
+resharper_built_in_type_reference_style_for_member_access_highlighting = hint
+resharper_built_in_type_reference_style_highlighting = hint
+resharper_cpp_enforce_nested_namespaces_style_highlighting = suggestion
+resharper_enforce_do_while_statement_braces_highlighting = suggestion
+resharper_enforce_fixed_statement_braces_highlighting = suggestion
+resharper_enforce_foreach_statement_braces_highlighting = suggestion
+resharper_enforce_for_statement_braces_highlighting = suggestion
+resharper_enforce_if_statement_braces_highlighting = suggestion
+resharper_enforce_lock_statement_braces_highlighting = suggestion
+resharper_enforce_using_statement_braces_highlighting = suggestion
+resharper_enforce_while_statement_braces_highlighting = suggestion
+resharper_redundant_bool_compare_highlighting = none
+resharper_suggest_discard_declaration_var_style_highlighting = suggestion
+resharper_suggest_var_or_type_elsewhere_highlighting = warning
+
+[*.cql]
+indent_style = tab
+indent_size = tab
+tab_width = 4
+
+# Microsoft .NET properties
+csharp_new_line_before_members_in_object_initializers = false
+csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion
+csharp_style_namespace_declarations = block_scoped:warning
+csharp_style_prefer_utf8_string_literals = true:suggestion
+csharp_style_var_elsewhere = false:suggestion
+csharp_style_var_for_built_in_types = false:suggestion
+csharp_style_var_when_type_is_apparent = false:suggestion
+dotnet_naming_rule.private_constants_rule.import_to_resharper = True
+dotnet_naming_rule.private_constants_rule.resharper_description = Constant fields (private)
+dotnet_naming_rule.private_constants_rule.resharper_guid = 236f7aa5-7b06-43ca-bf2a-9b31bfcff09a
+dotnet_naming_rule.private_constants_rule.severity = warning
+dotnet_naming_rule.private_constants_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
+dotnet_naming_rule.private_instance_fields_rule.import_to_resharper = True
+dotnet_naming_rule.private_instance_fields_rule.resharper_description = Instance fields (private)
+dotnet_naming_rule.private_instance_fields_rule.resharper_guid = 4a98fdf6-7d98-4f5a-afeb-ea44ad98c70c
+dotnet_naming_rule.private_instance_fields_rule.severity = warning
+dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols
+dotnet_naming_rule.private_methods_override_rule.import_to_resharper = False
+dotnet_naming_rule.private_methods_override_rule.severity = warning
+dotnet_naming_rule.private_methods_override_rule.style = upper_camel_case_style
+dotnet_naming_rule.private_methods_override_rule.symbols = private_methods_override_symbols
+dotnet_naming_rule.private_methods_rule.import_to_resharper = True
+dotnet_naming_rule.private_methods_rule.resharper_description = Private methods
+dotnet_naming_rule.private_methods_rule.resharper_guid = 9fd73c3c-2baa-4abe-b19a-924d8ec71ca4
+dotnet_naming_rule.private_methods_rule.severity = warning
+dotnet_naming_rule.private_methods_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_methods_rule.symbols = private_methods_symbols
+dotnet_naming_rule.private_static_fields_rule.import_to_resharper = True
+dotnet_naming_rule.private_static_fields_rule.resharper_description = Static fields (private)
+dotnet_naming_rule.private_static_fields_rule.resharper_guid = f9fce829-e6f4-4cb2-80f1-5497c44f51df
+dotnet_naming_rule.private_static_fields_rule.severity = warning
+dotnet_naming_rule.private_static_fields_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
+dotnet_naming_rule.private_static_readonly_rule.import_to_resharper = True
+dotnet_naming_rule.private_static_readonly_rule.resharper_description = Static readonly fields (private)
+dotnet_naming_rule.private_static_readonly_rule.resharper_guid = 15b5b1f1-457c-4ca6-b278-5615aedc07d3
+dotnet_naming_rule.private_static_readonly_rule.severity = warning
+dotnet_naming_rule.private_static_readonly_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
+dotnet_naming_rule.private_static_rule.import_to_resharper = True
+dotnet_naming_rule.private_static_rule.resharper_description = Private static
+dotnet_naming_rule.private_static_rule.resharper_guid = 1fa21c09-c5d8-42d5-82ba-9f245a59f967
+dotnet_naming_rule.private_static_rule.severity = warning
+dotnet_naming_rule.private_static_rule.style = lower_camel_case_style
+dotnet_naming_rule.private_static_rule.symbols = private_static_symbols
+dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True
+dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field
+dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
+dotnet_naming_rule.unity_serialized_field_rule.severity = warning
+dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style
+dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols
+dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
+dotnet_naming_style.upper_camel_case_style.capitalization = pascal_case
+dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
+dotnet_naming_symbols.private_constants_symbols.resharper_applicable_kinds = constant_field
+dotnet_naming_symbols.private_constants_symbols.resharper_required_modifiers = any
+dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_instance_fields_symbols.resharper_applicable_kinds = field,readonly_field
+dotnet_naming_symbols.private_instance_fields_symbols.resharper_required_modifiers = instance
+dotnet_naming_symbols.private_methods_override_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_methods_override_symbols.applicable_kinds = class
+dotnet_naming_symbols.private_methods_override_symbols.required_modifiers = static
+dotnet_naming_symbols.private_methods_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_methods_symbols.applicable_kinds = class,field,method
+dotnet_naming_symbols.private_methods_symbols.resharper_applicable_kinds = async_method,field,readonly_field,class,method
+dotnet_naming_symbols.private_methods_symbols.resharper_required_modifiers = instance
+dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
+dotnet_naming_symbols.private_static_fields_symbols.resharper_applicable_kinds = field
+dotnet_naming_symbols.private_static_fields_symbols.resharper_required_modifiers = static
+dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
+dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = readonly,static
+dotnet_naming_symbols.private_static_readonly_symbols.resharper_applicable_kinds = readonly_field
+dotnet_naming_symbols.private_static_readonly_symbols.resharper_required_modifiers = static
+dotnet_naming_symbols.private_static_symbols.applicable_accessibilities = private
+dotnet_naming_symbols.private_static_symbols.applicable_kinds = method
+dotnet_naming_symbols.private_static_symbols.required_modifiers = static
+dotnet_naming_symbols.private_static_symbols.resharper_applicable_kinds = method
+dotnet_naming_symbols.private_static_symbols.resharper_required_modifiers = static
+dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = *
+dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
+dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
+dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
+dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:suggestion
+dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:suggestion
+dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:suggestion
+dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
+dotnet_style_predefined_type_for_member_access = true:suggestion
+dotnet_style_qualification_for_event = true:warning
+dotnet_style_qualification_for_field = true:warning
+dotnet_style_qualification_for_method = true:warning
+dotnet_style_qualification_for_property = true:warning
+dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
+
+# ReSharper properties
+resharper_align_multiline_binary_expressions_chain = false
+resharper_align_multiple_declaration = true
+resharper_braces_for_for = required
+resharper_braces_for_foreach = required
+resharper_braces_for_ifelse = required
+resharper_braces_for_while = required
+resharper_csharp_keep_blank_lines_in_code = 3
+resharper_csharp_keep_blank_lines_in_declarations = 3
+resharper_csharp_max_line_length = 320
+resharper_csharp_use_indent_from_vs = false
+resharper_csharp_wrap_before_first_type_parameter_constraint = true
+resharper_default_value_when_type_not_evident = default_expression
+resharper_keep_existing_embedded_block_arrangement = true
+resharper_new_line_before_while = true
+resharper_object_creation_when_type_evident = explicitly_typed
+resharper_parentheses_non_obvious_operations = none, shift, relational, equality, bitwise_and, bitwise_exclusive_or, bitwise_inclusive_or, bitwise, conditional_and, conditional_or, conditional
+resharper_place_accessorholder_attribute_on_same_line = false
+resharper_place_field_attribute_on_same_line = if_owner_is_single_line
+resharper_place_simple_embedded_block_on_same_line = true
+resharper_place_simple_embedded_statement_on_same_line = false
+resharper_static_members_qualify_members = none, field, property, event, method
+resharper_trailing_comma_in_multiline_lists = true
+resharper_wrap_chained_binary_expressions = chop_if_long
+resharper_xmldoc_attribute_indent = align_by_first_attribute
+resharper_xmldoc_linebreaks_inside_tags_for_elements_longer_than = 80
+resharper_xmldoc_max_blank_lines_between_tags = 1
+resharper_xmldoc_max_line_length = 160
+resharper_xml_attribute_indent = single_indent
+resharper_xml_attribute_style = on_different_lines
+resharper_xml_max_line_length = 320
+resharper_xml_pi_attributes_indent = single_indent
+resharper_xml_use_indent_from_vs = false
+
+# ReSharper inspection severities
+resharper_arrange_attributes_highlighting = suggestion
+resharper_arrange_default_value_when_type_not_evident_highlighting = suggestion
+resharper_arrange_method_or_operator_body_highlighting = suggestion
+resharper_arrange_object_creation_when_type_not_evident_highlighting = suggestion
+resharper_arrange_static_member_qualifier_highlighting = warning
+resharper_arrange_trailing_comma_in_multiline_lists_highlighting = suggestion
+resharper_arrange_trailing_comma_in_singleline_lists_highlighting = suggestion
+resharper_arrange_type_member_modifiers_highlighting = hint
+resharper_arrange_type_modifiers_highlighting = hint
+resharper_built_in_type_reference_style_for_member_access_highlighting = hint
+resharper_built_in_type_reference_style_highlighting = hint
+resharper_cpp_enforce_nested_namespaces_style_highlighting = suggestion
+resharper_enforce_do_while_statement_braces_highlighting = suggestion
+resharper_enforce_fixed_statement_braces_highlighting = suggestion
+resharper_enforce_foreach_statement_braces_highlighting = suggestion
+resharper_enforce_for_statement_braces_highlighting = suggestion
+resharper_enforce_if_statement_braces_highlighting = suggestion
+resharper_enforce_lock_statement_braces_highlighting = suggestion
+resharper_enforce_using_statement_braces_highlighting = suggestion
+resharper_enforce_while_statement_braces_highlighting = suggestion
+resharper_redundant_bool_compare_highlighting = none
+resharper_suggest_discard_declaration_var_style_highlighting = suggestion
+resharper_suggest_var_or_type_elsewhere_highlighting = warning
+
+[*.{appxmanifest,asax,ascx,aspx,axaml,axml,blockshader,c,c++,c++m,cc,ccm,cginc,compute,config,cp,cpp,cppm,cs,cshtml,csproj,cu,cuh,cxx,cxxm,dbml,discomap,dtd,fx,fxh,h,h++,hh,hlsl,hlsli,hlslinc,hp,hpp,htm,html,hxx,icc,inc,inl,ino,ipp,ixx,jsproj,lsproj,master,mpp,mq4,mq5,mqh,mxx,njsproj,nuspec,paml,proj,props,pssl,pssli,razor,resw,resx,shader,shaderFoundry,skin,sql,StyleCop,targets,tasks,tcc,tpp,urtshader,usf,ush,uxml,vb,vbproj,xaml,xamlx,xml,xoml,xsd}]
+indent_style = space
+indent_size = 4
+tab_width = 4
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index a80579e..6f87e54 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -1,43 +1,59 @@
-
- $(MSBuildThisFileDirectory)
- $(MSBuildThisFileDirectory).output
- $(SolutionOutputPath)\$(MSBuildProjectName)
- $(ProjectOutputPath)\bin
- $(ProjectOutputPath)\obj
- $(SolutionOutputPath)\Packages
-
+
+ $(MSBuildThisFileDirectory)
+ $(MSBuildThisFileDirectory).output
+ $(SolutionOutputPath)\$(MSBuildProjectName)
+ $(ProjectOutputPath)\bin
+ $(ProjectOutputPath)\obj
+ $(SolutionOutputPath)\Packages
+
-
- $(MSBuildBinPath)\Microsoft.CSharp.targets
- false
- 1701;1702;1705;NU1603;NU5105
- $(ProjectOutputPath)\$(MSBuildProjectName).xml
- $(MSBuildProjectName)
-
+
+ $(MSBuildBinPath)\Microsoft.CSharp.targets
+ false
+ 1701;1702;1705;NU1603;NU5105
+ $(ProjectOutputPath)\$(MSBuildProjectName).xml
+ $(MSBuildProjectName)
+
-
- An 'in-source' issue management system built on GIT.
- https://github.com/lennoncork/GitIssue
- MIT
- README.md
- GIT
- MIT
-
+
+ An 'in-source' issue management system built on GIT.
+ https://github.com/lennoncork/GitIssue
+ MIT
+ README.md
+ GIT
+ MIT
+
-
-
-
-
+
+
+
+
-
- $(DirectoryBuildPath)
- $(BaseOutputPath)\$(Configuration)
-
+
+
+ $(DirectoryBuildPath)
+
+
+ $(BaseOutputPath)\$(Configuration)
+
+
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets
index d5edd1c..4ab2bfd 100644
--- a/src/Directory.Build.targets
+++ b/src/Directory.Build.targets
@@ -1,7 +1,9 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/GitIssue.Tests/Extensions.cs b/src/GitIssue.Tests/Extensions.cs
index f8e84be..643e948 100644
--- a/src/GitIssue.Tests/Extensions.cs
+++ b/src/GitIssue.Tests/Extensions.cs
@@ -6,20 +6,21 @@ namespace GitIssue.Tests
public static class Extensions
{
///
- /// Asserts if the result wasn't successful, otherwise returns the result
+ /// Asserts if the result wasn't successful, otherwise returns the result
///
///
///
///
public static async Task AssertIfNotSuccess(this Task> result)
{
- var safe = await result;
- if (safe.IsSuccess == false && safe.Exception != null)
+ SafeResult safe = await result;
+ if (!safe.IsSuccess && (safe.Exception != null))
{
TestContext.Out.Write(safe.Exception);
}
- Assert.That(safe.IsSuccess, Is.True, $"SafeResult was not successful, {safe.Exception?.Message}", safe);
+
+ Assert.That(safe.IsSuccess, Is.True, $"SafeResult was not successful, {safe.Exception?.Message}");
return safe.Result;
}
}
-}
+}
\ No newline at end of file
diff --git a/src/GitIssue.Tests/Formatting/SimpleFormatterTests.cs b/src/GitIssue.Tests/Formatting/SimpleFormatterTests.cs
index 8cf7c22..f0df0d3 100644
--- a/src/GitIssue.Tests/Formatting/SimpleFormatterTests.cs
+++ b/src/GitIssue.Tests/Formatting/SimpleFormatterTests.cs
@@ -5,6 +5,5 @@ namespace GitIssue.Tests.Formatting
[TestFixture]
public partial class SimpleFormatterTests : TestsBase
{
-
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tests/Formatting/SimpleFormatterTests_Format.cs b/src/GitIssue.Tests/Formatting/SimpleFormatterTests_Format.cs
index 3215965..78e3172 100644
--- a/src/GitIssue.Tests/Formatting/SimpleFormatterTests_Format.cs
+++ b/src/GitIssue.Tests/Formatting/SimpleFormatterTests_Format.cs
@@ -1,4 +1,5 @@
using GitIssue.Formatters;
+using GitIssue.Issues;
using NUnit.Framework;
namespace GitIssue.Tests.Formatting
@@ -12,9 +13,9 @@ public class Format : SimpleFormatterTests
[Test]
public void FormatsIssue()
{
- var issue = Moqs.CreateIssue(nameof(FormatsIssue));
- var output = issue.Format();
- var expected = $"{issue.Key}: {issue.Title}";
+ IReadOnlyIssue issue = Moqs.CreateIssue(nameof(Format.FormatsIssue));
+ string output = issue.Format();
+ string expected = $"{issue.Key}: {issue.Title}";
Assert.That(output, Is.EqualTo(expected));
}
}
diff --git a/src/GitIssue.Tests/GitIssue.Tests.csproj b/src/GitIssue.Tests/GitIssue.Tests.csproj
index 4679422..b847f95 100644
--- a/src/GitIssue.Tests/GitIssue.Tests.csproj
+++ b/src/GitIssue.Tests/GitIssue.Tests.csproj
@@ -1,21 +1,21 @@
- net6.0
+ net10.0
enable
latest
-
+
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/GitIssue.Tests/Helpers.cs b/src/GitIssue.Tests/Helpers.cs
index 1ca882e..218ffab 100644
--- a/src/GitIssue.Tests/Helpers.cs
+++ b/src/GitIssue.Tests/Helpers.cs
@@ -12,43 +12,24 @@ public static class Helpers
public static string TestData = "TestData";
///
- /// Gets a random unique string, max length 64
- ///
- ///
- ///
- public static string GetRandomString(int length = 8)
- {
- const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
- return new string(Enumerable.Repeat(chars, length)
- .Select(s => s[random.Next(s.Length)]).ToArray());
- }
-
- ///
- /// Gets the test directory
- ///
- ///
- public static string GetTestDirectory()
- {
- return Path.Combine(TestContext.CurrentContext.TestDirectory, TestData);
- }
-
- ///
- /// Gets the path of a new temp file, using the default temp directory
+ /// Creates a new temporary directory, using the default temp directory
///
///
- public static string GetTempFile()
+ public static string CreateTempDirectory()
{
- return GetTempFile(GetTestDirectory());
+ return Helpers.CreateTempDirectory(Helpers.GetTestDirectory());
}
///
- /// Gets the path of a new temp file
+ /// Creates a new temporary directory
///
- /// the parent path for the file
+ /// the parent path for the directory
///
- public static string GetTempFile(string path)
+ public static string CreateTempDirectory(string path)
{
- return Path.Combine(path, $"{GetRandomString()}.txt");
+ string directory = Helpers.GetTempDirectory(path);
+ Directory.CreateDirectory(directory);
+ return directory;
}
///
@@ -57,7 +38,7 @@ public static string GetTempFile(string path)
///
public static string CreateTempFile()
{
- return CreateTempFile(GetTestDirectory());
+ return Helpers.CreateTempFile(Helpers.GetTestDirectory());
}
///
@@ -67,18 +48,30 @@ public static string CreateTempFile()
///
public static string CreateTempFile(string path)
{
- var file = GetTempFile(path);
+ string file = Helpers.GetTempFile(path);
File.Create(file).Dispose();
return file;
}
+ ///
+ /// Gets a random unique string, max length 64
+ ///
+ ///
+ ///
+ public static string GetRandomString(int length = 8)
+ {
+ const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ return new string(Enumerable.Repeat(chars, length)
+ .Select(s => s[Helpers.random.Next(s.Length)]).ToArray());
+ }
+
///
/// Gets the path of a new temp directory, using the default temp directory
///
///
public static string GetTempDirectory()
{
- return GetTempDirectory(GetTestDirectory());
+ return Helpers.GetTempDirectory(Helpers.GetTestDirectory());
}
///
@@ -88,28 +81,35 @@ public static string GetTempDirectory()
///
public static string GetTempDirectory(string path)
{
- return Path.Combine(path, GetRandomString());
+ return Path.Combine(path, Helpers.GetRandomString());
}
///
- /// Creates a new temporary directory, using the default temp directory
+ /// Gets the path of a new temp file, using the default temp directory
///
///
- public static string CreateTempDirectory()
+ public static string GetTempFile()
{
- return CreateTempDirectory(GetTestDirectory());
+ return Helpers.GetTempFile(Helpers.GetTestDirectory());
}
///
- /// Creates a new temporary directory
+ /// Gets the path of a new temp file
///
- /// the parent path for the directory
+ /// the parent path for the file
///
- public static string CreateTempDirectory(string path)
+ public static string GetTempFile(string path)
{
- var directory = GetTempDirectory(path);
- Directory.CreateDirectory(directory);
- return directory;
+ return Path.Combine(path, $"{Helpers.GetRandomString()}.txt");
+ }
+
+ ///
+ /// Gets the test directory
+ ///
+ ///
+ public static string GetTestDirectory()
+ {
+ return Path.Combine(TestContext.CurrentContext.TestDirectory, Helpers.TestData);
}
///
@@ -127,7 +127,7 @@ public EnvironmentCurrentDirectory(string directory)
{
if (Directory.Exists(directory))
{
- environment = Environment.CurrentDirectory;
+ this.environment = Environment.CurrentDirectory;
Environment.CurrentDirectory = directory;
}
}
@@ -135,8 +135,10 @@ public EnvironmentCurrentDirectory(string directory)
///
public void Dispose()
{
- if (environment != null)
- Environment.CurrentDirectory = environment;
+ if (this.environment != null)
+ {
+ Environment.CurrentDirectory = this.environment;
+ }
}
}
}
diff --git a/src/GitIssue.Tests/IntegrationTests/Bug/BugConfiguration.cs b/src/GitIssue.Tests/IntegrationTests/Bug/BugConfiguration.cs
index 4978643..c80af3f 100644
--- a/src/GitIssue.Tests/IntegrationTests/Bug/BugConfiguration.cs
+++ b/src/GitIssue.Tests/IntegrationTests/Bug/BugConfiguration.cs
@@ -14,12 +14,9 @@ public class BugConfiguration : IssueConfiguration
///
public BugConfiguration()
{
- Fields.Add(FieldKey.Create("AffectsVersion"), new FieldInfo(false));
- Fields.Add(FieldKey.Create("FixVersion"), new FieldInfo(false));
- Fields.Add(FieldKey.Create("Severity"), new FieldInfo(false)
- {
- ValueMetadata = "[S1, S1, S3, S4, S5]"
- });
+ this.Fields.Add(FieldKey.Create("AffectsVersion"), new FieldInfo(false));
+ this.Fields.Add(FieldKey.Create("FixVersion"), new FieldInfo(false));
+ this.Fields.Add(FieldKey.Create("Severity"), new FieldInfo(false) { ValueMetadata = "[S1, S1, S3, S4, S5]" });
}
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tests/IntegrationTests/Bug/BugExtensions.cs b/src/GitIssue.Tests/IntegrationTests/Bug/BugExtensions.cs
index 226ac96..7a7d3ed 100644
--- a/src/GitIssue.Tests/IntegrationTests/Bug/BugExtensions.cs
+++ b/src/GitIssue.Tests/IntegrationTests/Bug/BugExtensions.cs
@@ -13,44 +13,44 @@ public static class BugExtensions
private static readonly FieldKey SeverityKey = FieldKey.Create("Severity");
///
- /// Sets the fix version of the issue
+ /// Gets the fix version of the issue
///
/// the issue
- /// the fix version to set
- public static void SetFixVersion(this IIssue issue, Version[] fixVersion)
+ public static Version[] GetFixVersion(this IIssue issue)
{
- issue.SetField(FixVersionKey).WithArray(fixVersion);
+ Version[] fixVersion = issue.GetField(BugExtensions.FixVersionKey).AsArray();
+ return fixVersion;
}
///
- /// Gets the fix version of the issue
+ /// Gets the severity of the issue
///
/// the issue
- public static Version[] GetFixVersion(this IIssue issue)
+ ///
+ public static Enumerated GetSeverity(this IIssue issue)
{
- var fixVersion = issue.GetField(FixVersionKey).AsArray();
- return fixVersion;
+ Enumerated severity = issue.GetField(BugExtensions.SeverityKey).AsValue();
+ return severity;
}
///
- /// Sets the severity of the issue
+ /// Sets the fix version of the issue
///
/// the issue
- /// the issue's severity
- public static void SetSeverity(this IIssue issue, Enumerated severity)
+ /// the fix version to set
+ public static void SetFixVersion(this IIssue issue, Version[] fixVersion)
{
- issue.SetField(SeverityKey).WithValue(severity);
+ issue.SetField(BugExtensions.FixVersionKey).WithArray(fixVersion);
}
///
- /// Gets the severity of the issue
+ /// Sets the severity of the issue
///
/// the issue
- ///
- public static Enumerated GetSeverity(this IIssue issue)
+ /// the issue's severity
+ public static void SetSeverity(this IIssue issue, Enumerated severity)
{
- var severity = issue.GetField(SeverityKey).AsValue();
- return severity;
+ issue.SetField(BugExtensions.SeverityKey).WithValue(severity);
}
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests.cs b/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests.cs
index 88e3e3a..1d71dff 100644
--- a/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests.cs
+++ b/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests.cs
@@ -10,17 +10,20 @@ public partial class BugIntegrationTests
[SetUp]
public void Setup()
{
- TestDirectory = Helpers.GetTempDirectory();
- if (Directory.Exists(TestDirectory) == false) Directory.CreateDirectory(TestDirectory);
+ this.TestDirectory = Helpers.GetTempDirectory();
+ if (!Directory.Exists(this.TestDirectory))
+ {
+ Directory.CreateDirectory(this.TestDirectory);
+ }
}
protected string TestDirectory = Path.GetTempPath();
- protected string GitDirectory => Path.Combine(TestDirectory, Paths.GitFolderName);
+ protected string GitDirectory => Path.Combine(this.TestDirectory, Paths.GitFolderName);
- protected string IssueDirectory => Path.Combine(TestDirectory, Paths.IssueRootFolderName);
+ protected string IssueDirectory => Path.Combine(this.TestDirectory, Paths.IssueRootFolderName);
- protected string ConfigFile => Path.Combine(IssueDirectory, Paths.ConfigFileName);
+ protected string ConfigFile => Path.Combine(this.IssueDirectory, Paths.ConfigFileName);
protected IRepository GitRepository { get; set; } = null!;
@@ -29,9 +32,13 @@ public void Setup()
[OneTimeSetUp]
public void OneTimeSetup()
{
- TestDirectory = Helpers.GetTestDirectory();
- if (Directory.Exists(TestDirectory)) Directory.Delete(TestDirectory, true);
- Directory.CreateDirectory(TestDirectory);
+ this.TestDirectory = Helpers.GetTestDirectory();
+ if (Directory.Exists(this.TestDirectory))
+ {
+ Directory.Delete(this.TestDirectory, true);
+ }
+
+ Directory.CreateDirectory(this.TestDirectory);
}
public void Initialize(
@@ -40,10 +47,14 @@ public void Initialize(
bool initIssue = true)
{
if (initGit)
- GitRepository = new Repository(Repository.Init(directory));
+ {
+ this.GitRepository = new Repository(Repository.Init(directory));
+ }
if (initIssue)
- Issues = GitIssue.IssueManager.Init(new BugConfiguration(), directory);
+ {
+ this.Issues = IssueManager.Init(new BugConfiguration(), directory);
+ }
}
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests_FixVersion.cs b/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests_FixVersion.cs
index dabdf9d..be734f4 100644
--- a/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests_FixVersion.cs
+++ b/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests_FixVersion.cs
@@ -1,5 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
+using GitIssue.Issues;
using GitIssue.Values;
using NUnit.Framework;
@@ -14,14 +15,14 @@ public class FixVersion : BugIntegrationTests
[Test]
public async Task CanBeSetFromString()
{
- Initialize(TestDirectory);
+ this.Initialize(this.TestDirectory);
- var create = await Issues
- .CreateAsync(nameof(CanBeSetFromString), string.Empty)
+ IIssue create = await this.Issues
+ .CreateAsync(nameof(FixVersion.CanBeSetFromString), string.Empty)
.WithSafeResultAsync()
.AssertIfNotSuccess();
- var fixVersion = Version.Parse("1.2.3-abs+def");
+ Version fixVersion = Version.Parse("1.2.3-abs+def");
create.SetFixVersion(new[] { fixVersion });
await create
@@ -29,9 +30,9 @@ await create
.WithSafeResultAsync()
.AssertIfNotSuccess();
- var find = Issues.Find(i => i.Key == create.Key).ToArray();
+ IIssue[] find = this.Issues.Find(i => i.Key == create.Key).ToArray();
- var issue = find[0];
+ IIssue issue = find[0];
Assert.That(issue.GetFixVersion()[0], Is.EqualTo(fixVersion));
}
}
diff --git a/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests_Severity.cs b/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests_Severity.cs
index e55e63a..1221a63 100644
--- a/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests_Severity.cs
+++ b/src/GitIssue.Tests/IntegrationTests/Bug/BugIntegrationTests_Severity.cs
@@ -1,5 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
+using GitIssue.Issues;
using GitIssue.Values;
using NUnit.Framework;
@@ -14,16 +15,16 @@ public class Severity : BugIntegrationTests
[Test]
public async Task CanBeSetFromString()
{
- Initialize(TestDirectory);
- var create = await Issues
- .CreateAsync(nameof(CanBeSetFromString), string.Empty)
+ this.Initialize(this.TestDirectory);
+ SafeResult create = await this.Issues
+ .CreateAsync(nameof(Severity.CanBeSetFromString), string.Empty)
.WithSafeResultAsync();
Assert.IsTrue(create.IsSuccess);
- var severity = new Enumerated("S1", new[] { "S1", "S2", "S3", "S4", "S5" });
+ Enumerated severity = new Enumerated("S1", new[] { "S1", "S2", "S3", "S4", "S5" });
create.Result.SetSeverity(severity);
await create.Result.SaveAsync();
- var find = Issues.Find(i => i.Key == create.Result.Key).ToArray();
- var issue = find[0];
+ IIssue[] find = this.Issues.Find(i => i.Key == create.Result.Key).ToArray();
+ IIssue issue = find[0];
Assert.That(issue.GetSeverity(), Is.EqualTo(severity));
}
}
diff --git a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests.cs b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests.cs
index f174121..b1ccc9a 100644
--- a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests.cs
+++ b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests.cs
@@ -11,8 +11,11 @@ public IIssueManager Sut
{
get
{
- if (sut == null)
+ if (this.sut == null)
+ {
return this.Manager;
+ }
+
return this.sut;
}
set => this.sut = value;
diff --git a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Create.cs b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Create.cs
index ee8aa74..208b29a 100644
--- a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Create.cs
+++ b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Create.cs
@@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
+using GitIssue.Issues;
using NUnit.Framework;
namespace GitIssue.Tests.IssueManagerTests
@@ -13,8 +14,8 @@ public class Create : IssueManagerTests
[TestCase("New Issue", "This Is A New Issue")]
public async Task CreatesNewIssue(string title, string description)
{
- Initialize(TestDirectory);
- var create = await Sut
+ this.Initialize(this.TestDirectory);
+ SafeResult create = await this.Sut
.CreateAsync(title, description)
.WithSafeResultAsync();
Assert.IsTrue(create.IsSuccess);
@@ -25,13 +26,13 @@ public async Task CreatesNewIssue(string title, string description)
[Test]
public async Task GeneratesUniqueId()
{
- Initialize(TestDirectory);
- var create1 = await Sut
- .CreateAsync(nameof(CreatesNewIssue), string.Empty)
+ this.Initialize(this.TestDirectory);
+ SafeResult create1 = await this.Sut
+ .CreateAsync(nameof(Create.CreatesNewIssue), string.Empty)
.WithSafeResultAsync();
Assert.IsTrue(create1.IsSuccess);
- var create2 = await Sut
- .CreateAsync(nameof(CreatesNewIssue), string.Empty)
+ SafeResult create2 = await this.Sut
+ .CreateAsync(nameof(Create.CreatesNewIssue), string.Empty)
.WithSafeResultAsync();
Assert.IsTrue(create2.IsSuccess);
Assert.That(create1.Result.Key, Is.Not.EqualTo(create2.Result.Key));
@@ -40,9 +41,9 @@ public async Task GeneratesUniqueId()
[Test]
public async Task SetsCreatedDate()
{
- Initialize(TestDirectory);
- var create = await Sut
- .CreateAsync(nameof(SetsCreatedDate), string.Empty)
+ this.Initialize(this.TestDirectory);
+ SafeResult create = await this.Sut
+ .CreateAsync(nameof(Create.SetsCreatedDate), string.Empty)
.WithSafeResultAsync();
Assert.That((DateTime)create.Result.Created, Is.EqualTo(DateTime.Now).Within(TimeSpan.FromSeconds(2)));
}
@@ -50,9 +51,9 @@ public async Task SetsCreatedDate()
[Test]
public async Task SetsUpdatedDate()
{
- Initialize(TestDirectory);
- var create = await Sut
- .CreateAsync(nameof(SetsUpdatedDate), string.Empty)
+ this.Initialize(this.TestDirectory);
+ SafeResult create = await this.Sut
+ .CreateAsync(nameof(Create.SetsUpdatedDate), string.Empty)
.WithSafeResultAsync();
Assert.That((DateTime)create.Result.Updated, Is.EqualTo(DateTime.Now).Within(TimeSpan.FromSeconds(2)));
}
diff --git a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Delete.cs b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Delete.cs
index a1eb2c6..98bdda9 100644
--- a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Delete.cs
+++ b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Delete.cs
@@ -1,5 +1,6 @@
using System.IO;
using System.Threading.Tasks;
+using GitIssue.Issues;
using NUnit.Framework;
namespace GitIssue.Tests.IssueManagerTests
@@ -13,25 +14,25 @@ public class Delete : IssueManagerTests
[Test]
public async Task DeletesExistingIssue()
{
- Initialize(TestDirectory);
- var create = await Sut
- .CreateAsync(nameof(DeletesExistingIssue), string.Empty)
+ this.Initialize(this.TestDirectory);
+ SafeResult create = await this.Sut
+ .CreateAsync(nameof(Delete.DeletesExistingIssue), string.Empty)
.WithSafeResultAsync();
Assert.IsTrue(create.IsSuccess);
- Assert.IsTrue(Directory.Exists(Path.Combine(IssueDirectory, Sut.KeyProvider.GetIssuePath(create.Result.Key))));
- var delete = await Sut
+ Assert.IsTrue(Directory.Exists(Path.Combine(this.IssueDirectory, this.Sut.KeyProvider.GetIssuePath(create.Result.Key))));
+ SafeResult delete = await this.Sut
.DeleteAsync(create.Result.Key)
.WithSafeResultAsync();
Assert.IsTrue(delete.IsSuccess);
- Assert.IsFalse(Directory.Exists(Path.Combine(IssueDirectory, Sut.KeyProvider.GetIssuePath(create.Result.Key))));
+ Assert.IsFalse(Directory.Exists(Path.Combine(this.IssueDirectory, this.Sut.KeyProvider.GetIssuePath(create.Result.Key))));
}
[Test]
public async Task FailsIfIssueDoesNotExist()
{
- Initialize(TestDirectory);
- var delete = await Sut
- .DeleteAsync(Sut.KeyProvider.Next())
+ this.Initialize(this.TestDirectory);
+ SafeResult delete = await this.Sut
+ .DeleteAsync(this.Sut.KeyProvider.Next())
.WithSafeResultAsync();
Assert.IsFalse(delete.IsSuccess);
}
diff --git a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Export.cs b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Export.cs
index ad33d56..81e0604 100644
--- a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Export.cs
+++ b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Export.cs
@@ -1,5 +1,6 @@
using System.IO;
using System.Threading.Tasks;
+using GitIssue.Issues;
using GitIssue.Issues.Json;
using NUnit.Framework;
@@ -14,15 +15,15 @@ public class Export : IssueManagerTests
[Test]
public async Task ExportsFileToJson()
{
- Initialize(TestDirectory);
- var issue1 = await Sut
- .CreateAsync(nameof(ExportsFileToJson))
+ this.Initialize(this.TestDirectory);
+ SafeResult issue1 = await this.Sut
+ .CreateAsync(nameof(Export.ExportsFileToJson))
.WithSafeResultAsync();
- var issue2 = await Sut
- .CreateAsync(nameof(ExportsFileToJson))
+ SafeResult issue2 = await this.Sut
+ .CreateAsync(nameof(Export.ExportsFileToJson))
.WithSafeResultAsync();
- var path = Path.Combine(TestDirectory, "export.json");
- await Sut.ExportAsJsonAsync(path);
+ string path = Path.Combine(this.TestDirectory, "export.json");
+ await this.Sut.ExportAsJsonAsync(path);
Assert.That(File.Exists(path), Is.True);
}
}
diff --git a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Find.cs b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Find.cs
index f99d9fd..58006bd 100644
--- a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Find.cs
+++ b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Find.cs
@@ -1,5 +1,6 @@
using System.Linq;
using System.Threading.Tasks;
+using GitIssue.Issues;
using NUnit.Framework;
namespace GitIssue.Tests.IssueManagerTests
@@ -13,11 +14,11 @@ public class Find : IssueManagerTests
[TestCase("New Issue")]
public async Task FindsIssueByTitle(string title)
{
- Initialize(TestDirectory);
- var create = await Sut
+ this.Initialize(this.TestDirectory);
+ SafeResult create = await this.Sut
.CreateAsync(title, string.Empty)
.WithSafeResultAsync();
- var find = Sut.Find(i => i.Title == title).ToArray();
+ IIssue[] find = this.Sut.Find(i => i.Title == title).ToArray();
Assert.That(find.Count(), Is.EqualTo(1));
Assert.That(find[0].Title, Is.EqualTo(title));
}
@@ -25,11 +26,11 @@ public async Task FindsIssueByTitle(string title)
[Test]
public async Task FindsIssueByKey()
{
- Initialize(TestDirectory);
- var create = await Sut
- .CreateAsync(nameof(FindsIssueByKey), string.Empty)
+ this.Initialize(this.TestDirectory);
+ SafeResult create = await this.Sut
+ .CreateAsync(nameof(Find.FindsIssueByKey), string.Empty)
.WithSafeResultAsync();
- var find = Sut.Find(i => i.Key == create.Result.Key).ToArray();
+ IIssue[] find = this.Sut.Find(i => i.Key == create.Result.Key).ToArray();
Assert.That(find.Count(), Is.EqualTo(1));
Assert.That(find[0].Key, Is.EqualTo(create.Result.Key));
}
diff --git a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Init.cs b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Init.cs
index cd38049..7e83838 100644
--- a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Init.cs
+++ b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Init.cs
@@ -14,24 +14,24 @@ public class Init : IssueManagerTests
[Test]
public void CreatesConfigFile()
{
- CreatesIssueFolder();
- Assert.IsTrue(File.Exists(ConfigFile));
+ this.CreatesIssueFolder();
+ Assert.IsTrue(File.Exists(this.ConfigFile));
}
[Test]
public void CreatesIssueFolder()
{
- Repository.Init(TestDirectory);
- GitIssue.IssueManager.Init(TestDirectory);
- Assert.That(TestDirectory, Is.Not.Empty);
- Assert.IsTrue(Directory.Exists(IssueDirectory));
- Assert.IsTrue(Directory.Exists(GitDirectory));
+ Repository.Init(this.TestDirectory);
+ IssueManager.Init(this.TestDirectory);
+ Assert.That(this.TestDirectory, Is.Not.Empty);
+ Assert.IsTrue(Directory.Exists(this.IssueDirectory));
+ Assert.IsTrue(Directory.Exists(this.GitDirectory));
}
[Test]
public void FailsIfNotAGitRepository()
{
- Assert.Throws(() => { GitIssue.IssueManager.Init(TestDirectory); });
+ Assert.Throws(() => { IssueManager.Init(this.TestDirectory); });
}
}
}
diff --git a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Locate.cs b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Locate.cs
index a83bcb3..e87452a 100644
--- a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Locate.cs
+++ b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Locate.cs
@@ -14,54 +14,54 @@ public class Constructor : IssueManagerTests
[Test]
public void FailsIfConfigMissing()
{
- Initialize(TestDirectory, true, true, false);
- File.Delete(Path.Combine(TestDirectory, Paths.IssueRootFolderName, Paths.ConfigFileName));
- Assert.Throws(() => { Sut = IssueManager.Open(TestDirectory); });
+ this.Initialize(this.TestDirectory, true, true, false);
+ File.Delete(Path.Combine(this.TestDirectory, Paths.IssueRootFolderName, Paths.ConfigFileName));
+ Assert.Throws(() => { this.Sut = IssueManager.Open(this.TestDirectory); });
}
[Test]
public void FailsIfDirectoryMissing()
{
- Initialize(TestDirectory, true, true, false);
- Directory.Delete(Path.Combine(TestDirectory, Paths.IssueRootFolderName), true);
- Assert.Throws(() => { Sut = IssueManager.Open(TestDirectory); });
+ this.Initialize(this.TestDirectory, true, true, false);
+ Directory.Delete(Path.Combine(this.TestDirectory, Paths.IssueRootFolderName), true);
+ Assert.Throws(() => { this.Sut = IssueManager.Open(this.TestDirectory); });
}
[Test]
public void FailsIfGitDirectoryMissing()
{
- Initialize(TestDirectory);
- Directory.Delete(Path.Combine(TestDirectory, Paths.GitFolderName), true);
+ this.Initialize(this.TestDirectory);
+ Directory.Delete(Path.Combine(this.TestDirectory, Paths.GitFolderName), true);
Assert.Throws(() =>
{
- Sut = IssueManager.Open(TestDirectory);
+ this.Sut = IssueManager.Open(this.TestDirectory);
});
}
[Test]
public void SucceedsFromCurrentDirectory()
{
- using (new Helpers.EnvironmentCurrentDirectory(TestDirectory))
+ using (new Helpers.EnvironmentCurrentDirectory(this.TestDirectory))
{
- Initialize(TestDirectory);
- Assert.That(Sut.Root.RootPath, Is.EqualTo(TestDirectory));
+ this.Initialize(this.TestDirectory);
+ Assert.That(this.Sut.Root.RootPath, Is.EqualTo(this.TestDirectory));
}
}
[Test]
public void SucceedsFromSpecifiedDirectory()
{
- Initialize(TestDirectory);
- Assert.That(Sut.Root.RootPath, Is.EqualTo(TestDirectory));
+ this.Initialize(this.TestDirectory);
+ Assert.That(this.Sut.Root.RootPath, Is.EqualTo(this.TestDirectory));
}
[Test]
public void SucceedsWithDifferentName()
{
- var name = "Specifications";
- Initialize(TestDirectory, name);
- Assert.That(Sut.Root.RootPath, Is.EqualTo(TestDirectory));
- Assert.That(Directory.Exists(Path.Combine(TestDirectory, name)), Is.True);
+ string name = "Specifications";
+ this.Initialize(this.TestDirectory, name);
+ Assert.That(this.Sut.Root.RootPath, Is.EqualTo(this.TestDirectory));
+ Assert.That(Directory.Exists(Path.Combine(this.TestDirectory, name)), Is.True);
}
}
}
diff --git a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Update.cs b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Update.cs
index 7a05b27..f826b54 100644
--- a/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Update.cs
+++ b/src/GitIssue.Tests/IssueManagerTests/IssueManagerTests_Update.cs
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using GitIssue.Issues;
using NUnit.Framework;
namespace GitIssue.Tests.IssueManagerTests
@@ -14,27 +15,27 @@ public class Update : IssueManagerTests
[Test]
public async Task SetsUpdateDate()
{
- Initialize(TestDirectory);
- var create = await Sut
- .CreateAsync(nameof(SetsUpdateDate), string.Empty)
+ this.Initialize(this.TestDirectory);
+ SafeResult create = await this.Sut
+ .CreateAsync(nameof(Update.SetsUpdateDate), string.Empty)
.WithSafeResultAsync();
await create.Result.SaveAsync();
- var find = Sut.Find(i => i.Key == create.Result.Key).ToArray();
- var issue = find[0];
+ IIssue[] find = this.Sut.Find(i => i.Key == create.Result.Key).ToArray();
+ IIssue issue = find[0];
Assert.That((DateTime)issue.Updated, Is.EqualTo(DateTime.Now).Within(TimeSpan.FromSeconds(2)));
}
[Test]
public async Task UpdatesTitle()
{
- Initialize(TestDirectory);
- var create = await Sut
- .CreateAsync(nameof(UpdatesTitle), string.Empty)
+ this.Initialize(this.TestDirectory);
+ SafeResult create = await this.Sut
+ .CreateAsync(nameof(Update.UpdatesTitle), string.Empty)
.WithSafeResultAsync();
create.Result.Title = "Updated";
await create.Result.SaveAsync();
- var find = Sut.Find(i => i.Key == create.Result.Key).ToArray();
- var issue = find[0];
+ IIssue[] find = this.Sut.Find(i => i.Key == create.Result.Key).ToArray();
+ IIssue issue = find[0];
Assert.That(issue.Title, Is.EqualTo("Updated"));
}
}
diff --git a/src/GitIssue.Tests/Moqs.cs b/src/GitIssue.Tests/Moqs.cs
index c0fbff8..2512f58 100644
--- a/src/GitIssue.Tests/Moqs.cs
+++ b/src/GitIssue.Tests/Moqs.cs
@@ -9,48 +9,69 @@ namespace GitIssue.Tests
{
public static class Moqs
{
- private delegate void MockOutDelegate(T1 s, out T2 value);
+ public static IReadOnlyIssue Issue
+ {
+ get
+ {
+ Mock moq = new Mock(MockBehavior.Strict);
+ return moq.Object;
+ }
+ }
+
+ public static IIssueManager IssueManager
+ {
+ get
+ {
+ Mock moq = new Mock(MockBehavior.Strict);
+ return moq.Object;
+ }
+ }
public static void AddField(this Dictionary dict, string key, string value)
{
- var fieldKey = FieldKey.Create(key);
- var field = CreateField(key, value);
+ FieldKey fieldKey = FieldKey.Create(key);
+ IField field = Moqs.CreateField(key, value);
dict.Add(fieldKey, field);
}
public static IField CreateField(FieldKey key, string value)
{
- var moq = new Mock(MockBehavior.Strict);
+ Mock moq = new Mock(MockBehavior.Strict);
moq.Setup(f => f.Key).Returns(key);
moq.Setup(f => f.ToString()).Returns(value);
moq.Setup(f => f.GetHashCode()).Returns(value.GetHashCode());
return moq.Object;
}
- public static IssueKey CreateIssueKey() => IssueKey.Create(Helpers.GetRandomString());
-
- public static IReadOnlyIssue CreateIssue(string title) => CreateIssue(title, string.Empty);
+ public static IReadOnlyIssue CreateIssue(string title)
+ {
+ return Moqs.CreateIssue(title, string.Empty);
+ }
- public static IReadOnlyIssue CreateIssue(string title, string description) =>
- CreateIssue(CreateIssueKey(), title, description);
+ public static IReadOnlyIssue CreateIssue(string title, string description)
+ {
+ return Moqs.CreateIssue(Moqs.CreateIssueKey(), title, description);
+ }
- public static IReadOnlyIssue CreateIssue(IssueKey key, string title, string description) =>
- CreateIssue(key, title, description, DateTime.Now, DateTime.Now);
+ public static IReadOnlyIssue CreateIssue(IssueKey key, string title, string description)
+ {
+ return Moqs.CreateIssue(key, title, description, DateTime.Now, DateTime.Now);
+ }
public static IReadOnlyIssue CreateIssue(IssueKey key, string title, string description, DateTime created, DateTime updated)
{
- var fields = new Dictionary();
- fields.AddField(nameof(IIssue.Key), key);
+ Dictionary fields = new Dictionary();
+ fields.AddField(nameof(IReadOnlyIssue.Key), key);
fields.AddField(nameof(IIssue.Title), title);
fields.AddField(nameof(IIssue.Description), description);
fields.AddField(nameof(IIssue.Created), created.ToString(CultureInfo.InvariantCulture));
fields.AddField(nameof(IIssue.Updated), updated.ToString(CultureInfo.InvariantCulture));
- return CreateIssue(fields);
+ return Moqs.CreateIssue(fields);
}
public static IReadOnlyIssue CreateIssue(IReadOnlyDictionary fields)
{
- var moq = new Mock(MockBehavior.Strict);
+ Mock moq = new Mock(MockBehavior.Strict);
FieldKey? tryGetFieldKey = null;
IField? tryGetResult = null;
@@ -58,7 +79,7 @@ public static IReadOnlyIssue CreateIssue(IReadOnlyDictionary f
moq.Setup(i => i[It.IsAny()]).Returns((FieldKey key) => fields[key]);
moq.Setup(i => i.TryGetValue(It.IsAny(), out tryGetResult))
- .Callback(new MockOutDelegate((FieldKey key, out IField output) =>
+ .Callback(new MockOutDelegate((key, out output) =>
{
tryGetFieldKey = key;
fields.TryGetValue(key, out tryGetResult);
@@ -70,48 +91,48 @@ public static IReadOnlyIssue CreateIssue(IReadOnlyDictionary f
{
return false;
}
+
return fields.ContainsKey(tryGetFieldKey.Value);
});
moq.Setup(i => i.GetEnumerator()).Returns(fields.GetEnumerator());
- foreach (var field in fields.Values)
+ foreach (IField field in fields.Values)
{
- if (field.Key == nameof(IIssue.Key))
+ if (field.Key == nameof(IReadOnlyIssue.Key))
+ {
moq.Setup(i => i.Key).Returns(IssueKey.Create(field.ToString()));
+ }
if (field.Key == nameof(IIssue.Title))
+ {
moq.Setup(i => i.Title).Returns(field.ToString() ?? string.Empty);
+ }
if (field.Key == nameof(IIssue.Description))
+ {
moq.Setup(i => i.Description).Returns(field.ToString() ?? string.Empty);
+ }
if (field.Key == nameof(IIssue.Created))
+ {
moq.Setup(i => i.Created).Returns(DateTime.Parse(field.ToString() ?? string.Empty));
+ }
if (field.Key == nameof(IIssue.Updated))
+ {
moq.Setup(i => i.Updated).Returns(DateTime.Parse(field.ToString() ?? string.Empty));
+ }
}
return moq.Object;
}
- public static IReadOnlyIssue Issue
+ public static IssueKey CreateIssueKey()
{
- get
- {
- var moq = new Mock(MockBehavior.Strict);
- return moq.Object;
- }
+ return IssueKey.Create(Helpers.GetRandomString());
}
- public static IIssueManager IssueManager
- {
- get
- {
- var moq = new Mock(MockBehavior.Strict);
- return moq.Object;
- }
- }
+ private delegate void MockOutDelegate(T1 s, out T2 value);
}
-}
+}
\ No newline at end of file
diff --git a/src/GitIssue.Tests/SyncTests/FileSyncTests.cs b/src/GitIssue.Tests/SyncTests/FileSyncTests.cs
index 32b8bfa..1bb60b5 100644
--- a/src/GitIssue.Tests/SyncTests/FileSyncTests.cs
+++ b/src/GitIssue.Tests/SyncTests/FileSyncTests.cs
@@ -5,6 +5,5 @@ namespace GitIssue.Tests.SyncTests
[TestFixture]
public partial class FileSyncTests : IssueManagerTests.IssueManagerTests
{
-
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tests/SyncTests/FileSyncTests_Import.cs b/src/GitIssue.Tests/SyncTests/FileSyncTests_Import.cs
index 69f0085..2a4be92 100644
--- a/src/GitIssue.Tests/SyncTests/FileSyncTests_Import.cs
+++ b/src/GitIssue.Tests/SyncTests/FileSyncTests_Import.cs
@@ -14,18 +14,14 @@ public class Import : FileSyncTests
[Test]
public async Task ImportsIssue()
{
- var issue_file = Path.Combine(TestContext.CurrentContext.TestDirectory,
+ string issue_file = Path.Combine(TestContext.CurrentContext.TestDirectory,
"SyncTests", "ImportFiles", "jira-issue.json");
- var config_file = Path.Combine(TestContext.CurrentContext.TestDirectory,
+ string config_file = Path.Combine(TestContext.CurrentContext.TestDirectory,
"SyncTests", "ImportFiles", "jira-config.json");
- Initialize(TestDirectory);
- var importer = new FileImporter(this.Sut)
- {
- Configuration = await SyncConfiguration.ReadAsync(config_file),
- ImportPath = issue_file,
- };
+ this.Initialize(this.TestDirectory);
+ FileImporter importer = new FileImporter(this.Sut) { Configuration = await SyncConfiguration.ReadAsync(config_file), ImportPath = issue_file };
await importer.Import();
}
}
diff --git a/src/GitIssue.Tests/SyncTests/ImportFiles/jira-issues.json b/src/GitIssue.Tests/SyncTests/ImportFiles/jira-issues.json
index b66c6ea..5cf4418 100644
--- a/src/GitIssue.Tests/SyncTests/ImportFiles/jira-issues.json
+++ b/src/GitIssue.Tests/SyncTests/ImportFiles/jira-issues.json
@@ -3,7 +3,7 @@
"externalName" : "Project Name",
"name" : "Project Name",
"key" : "PNKEY",
- "lead" : "lennonco",
+ "lead" : "Bob",
"type" : "software",
"assigneeType" : 3,
"versions" : [ {
diff --git a/src/GitIssue.Tests/SyncTests/SyncConfigurationTests.cs b/src/GitIssue.Tests/SyncTests/SyncConfigurationTests.cs
index a8779df..1b589e9 100644
--- a/src/GitIssue.Tests/SyncTests/SyncConfigurationTests.cs
+++ b/src/GitIssue.Tests/SyncTests/SyncConfigurationTests.cs
@@ -3,8 +3,7 @@
namespace GitIssue.Tests.SyncTests
{
[TestFixture]
- public partial class SyncConfigurationTests
+ public class SyncConfigurationTests
{
-
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tests/TestBase.cs b/src/GitIssue.Tests/TestBase.cs
index 18eca89..69fdb1f 100644
--- a/src/GitIssue.Tests/TestBase.cs
+++ b/src/GitIssue.Tests/TestBase.cs
@@ -4,34 +4,17 @@
namespace GitIssue.Tests
{
-
public class TestsBase
{
- [SetUp]
- public virtual void Setup()
- {
- TestDirectory = Helpers.GetTempDirectory();
- if (Directory.Exists(TestDirectory) == false) Directory.CreateDirectory(TestDirectory);
- }
-
- protected virtual string TestDirectory { get; set; } = Helpers.GetTestDirectory();
+ protected virtual string ConfigFile => Path.Combine(this.IssueDirectory, Paths.ConfigFileName);
- protected virtual string GitDirectory => Path.Combine(TestDirectory, Paths.GitFolderName);
+ protected virtual string GitDirectory => Path.Combine(this.TestDirectory, Paths.GitFolderName);
- protected virtual string IssueDirectory => Path.Combine(TestDirectory, Paths.IssueRootFolderName);
-
- protected virtual string ConfigFile => Path.Combine(IssueDirectory, Paths.ConfigFileName);
+ protected virtual string IssueDirectory => Path.Combine(this.TestDirectory, Paths.IssueRootFolderName);
protected virtual IIssueManager Manager { get; set; } = null!;
- [OneTimeSetUp]
- public virtual void OneTimeSetup()
- {
- TestDirectory = Helpers.GetTestDirectory();
- if (Directory.Exists(TestDirectory))
- Directory.Delete(TestDirectory, true);
- Directory.CreateDirectory(TestDirectory);
- }
+ protected virtual string TestDirectory { get; set; } = Helpers.GetTestDirectory();
public void Initialize(
string directory,
@@ -39,9 +22,20 @@ public void Initialize(
bool initIssue = true,
bool initSut = true)
{
- if (initGit) Repository.Init(directory);
- if (initIssue) GitIssue.IssueManager.Init(directory);
- if (initSut) Manager = GitIssue.IssueManager.Open(TestDirectory);
+ if (initGit)
+ {
+ Repository.Init(directory);
+ }
+
+ if (initIssue)
+ {
+ IssueManager.Init(directory);
+ }
+
+ if (initSut)
+ {
+ this.Manager = IssueManager.Open(this.TestDirectory);
+ }
}
public void Initialize(
@@ -51,9 +45,42 @@ public void Initialize(
bool initIssue = true,
bool initSut = true)
{
- if (initGit) Repository.Init(directory);
- if (initIssue) IssueManager.Init(directory, name);
- if (initSut) Manager = IssueManager.Open(TestDirectory, name);
+ if (initGit)
+ {
+ Repository.Init(directory);
+ }
+
+ if (initIssue)
+ {
+ IssueManager.Init(directory, name);
+ }
+
+ if (initSut)
+ {
+ this.Manager = IssueManager.Open(this.TestDirectory, name);
+ }
+ }
+
+ [OneTimeSetUp]
+ public virtual void OneTimeSetup()
+ {
+ this.TestDirectory = Helpers.GetTestDirectory();
+ if (Directory.Exists(this.TestDirectory))
+ {
+ Directory.Delete(this.TestDirectory, true);
+ }
+
+ Directory.CreateDirectory(this.TestDirectory);
+ }
+
+ [SetUp]
+ public virtual void Setup()
+ {
+ this.TestDirectory = Helpers.GetTempDirectory();
+ if (!Directory.Exists(this.TestDirectory))
+ {
+ Directory.CreateDirectory(this.TestDirectory);
+ }
}
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tests/ValueTests/EmailValueTests.cs b/src/GitIssue.Tests/ValueTests/EmailValueTests.cs
index ceaec11..ccd30e6 100644
--- a/src/GitIssue.Tests/ValueTests/EmailValueTests.cs
+++ b/src/GitIssue.Tests/ValueTests/EmailValueTests.cs
@@ -14,13 +14,13 @@ public class TypeConverter : EmailValueTests
[TestCaseSource(typeof(CanConvertTestCases))]
public bool CanConvert(Type type)
{
- return HasConverter(type);
+ return this.HasConverter(type);
}
[TestCaseSource(typeof(ConvertFromStringTestCases))]
public Email Convert(object value)
{
- return (Email)UseConverter(value);
+ return (Email)this.UseConverter(value);
}
public class CanConvertTestCases : ValueTestCases
@@ -56,7 +56,7 @@ public class TryParse : EmailValueTests
[TestCaseSource(typeof(TryParseTestCases))]
public bool Test(string value, Email expected)
{
- if (Email.TryParse(value, out var result))
+ if (Email.TryParse(value, out Email result))
{
Assert.That(expected, Is.EqualTo(result));
return true;
diff --git a/src/GitIssue.Tests/ValueTests/LabelValueTests.cs b/src/GitIssue.Tests/ValueTests/LabelValueTests.cs
index 2b71174..5b2681b 100644
--- a/src/GitIssue.Tests/ValueTests/LabelValueTests.cs
+++ b/src/GitIssue.Tests/ValueTests/LabelValueTests.cs
@@ -14,13 +14,13 @@ public class TypeConverter : LabelValueTests
[TestCaseSource(typeof(CanConvertTestCases))]
public bool CanConvert(Type type)
{
- return HasConverter(type);
+ return this.HasConverter(type);
}
[TestCaseSource(typeof(ConvertFromStringTestCases))]
public Label Convert(object value)
{
- return (Label)UseConverter(value);
+ return (Label)this.UseConverter(value);
}
public class CanConvertTestCases : ValueTestCases
@@ -65,7 +65,7 @@ public class TryParse : LabelValueTests
[TestCaseSource(typeof(TryParseTestCases))]
public bool Test(string value, Label expected)
{
- if (Label.TryParse(value, out var result))
+ if (Label.TryParse(value, out Label result))
{
Assert.That(expected, Is.EqualTo(result));
return true;
diff --git a/src/GitIssue.Tests/ValueTests/NumberValueTests.cs b/src/GitIssue.Tests/ValueTests/NumberValueTests.cs
index 962ea21..9906de4 100644
--- a/src/GitIssue.Tests/ValueTests/NumberValueTests.cs
+++ b/src/GitIssue.Tests/ValueTests/NumberValueTests.cs
@@ -14,13 +14,13 @@ public class TypeConverter : NumberValueTests
[TestCaseSource(typeof(CanConvertTestCases))]
public bool CanConvert(Type type)
{
- return HasConverter(type);
+ return this.HasConverter(type);
}
[TestCaseSource(typeof(ConvertFromStringTestCases))]
public Number Convert(object value)
{
- return (Number)UseConverter(value);
+ return (Number)this.UseConverter(value);
}
public class CanConvertTestCases : ValueTestCases
@@ -76,7 +76,7 @@ public class TryParse : NumberValueTests
[TestCaseSource(typeof(TryParseTestCases))]
public bool Test(string value, Number expected)
{
- if (Number.TryParse(value, out var result))
+ if (Number.TryParse(value, out Number result))
{
Assert.That(expected, Is.EqualTo(result));
return true;
diff --git a/src/GitIssue.Tests/ValueTests/SignatureValueTests.cs b/src/GitIssue.Tests/ValueTests/SignatureValueTests.cs
index 2f6e000..ee2415d 100644
--- a/src/GitIssue.Tests/ValueTests/SignatureValueTests.cs
+++ b/src/GitIssue.Tests/ValueTests/SignatureValueTests.cs
@@ -14,13 +14,13 @@ public class TypeConverter : SignatureValueTests
[TestCaseSource(typeof(CanConvertTestCases))]
public bool CanConvert(Type type)
{
- return HasConverter(type);
+ return this.HasConverter(type);
}
[TestCaseSource(typeof(ConvertFromStringTestCases))]
public Signature Convert(object value)
{
- return (Signature)UseConverter(value);
+ return (Signature)this.UseConverter(value);
}
public class CanConvertTestCases : ValueTestCases
@@ -56,7 +56,7 @@ public class TryParse : SignatureValueTests
[TestCaseSource(typeof(TryParseTestCases))]
public bool Test(string value, Signature expected)
{
- if (Signature.TryParse(value, out var result))
+ if (Signature.TryParse(value, out Signature result))
{
Assert.That(expected, Is.EqualTo(result));
return true;
diff --git a/src/GitIssue.Tests/ValueTests/StringValueTests.cs b/src/GitIssue.Tests/ValueTests/StringValueTests.cs
index 6bb96d2..5fc8615 100644
--- a/src/GitIssue.Tests/ValueTests/StringValueTests.cs
+++ b/src/GitIssue.Tests/ValueTests/StringValueTests.cs
@@ -15,13 +15,13 @@ public class TypeConverter : StringValueTests
[TestCaseSource(typeof(CanConvertTestCases))]
public bool CanConvert(Type type)
{
- return HasConverter(type);
+ return this.HasConverter(type);
}
[TestCaseSource(typeof(ConvertFromStringTestCases))]
public String Convert(object value)
{
- return (String)UseConverter(value);
+ return (String)this.UseConverter(value);
}
public class CanConvertTestCases : ValueTestCases
@@ -57,7 +57,7 @@ public class TryParse : StringValueTests
[TestCaseSource(typeof(TryParseTestCases))]
public bool Test(string value, String expected)
{
- if (String.TryParse(value, out var result))
+ if (String.TryParse(value, out String result))
{
Assert.That(expected, Is.EqualTo(result));
return true;
@@ -80,7 +80,7 @@ public override IEnumerator GetEnumerator()
[TestFixture]
public class Item : StringValueTests
{
- [TestCaseSource(typeof(Item.GetItemTestCases))]
+ [TestCaseSource(typeof(GetItemTestCases))]
public string Tests(String str)
{
return base.GetItem(str);
@@ -100,7 +100,7 @@ public override IEnumerator GetEnumerator()
[TestFixture]
public class ToJson : StringValueTests
{
- [TestCaseSource(typeof(ToJson.ConvertToJsonTestCases))]
+ [TestCaseSource(typeof(ConvertToJsonTestCases))]
public string Tests(String str)
{
return base.ConvertToJson(str);
@@ -120,7 +120,7 @@ public override IEnumerator GetEnumerator()
[TestFixture]
public new class Equals : StringValueTests
{
- [TestCaseSource(typeof(Equals.EqualsTestCases))]
+ [TestCaseSource(typeof(EqualsTestCases))]
public bool Tests(object first, object second)
{
return base.Equals(first, second);
diff --git a/src/GitIssue.Tests/ValueTests/UrlTestCases.cs b/src/GitIssue.Tests/ValueTests/UrlTestCases.cs
index 17ea660..fb49a47 100644
--- a/src/GitIssue.Tests/ValueTests/UrlTestCases.cs
+++ b/src/GitIssue.Tests/ValueTests/UrlTestCases.cs
@@ -14,13 +14,13 @@ public class TypeConverter : UrlValueTests
[TestCaseSource(typeof(CanConvertTestCases))]
public bool CanConvert(Type type)
{
- return HasConverter(type);
+ return this.HasConverter(type);
}
[TestCaseSource(typeof(ConvertFromStringTestCases))]
public Url Convert(object value)
{
- return (Url)UseConverter(value);
+ return (Url)this.UseConverter(value);
}
public class CanConvertTestCases : ValueTestCases
@@ -56,7 +56,7 @@ public class TryParse : UrlValueTests
[TestCaseSource(typeof(TryParseTestCases))]
public bool Test(string value, Url expected)
{
- if (Url.TryParse(value, out var result))
+ if (Url.TryParse(value, out Url result))
{
Assert.That(expected, Is.EqualTo(result));
return true;
diff --git a/src/GitIssue.Tests/ValueTests/ValueTests.cs b/src/GitIssue.Tests/ValueTests/ValueTests.cs
index 271b9e4..886822c 100644
--- a/src/GitIssue.Tests/ValueTests/ValueTests.cs
+++ b/src/GitIssue.Tests/ValueTests/ValueTests.cs
@@ -10,45 +10,45 @@ namespace GitIssue.Tests.ValueTests
{
public abstract class ValueTests where TValue : IValue
{
+ public new virtual bool Equals(object first, object second)
+ {
+ bool objEquals = first.Equals(second);
+ bool hashEquals = first?.GetHashCode() == second?.GetHashCode();
+ Assert.That(objEquals, Is.EqualTo(hashEquals));
+ return objEquals;
+ }
+
public bool HasConverter(Type type)
{
- var converter = TypeDescriptor.GetConverter(typeof(TValue));
+ TypeConverter converter = TypeDescriptor.GetConverter(typeof(TValue));
return converter.CanConvertFrom(type);
}
public bool HasConverter()
{
- return HasConverter(typeof(TIn));
+ return this.HasConverter(typeof(TIn));
}
public object UseConverter(object input)
{
- var converter = TypeDescriptor.GetConverter(typeof(TValue));
+ TypeConverter converter = TypeDescriptor.GetConverter(typeof(TValue));
if (converter.CanConvertFrom(input.GetType()))
{
- var result = converter.ConvertFrom(input);
- if(result != null)
+ object? result = converter.ConvertFrom(input);
+ if (result != null)
{
return result;
}
}
+
Assert.Fail($"Failed to convert from {input.GetType()} to {typeof(TValue)}");
- return default!;
+ return default(object)!;
}
public TValue UseConverter(TIn input)
{
- return (TValue)UseConverter((object)input!);
+ return (TValue)this.UseConverter((object)input!);
}
-
- public new virtual bool Equals(object first, object second)
- {
- var objEquals = first.Equals(second);
- var hashEquals = first?.GetHashCode() == second?.GetHashCode();
- Assert.That(objEquals, Is.EqualTo(hashEquals));
- return objEquals;
- }
-
}
public abstract class ValueTests : ValueTests
@@ -84,7 +84,7 @@ public abstract class ValueTestCases : IEnumerable
IEnumerator IEnumerable.GetEnumerator()
{
- return GetEnumerator();
+ return this.GetEnumerator();
}
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/App.config b/src/GitIssue.Tool/App.config
deleted file mode 100644
index d474aa7..0000000
--- a/src/GitIssue.Tool/App.config
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Add/AddCommand.cs b/src/GitIssue.Tool/Commands/Add/AddCommand.cs
index 8006b5b..a369c33 100644
--- a/src/GitIssue.Tool/Commands/Add/AddCommand.cs
+++ b/src/GitIssue.Tool/Commands/Add/AddCommand.cs
@@ -4,6 +4,7 @@
using GitIssue.Fields;
using GitIssue.Fields.Array;
using GitIssue.Formatters;
+using GitIssue.Issues;
using Serilog;
namespace GitIssue.Tool.Commands.Add
@@ -26,9 +27,9 @@ public AddCommand(IIssueManager manager, ILogger logger)
///
public override async Task Exec(AddOptions options)
{
- var formatter = IssueFormatter.Simple;
+ IssueFormatter formatter = IssueFormatter.Simple;
- var issue = await manager
+ IIssue? issue = await this.manager
.FindAsync(i => i.Key.ToString() == options.Key)
.FirstOrDefaultAsync();
@@ -44,17 +45,17 @@ public override async Task Exec(AddOptions options)
return;
}
- var key = FieldKey.Create(options.Field);
+ FieldKey key = FieldKey.Create(options.Field);
if (!issue.ContainsKey(key))
{
this.logger?.Error($"Field \"{key}\" does not exist on issue \"{issue.Key}\"");
return;
}
- var field = issue[key];
+ IField field = issue[key];
if (field is IArrayField arrayField)
{
- if (arrayField.TryParse(options.Add, out var value))
+ if (arrayField.TryParse(options.Add, out object? value))
{
if (!arrayField.Contains(value))
{
diff --git a/src/GitIssue.Tool/Commands/Add/AddOptions.cs b/src/GitIssue.Tool/Commands/Add/AddOptions.cs
index 2671089..63af4c2 100644
--- a/src/GitIssue.Tool/Commands/Add/AddOptions.cs
+++ b/src/GitIssue.Tool/Commands/Add/AddOptions.cs
@@ -6,11 +6,11 @@ namespace GitIssue.Tool.Commands.Add
[Verb(nameof(CommandType.Add), HelpText = "Add a value to an existing field on an existing issue")]
public class AddOptions : EditorOptions
{
- [Value(2, MetaName = "Field Key", HelpText = "The field to edit", Required = false)]
- public string Field { get; set; } = string.Empty;
-
[Value(3, MetaName = "Value", HelpText = "The text to update the field with", Required = false)]
public string Add { get; set; } = string.Empty;
+
+ [Value(2, MetaName = "Field Key", HelpText = "The field to edit", Required = false)]
+ public string Field { get; set; } = string.Empty;
}
#pragma warning restore 1591
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Changes/ChangesCommand.cs b/src/GitIssue.Tool/Commands/Changes/ChangesCommand.cs
index 0774d15..9ecbc99 100644
--- a/src/GitIssue.Tool/Commands/Changes/ChangesCommand.cs
+++ b/src/GitIssue.Tool/Commands/Changes/ChangesCommand.cs
@@ -25,7 +25,7 @@ public ChangesCommand(IIssueManager manager, ILogger logger)
///
public override Task Exec(ChangesOptions options)
{
- Console.Write(manager.Changes.GenerateComments());
+ Console.Write(this.manager.Changes.GenerateComments());
return Task.CompletedTask;
}
}
diff --git a/src/GitIssue.Tool/Commands/Changes/ChangesOptions.cs b/src/GitIssue.Tool/Commands/Changes/ChangesOptions.cs
index e863758..6dd9a6e 100644
--- a/src/GitIssue.Tool/Commands/Changes/ChangesOptions.cs
+++ b/src/GitIssue.Tool/Commands/Changes/ChangesOptions.cs
@@ -6,7 +6,6 @@ namespace GitIssue.Tool.Commands.Changes
[Verb(nameof(CommandType.Changes), HelpText = "Shows the change log")]
public class ChangesOptions : Options
{
-
}
#pragma warning restore 1591
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/CommandType.cs b/src/GitIssue.Tool/Commands/CommandType.cs
index 28e710a..16516b8 100644
--- a/src/GitIssue.Tool/Commands/CommandType.cs
+++ b/src/GitIssue.Tool/Commands/CommandType.cs
@@ -84,6 +84,6 @@ public enum CommandType
///
/// Shows the current status
///
- Changes
+ Changes,
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Comment/CommentCommand.cs b/src/GitIssue.Tool/Commands/Comment/CommentCommand.cs
index 1c54e35..eb5efd1 100644
--- a/src/GitIssue.Tool/Commands/Comment/CommentCommand.cs
+++ b/src/GitIssue.Tool/Commands/Comment/CommentCommand.cs
@@ -3,6 +3,7 @@
using System.Threading.Tasks;
using GitIssue.Fields;
using GitIssue.Fields.Array;
+using GitIssue.Issues;
using Serilog;
using String = GitIssue.Values.String;
@@ -13,12 +14,12 @@ namespace GitIssue.Tool.Commands.Comment
///
public class CommentCommand : Command
{
- private readonly static string CommentField = "Comments";
-
- private readonly ILogger logger;
+ private static readonly string CommentField = "Comments";
private readonly IEditor editor;
+ private readonly ILogger logger;
+
private readonly IIssueManager manager;
public CommentCommand(IIssueManager manager, IEditor editor, ILogger logger)
@@ -31,9 +32,9 @@ public CommentCommand(IIssueManager manager, IEditor editor, ILogger logger)
///
public override async Task Exec(CommentOptions options)
{
- var formatter = TerminalFormatter.Detailed;
+ TerminalFormatter formatter = TerminalFormatter.Detailed;
- var issue = await manager
+ IIssue? issue = await this.manager
.FindAsync(i => i.Key.ToString() == options.Key)
.FirstOrDefaultAsync();
@@ -45,7 +46,7 @@ public override async Task Exec(CommentOptions options)
if (string.IsNullOrEmpty(options.Comment))
{
- options.Comment = await editor.Edit($"Add a comment to {issue.Key} below", "");
+ options.Comment = await this.editor.Edit($"Add a comment to {issue.Key} below", "");
}
if (string.IsNullOrEmpty(options.Comment))
@@ -54,12 +55,12 @@ public override async Task Exec(CommentOptions options)
return;
}
- var key = FieldKey.Create(CommentField);
- if (issue.TryGetValue(key, out var field))
+ FieldKey key = FieldKey.Create(CommentCommand.CommentField);
+ if (issue.TryGetValue(key, out IField? field))
{
if (field is IArrayField arrayField)
{
- if (arrayField.TryParse(options.Comment, out var value))
+ if (arrayField.TryParse(options.Comment, out object? value))
{
arrayField.Add(value);
await issue.SaveAsync();
@@ -69,6 +70,7 @@ public override async Task Exec(CommentOptions options)
{
this.logger?.Error($"Comment \"{options.Comment}\" is not valid");
}
+
arrayField.Add(String.Parse(options.Comment));
}
}
diff --git a/src/GitIssue.Tool/Commands/Commit/CommitCommand.cs b/src/GitIssue.Tool/Commands/Commit/CommitCommand.cs
index dc2079b..06a8265 100644
--- a/src/GitIssue.Tool/Commands/Commit/CommitCommand.cs
+++ b/src/GitIssue.Tool/Commands/Commit/CommitCommand.cs
@@ -22,10 +22,10 @@ public CommitCommand(IIssueManager manager, ILogger logger)
///
public override async Task Exec(CommitOptions options)
{
- var result = await manager.CommitAsync();
+ bool result = await this.manager.CommitAsync();
if (result)
{
- Console.WriteLine($"Committed changes in {manager.Root.Name}, see log for details");
+ Console.WriteLine($"Committed changes in {this.manager.Root.Name}, see log for details");
}
}
}
diff --git a/src/GitIssue.Tool/Commands/Create/CreateCommand.cs b/src/GitIssue.Tool/Commands/Create/CreateCommand.cs
index 7b4974d..3c943e6 100644
--- a/src/GitIssue.Tool/Commands/Create/CreateCommand.cs
+++ b/src/GitIssue.Tool/Commands/Create/CreateCommand.cs
@@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using GitIssue.Fields;
using GitIssue.Fields.Value;
using GitIssue.Formatters;
using GitIssue.Issues;
@@ -15,15 +16,14 @@ namespace GitIssue.Tool.Commands.Create
///
public class CreateCommand : Command
{
- private Lazy formatter = new Lazy(() => IssueFormatter.Detailed);
-
- private readonly ILogger logger;
+ private readonly IIssueConfiguration configuration;
private readonly IEditor editor;
- private readonly IIssueManager manager;
+ private readonly ILogger logger;
- private readonly IIssueConfiguration configuration;
+ private readonly IIssueManager manager;
+ private Lazy formatter = new Lazy(() => IssueFormatter.Detailed);
public CreateCommand(IIssueManager manager, IIssueConfiguration configuration, IEditor editor, ILogger logger)
{
@@ -39,18 +39,18 @@ public override async Task Exec(CreateOptions options)
IIssue issue;
if (string.IsNullOrEmpty(options.Title))
{
- var fields = this.configuration.Fields
- .Where(f => f.Key != nameof(IIssue.Key))
+ IField[] fields = this.configuration.Fields
+ .Where(f => f.Key != nameof(IReadOnlyIssue.Key))
.Where(f => f.Key != nameof(IIssue.Created))
.Where(f => f.Key != nameof(IIssue.Updated))
.Select(f => f.Value.CreateField(null!, f.Key))
.ToArray();
- await editor.Open(fields);
+ await this.editor.Open(fields);
if (!(fields.FirstOrDefault(f => f.Key == nameof(IIssue.Title)) is IValueField title))
{
- this.logger.Error($"Title is not a valid value field");
+ this.logger.Error("Title is not a valid value field");
return;
}
@@ -62,21 +62,21 @@ public override async Task Exec(CreateOptions options)
if (string.IsNullOrEmpty(value.Item))
{
- this.logger.Error($"A valid title must be provided");
+ this.logger.Error("A valid title must be provided");
}
- issue = await manager.CreateAsync(value.Item);
- foreach (var field in fields)
+ issue = await this.manager.CreateAsync(value.Item);
+ foreach (IField field in fields)
{
issue.SetField(field.Key).WithField(field);
}
}
else
{
- issue = await manager.CreateAsync(options.Title, options.Description);
+ issue = await this.manager.CreateAsync(options.Title, options.Description);
}
- if (options.Track || options.Tracked == TrackedIssue.None)
+ if (options.Track || (options.Tracked == TrackedIssue.None))
{
options.Tracked = new TrackedIssue(issue.Key);
await options.Tracked.SaveAsync(Path.Combine(options.Path, options.Name, options.Tracking), this.logger);
diff --git a/src/GitIssue.Tool/Commands/Create/CreateOptions.cs b/src/GitIssue.Tool/Commands/Create/CreateOptions.cs
index 92a6dce..bf8d6d6 100644
--- a/src/GitIssue.Tool/Commands/Create/CreateOptions.cs
+++ b/src/GitIssue.Tool/Commands/Create/CreateOptions.cs
@@ -6,14 +6,14 @@ namespace GitIssue.Tool.Commands.Create
[Verb(nameof(CommandType.Create), HelpText = "Creates a new issue")]
public class CreateOptions : EditorOptions, ITrackedOptions
{
- [Option("Track", HelpText = "Track the new issue, even if another issue is already tracked", Required = false)]
- public bool Track { get; set; } = false;
+ [Value(2, MetaName = "Description", HelpText = "The issue description", Required = false)]
+ public string Description { get; set; } = string.Empty;
[Value(1, MetaName = "Title", HelpText = "The issue title", Required = false)]
public string Title { get; set; } = string.Empty;
- [Value(2, MetaName = "Description", HelpText = "The issue description", Required = false)]
- public string Description { get; set; } = string.Empty;
+ [Option("Track", HelpText = "Track the new issue, even if another issue is already tracked", Required = false)]
+ public bool Track { get; set; } = false;
}
#pragma warning restore 1591
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Delete/DeleteCommand.cs b/src/GitIssue.Tool/Commands/Delete/DeleteCommand.cs
index 4bf99df..0e9fd41 100644
--- a/src/GitIssue.Tool/Commands/Delete/DeleteCommand.cs
+++ b/src/GitIssue.Tool/Commands/Delete/DeleteCommand.cs
@@ -24,7 +24,7 @@ public DeleteCommand(IIssueManager manager, ILogger logger)
///
public override async Task Exec(DeleteOptions options)
{
- var result = await manager.DeleteAsync(options.Key);
+ bool result = await this.manager.DeleteAsync(options.Key);
if (result)
{
Console.WriteLine($"Deleted issue '{options.Key}'");
diff --git a/src/GitIssue.Tool/Commands/Edit/EditCommand.cs b/src/GitIssue.Tool/Commands/Edit/EditCommand.cs
index fd76f1b..db7239a 100644
--- a/src/GitIssue.Tool/Commands/Edit/EditCommand.cs
+++ b/src/GitIssue.Tool/Commands/Edit/EditCommand.cs
@@ -3,6 +3,7 @@
using System.Threading.Tasks;
using GitIssue.Fields;
using GitIssue.Formatters;
+using GitIssue.Issues;
using LibGit2Sharp;
using Serilog;
@@ -13,9 +14,8 @@ namespace GitIssue.Tool.Commands.Edit
///
public class EditCommand : Command
{
- private readonly ILogger logger;
-
private readonly IEditor editor;
+ private readonly ILogger logger;
private readonly IIssueManager manager;
@@ -26,18 +26,12 @@ public EditCommand(IIssueManager manager, IEditor editor, ILogger logger)
this.logger = logger;
}
- private static bool TryGetEditor(IRepository repository, string key, out string config)
- {
- config = repository.Config.GetValueOrDefault(key);
- return string.IsNullOrEmpty(config) == false;
- }
-
///
public override async Task Exec(EditOptions options)
{
- var formatter = TerminalFormatter.Detailed;
+ TerminalFormatter formatter = TerminalFormatter.Detailed;
- var issue = await manager
+ IIssue? issue = await this.manager
.FindAsync(i => i.Key.ToString() == options.Key)
.FirstOrDefaultAsync();
@@ -47,26 +41,30 @@ public override async Task Exec(EditOptions options)
return;
}
- if (TryGetEditor(manager.Repository, "issues.editor", out string config))
+ if (EditCommand.TryGetEditor(this.manager.Repository, "issues.editor", out string config))
{
options.Editor = config;
}
- var updated = false;
+ bool updated = false;
if (string.IsNullOrEmpty(options.Field))
{
- await editor.Open(issue);
+ await this.editor.Open(issue);
updated = true;
}
if (updated)
{
issue.Updated = DateTime.Now;
- if (await issue.SaveAsync()) Console.WriteLine(issue.Format(formatter));
+ if (await issue.SaveAsync())
+ {
+ Console.WriteLine(issue.Format(formatter));
+ }
+
return;
}
- var key = FieldKey.Create(options.Field);
+ FieldKey key = FieldKey.Create(options.Field);
if (!issue.ContainsKey(key))
{
this.logger.Error($"Field \"{key}\" does not exist on issue \"{issue.Key}\"");
@@ -75,7 +73,7 @@ public override async Task Exec(EditOptions options)
if (string.IsNullOrEmpty(options.Update))
{
- await editor.Open(issue[key]);
+ await this.editor.Open(issue[key]);
updated = true;
}
else if (issue[key].Update(options.Update))
@@ -86,8 +84,17 @@ public override async Task Exec(EditOptions options)
if (updated)
{
issue.Updated = DateTime.Now;
- if (await issue.SaveAsync()) Console.WriteLine(issue.Format(formatter));
+ if (await issue.SaveAsync())
+ {
+ Console.WriteLine(issue.Format(formatter));
+ }
}
}
+
+ private static bool TryGetEditor(IRepository repository, string key, out string config)
+ {
+ config = repository.Config.GetValueOrDefault(key);
+ return !string.IsNullOrEmpty(config);
+ }
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Export/ExportCommand.cs b/src/GitIssue.Tool/Commands/Export/ExportCommand.cs
index 963cc35..9c8dbe6 100644
--- a/src/GitIssue.Tool/Commands/Export/ExportCommand.cs
+++ b/src/GitIssue.Tool/Commands/Export/ExportCommand.cs
@@ -1,7 +1,10 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
+using GitIssue.Fields;
+using GitIssue.Issues;
using GitIssue.Issues.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -30,80 +33,84 @@ public override async Task Exec(ExportOptions options)
switch (Path.GetExtension(options.Export))
{
case ".json":
- await exportJson(options);
+ await this.exportJson(options);
break;
case ".csv":
- await exportCsv(options);
+ await this.exportCsv(options);
break;
}
}
- public async Task exportJson(ExportOptions options)
- {
- if (File.Exists(options.Export) && options.Overwrite == false)
- {
- this.logger.Error($"Export file {options.Export} exists, use '{nameof(ExportOptions.Overwrite)}' to force");
- return;
- }
-
- JObject json = new JObject();
- await foreach (var issue in manager.FindAsync(i => true))
- {
- if (issue is IJsonIssue jsonIssue)
- {
- json[issue.Key] = jsonIssue.ToJson();
- }
- }
-
- await using var stream = new FileStream(options.Export, FileMode.Create, FileAccess.ReadWrite);
- using JsonWriter writer = new JsonTextWriter(new StreamWriter(stream));
- var serializer = new JsonSerializer();
- serializer.Formatting = Formatting.Indented;
- serializer.Serialize(writer, json);
-
- Console.WriteLine($"Exported {json.Count} issues to {options.Export}");
- }
-
public async Task exportCsv(ExportOptions options)
{
- if (File.Exists(options.Export) && options.Overwrite == false)
+ if (File.Exists(options.Export) && !options.Overwrite)
{
this.logger.Error($"Export file {options.Export} exists, use '{nameof(ExportOptions.Overwrite)}' to force");
return;
}
- await using var stream = new FileStream(options.Export, FileMode.Create, FileAccess.ReadWrite);
+ await using FileStream stream = new FileStream(options.Export, FileMode.Create, FileAccess.ReadWrite);
using TextWriter writer = new StreamWriter(stream);
StringBuilder builder = new StringBuilder();
- foreach (var field in manager.Configuration.Fields)
+ foreach (KeyValuePair field in this.manager.Configuration.Fields)
{
if (builder.Length != 0)
{
builder.Append(options.Separator);
}
+
builder.Append(field.Key.ToString());
}
+
await writer.WriteLineAsync(builder.ToString());
int count = 0;
- await foreach (var issue in manager.FindAsync(i => true))
+ await foreach (IIssue issue in this.manager.FindAsync(i => true))
{
builder.Clear();
- foreach (var field in manager.Configuration.Fields)
+ foreach (KeyValuePair field in this.manager.Configuration.Fields)
{
if (builder.Length != 0)
{
builder.Append(options.Separator);
}
- builder.Append(issue[field.Key].ToString());
+
+ builder.Append(issue[field.Key]);
}
+
await writer.WriteLineAsync(builder.ToString());
count++;
}
Console.WriteLine($"Exported {count} issues to {options.Export}");
}
+
+ public async Task exportJson(ExportOptions options)
+ {
+ if (File.Exists(options.Export) && !options.Overwrite)
+ {
+ this.logger.Error($"Export file {options.Export} exists, use '{nameof(ExportOptions.Overwrite)}' to force");
+ return;
+ }
+
+ JObject json = new JObject();
+ await foreach (IIssue issue in this.manager.FindAsync(i => true))
+ {
+ if (issue is IJsonIssue jsonIssue)
+ {
+ json[issue.Key] = jsonIssue.ToJson();
+ }
+ }
+
+ await using FileStream stream = new FileStream(options.Export, FileMode.Create, FileAccess.ReadWrite);
+ using JsonWriter writer = new JsonTextWriter(new StreamWriter(stream));
+ JsonSerializer serializer = new JsonSerializer();
+ serializer.Formatting = Formatting.Indented;
+ serializer.Serialize(writer, json);
+
+ Console.WriteLine($"Exported {json.Count} issues to {options.Export}");
+ }
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Fields/FieldsCommand.cs b/src/GitIssue.Tool/Commands/Fields/FieldsCommand.cs
index 25a7acc..c0a76c1 100644
--- a/src/GitIssue.Tool/Commands/Fields/FieldsCommand.cs
+++ b/src/GitIssue.Tool/Commands/Fields/FieldsCommand.cs
@@ -1,6 +1,8 @@
using System;
+using System.Collections.Generic;
using System.Drawing;
using System.Threading.Tasks;
+using GitIssue.Fields;
using Pastel;
using Serilog;
@@ -24,11 +26,12 @@ public FieldsCommand(IIssueManager manager, ILogger logger)
///
public override Task Exec(FieldsOptions options)
{
- foreach (var kvp in manager.Configuration.Fields)
+ foreach (KeyValuePair kvp in this.manager.Configuration.Fields)
{
- var output = $"{kvp.Key.ToString().Pastel(Color.FromArgb(165, 229, 250))}: A '{kvp.Value.FieldType}' field with '{kvp.Value.ValueType}' values";
+ string output = $"{kvp.Key.ToString().Pastel(Color.FromArgb(165, 229, 250))}: A '{kvp.Value.FieldType}' field with '{kvp.Value.ValueType}' values";
Console.WriteLine(output);
}
+
return Task.CompletedTask;
}
}
diff --git a/src/GitIssue.Tool/Commands/Find/FindCommand.cs b/src/GitIssue.Tool/Commands/Find/FindCommand.cs
index 4df01d0..9650115 100644
--- a/src/GitIssue.Tool/Commands/Find/FindCommand.cs
+++ b/src/GitIssue.Tool/Commands/Find/FindCommand.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
using GitIssue.Formatters;
using GitIssue.Issues;
@@ -29,7 +30,7 @@ public override async Task Exec(FindOptions options)
Func issueFilter;
try
{
- var script = ScriptOptions.Default.AddReferences(typeof(Issue).Assembly);
+ ScriptOptions script = ScriptOptions.Default.AddReferences(typeof(Issue).Assembly);
issueFilter = await CSharpScript.EvaluateAsync>(options.Linq, script);
}
catch (Exception e)
@@ -38,9 +39,12 @@ public override async Task Exec(FindOptions options)
return;
}
- var formatter = new TerminalFormatter(options.Format);
- var find = manager.FindAsync(i => issueFilter.Invoke(i));
- await foreach (var issue in find) Console.WriteLine(issue.Format(formatter));
+ TerminalFormatter formatter = new TerminalFormatter(options.Format);
+ IAsyncEnumerable find = this.manager.FindAsync(i => issueFilter.Invoke(i));
+ await foreach (IIssue issue in find)
+ {
+ Console.WriteLine(issue.Format(formatter));
+ }
}
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Find/FindOptions.cs b/src/GitIssue.Tool/Commands/Find/FindOptions.cs
index d759291..0db6cdc 100644
--- a/src/GitIssue.Tool/Commands/Find/FindOptions.cs
+++ b/src/GitIssue.Tool/Commands/Find/FindOptions.cs
@@ -6,14 +6,14 @@ namespace GitIssue.Tool.Commands.Find
[Verb(nameof(CommandType.Find), HelpText = "Finds an existing issue")]
public class FindOptions : Options
{
- [Option("LinqName", HelpText = "The name of the issue in the linq expression", Required = false)]
- public string LinqName { get; set; } = "i";
-
[Option("Format", HelpText = "The format to output in", Required = false)]
public string Format { get; set; } = "%Key %Title %Delta";
[Value(1, MetaName = "LINQ", HelpText = "The LINQ expression to use when matching", Required = false)]
public string Linq { get; set; } = "i => true";
+
+ [Option("LinqName", HelpText = "The name of the issue in the linq expression", Required = false)]
+ public string LinqName { get; set; } = "i";
}
#pragma warning restore 1591
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Import/ImportCommand.cs b/src/GitIssue.Tool/Commands/Import/ImportCommand.cs
index d5f3166..d534acb 100644
--- a/src/GitIssue.Tool/Commands/Import/ImportCommand.cs
+++ b/src/GitIssue.Tool/Commands/Import/ImportCommand.cs
@@ -30,20 +30,20 @@ public override async Task Exec(ImportOptions options)
switch (Path.GetExtension(options.Import))
{
case ".csv":
- await importCsv(options);
+ await this.importCsv(options);
break;
}
}
public async Task importCsv(ImportOptions options)
{
- if (File.Exists(options.Import) == false)
+ if (!File.Exists(options.Import))
{
this.logger.Error($"Import file {options.Import} does not exist");
return;
}
- await using var stream = new FileStream(options.Import, FileMode.Open, FileAccess.Read);
+ await using FileStream stream = new FileStream(options.Import, FileMode.Open, FileAccess.Read);
using TextReader reader = new StreamReader(stream);
string? header = await reader.ReadLineAsync();
@@ -52,9 +52,9 @@ public async Task importCsv(ImportOptions options)
return;
}
- var fields = header.Split(options.Separator);
- var mapping = new Dictionary();
- foreach (var field in manager.Configuration.Fields)
+ string[] fields = header.Split(options.Separator);
+ Dictionary mapping = new Dictionary();
+ foreach (KeyValuePair field in this.manager.Configuration.Fields)
{
int? index = fields.Select((f, i) => new { Field = f, Index = i })
.Where(x => x.Field == field.Key.ToString())
@@ -67,15 +67,16 @@ public async Task importCsv(ImportOptions options)
}
}
- if (mapping.ContainsKey("Key") == false)
+ if (!mapping.ContainsKey("Key"))
{
return;
}
- foreach (var map in mapping)
+ foreach (KeyValuePair map in mapping)
{
Console.WriteLine($"[{map.Value}] => {map.Key}");
}
+
Console.WriteLine();
int count = 0;
@@ -87,23 +88,24 @@ public async Task importCsv(ImportOptions options)
break;
}
- var import = line.Split(options.Separator);
+ string[] import = line.Split(options.Separator);
if (import.Length != fields.Length)
{
continue;
}
IIssue? issue = null;
- await foreach (var found in manager.FindAsync(i => i.Key == import[mapping["Key"]]))
+ await foreach (IIssue found in this.manager.FindAsync(i => i.Key == import[mapping["Key"]]))
{
issue = found;
Console.WriteLine($"Updating {import[mapping["Key"]]}");
break;
}
+
if (issue == null)
{
Console.WriteLine($"Creating {import[mapping["Key"]]}");
- issue = await manager.CreateAsync(import[mapping["Title"]]);
+ issue = await this.manager.CreateAsync(import[mapping["Title"]]);
}
count++;
diff --git a/src/GitIssue.Tool/Commands/Init/InitCommand.cs b/src/GitIssue.Tool/Commands/Init/InitCommand.cs
index 4a22a7a..6c6b95b 100644
--- a/src/GitIssue.Tool/Commands/Init/InitCommand.cs
+++ b/src/GitIssue.Tool/Commands/Init/InitCommand.cs
@@ -11,10 +11,10 @@ public class InitCommand : Command
{
public delegate void Initializer();
- private readonly ILogger logger;
-
private readonly Func factory;
+ private readonly ILogger logger;
+
private readonly Action onInit;
public InitCommand(ILogger logger, Func factory, Initializer initializer)
@@ -28,7 +28,7 @@ public InitCommand(ILogger logger, Func factory, Initializer init
public override Task Exec(InitOptions options)
{
this.onInit();
- var manager = factory.Invoke();
+ IIssueManager manager = this.factory.Invoke();
Console.WriteLine($"Initialized empty 'Issue' repository in {manager.Root.IssuesPath}");
return Task.CompletedTask;
}
diff --git a/src/GitIssue.Tool/Commands/Options.cs b/src/GitIssue.Tool/Commands/Options.cs
index 33acef3..484e8ff 100644
--- a/src/GitIssue.Tool/Commands/Options.cs
+++ b/src/GitIssue.Tool/Commands/Options.cs
@@ -9,25 +9,24 @@ namespace GitIssue.Tool.Commands
public class Options
{
- [Option("path", Required = false, HelpText = "The path to the working directory")]
- public string Path { get; set; } = Environment.CurrentDirectory;
-
[Option("name", Required = false, HelpText = "The name of the issues folder")]
public string Name { get; set; } = ".issues";
+ [Option("path", Required = false, HelpText = "The path to the working directory")]
+ public string Path { get; set; } = Environment.CurrentDirectory;
+
[Option("tracking", Required = false, HelpText = "The tracking file to use")]
public string Tracking { get; set; } = "tracking.json";
}
public interface ITrackedOptions
{
- public string Path { get; set; }
-
- public string Name { get; set; }
+ string Name { get; set; }
+ string Path { get; set; }
TrackedIssue Tracked { get; set; }
- public string Tracking { get; set; }
+ string Tracking { get; set; }
}
public class KeyOptions : Options, ITrackedOptions
@@ -38,7 +37,7 @@ public class KeyOptions : Options, ITrackedOptions
string.Empty,
".",
"T",
- "Tracked"
+ "Tracked",
};
private string key = string.Empty;
@@ -48,11 +47,14 @@ public string Key
{
get
{
- if (tracking.Contains(key))
- return Tracked?.Key.ToString() ?? IssueKey.None.ToString();
- return key;
+ if (KeyOptions.tracking.Contains(this.key))
+ {
+ return this.Tracked?.Key.ToString() ?? IssueKey.None.ToString();
+ }
+
+ return this.key;
}
- set => key = value;
+ set => this.key = value;
}
///
@@ -63,11 +65,11 @@ public string Key
public class EditorOptions : KeyOptions
{
- [Option("editor", HelpText = "The editor to use", Required = false)]
- public string Editor { get; set; } = "joe";
-
[Option("arguments", HelpText = "Any additional arguments to give to the editor", Required = false)]
public string Arguments { get; set; } = "-pound_comment -syntax git-commit";
+
+ [Option("editor", HelpText = "The editor to use", Required = false)]
+ public string Editor { get; set; } = "joe";
}
#pragma warning restore 1591
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Remove/RemoveCommand.cs b/src/GitIssue.Tool/Commands/Remove/RemoveCommand.cs
index 2db178b..0d27cad 100644
--- a/src/GitIssue.Tool/Commands/Remove/RemoveCommand.cs
+++ b/src/GitIssue.Tool/Commands/Remove/RemoveCommand.cs
@@ -3,6 +3,7 @@
using System.Threading.Tasks;
using GitIssue.Fields;
using GitIssue.Fields.Array;
+using GitIssue.Issues;
using Serilog;
namespace GitIssue.Tool.Commands.Remove
@@ -25,9 +26,9 @@ public RemoveCommand(IIssueManager manager, ILogger logger)
///
public override async Task Exec(RemoveOptions options)
{
- var formatter = TerminalFormatter.Detailed;
+ TerminalFormatter formatter = TerminalFormatter.Detailed;
- var issue = await manager
+ IIssue? issue = await this.manager
.FindAsync(i => i.Key.ToString() == options.Key)
.FirstOrDefaultAsync();
@@ -43,17 +44,17 @@ public override async Task Exec(RemoveOptions options)
return;
}
- var key = FieldKey.Create(options.Field);
+ FieldKey key = FieldKey.Create(options.Field);
if (!issue.ContainsKey(key))
{
this.logger.Error($"Field \"{key}\" does not exist on issue \"{issue.Key}\"");
return;
}
- var field = issue[key];
+ IField field = issue[key];
if (field is IArrayField arrayField)
{
- if (arrayField.TryParse(options.Remove, out var value))
+ if (arrayField.TryParse(options.Remove, out object? value))
{
if (arrayField.Contains(value))
{
diff --git a/src/GitIssue.Tool/Commands/Show/ShowCommand.cs b/src/GitIssue.Tool/Commands/Show/ShowCommand.cs
index 0ddba0c..32842f0 100644
--- a/src/GitIssue.Tool/Commands/Show/ShowCommand.cs
+++ b/src/GitIssue.Tool/Commands/Show/ShowCommand.cs
@@ -26,7 +26,7 @@ public ShowCommand(IIssueManager manager, ILogger logger)
///
public override async Task Exec(ShowOptions options)
{
- var formatter = new TerminalFormatter("%*");
+ TerminalFormatter formatter = new TerminalFormatter("%*");
IAsyncEnumerable issues;
switch (options.Show)
@@ -34,19 +34,19 @@ public override async Task Exec(ShowOptions options)
case ShowSubCommand.tracked:
case ShowSubCommand.Tracked:
Console.WriteLine("Showing 'tracked' issue");
- issues = manager.FindAsync(i => i.Key.ToString() == options.Key);
+ issues = this.manager.FindAsync(i => i.Key.ToString() == options.Key);
break;
case ShowSubCommand.all:
case ShowSubCommand.All:
Console.WriteLine("Showing 'all' issues");
- issues = manager.FindAsync(i => true);
+ issues = this.manager.FindAsync(i => true);
break;
case ShowSubCommand.mine:
case ShowSubCommand.Mine:
Console.WriteLine("Showing 'my' issues");
- issues = manager.FindAsync(i => true);
+ issues = this.manager.FindAsync(i => true);
break;
default:
@@ -55,9 +55,13 @@ public override async Task Exec(ShowOptions options)
}
int count = 0;
- await foreach (var issue in issues)
+ await foreach (IIssue issue in issues)
{
- if (count++ > 0) Console.WriteLine();
+ if (count++ > 0)
+ {
+ Console.WriteLine();
+ }
+
Console.WriteLine(issue.Format(formatter));
}
diff --git a/src/GitIssue.Tool/Commands/Show/ShowSubCommand.cs b/src/GitIssue.Tool/Commands/Show/ShowSubCommand.cs
index 7d1eeb4..bf8c43e 100644
--- a/src/GitIssue.Tool/Commands/Show/ShowSubCommand.cs
+++ b/src/GitIssue.Tool/Commands/Show/ShowSubCommand.cs
@@ -9,4 +9,4 @@ public enum ShowSubCommand
all,
All,
}
-}
+}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Commands/Sync/SyncCommand.cs b/src/GitIssue.Tool/Commands/Sync/SyncCommand.cs
index e1c44ff..0ebe568 100644
--- a/src/GitIssue.Tool/Commands/Sync/SyncCommand.cs
+++ b/src/GitIssue.Tool/Commands/Sync/SyncCommand.cs
@@ -23,7 +23,7 @@ public SyncCommand(IIssueManager manager, ILogger logger)
///
public override Task Exec(SyncOptions options)
{
- var importer = new FileImporter(manager);
+ FileImporter importer = new FileImporter(this.manager);
Console.WriteLine($"Exported issues to {options.Import}");
return Task.CompletedTask;
}
diff --git a/src/GitIssue.Tool/Commands/Track/TrackCommand.cs b/src/GitIssue.Tool/Commands/Track/TrackCommand.cs
index e77209a..37da9b8 100644
--- a/src/GitIssue.Tool/Commands/Track/TrackCommand.cs
+++ b/src/GitIssue.Tool/Commands/Track/TrackCommand.cs
@@ -28,7 +28,7 @@ public override async Task Exec(TrackOptions options)
options.Tracked = TrackedIssue.None;
if (!string.IsNullOrEmpty(options.Key))
{
- var find = await manager.FindAsync(i => i.Key.ToString() == options.Key)
+ IIssue? find = await this.manager.FindAsync(i => i.Key.ToString() == options.Key)
.FirstOrDefaultAsync();
if (find != null)
diff --git a/src/GitIssue.Tool/Configuration.cs b/src/GitIssue.Tool/Configuration.cs
index 27c640b..83d31ac 100644
--- a/src/GitIssue.Tool/Configuration.cs
+++ b/src/GitIssue.Tool/Configuration.cs
@@ -8,16 +8,16 @@ namespace GitIssue.Tool
public class Configuration : IssueConfiguration
{
///
- /// Gets or sets the editor to use
+ /// Gets or sets additional arguments for the editor
///
[JsonProperty]
- public string Editor { get; set; } = "joe";
+ public string Arguments { get; set; } = "-pound_comment -syntax git-commit";
///
- /// Gets or sets additional arguments for the editor
+ /// Gets or sets the editor to use
///
[JsonProperty]
- public string Arguments { get; set; } = "-pound_comment -syntax git-commit";
+ public string Editor { get; set; } = "joe";
///
/// Reads the configuration from a file
@@ -26,7 +26,7 @@ public class Configuration : IssueConfiguration
/// the
public new static Configuration Read(string file)
{
- return Read(file);
+ return IssueConfiguration.Read(file);
}
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Editor.cs b/src/GitIssue.Tool/Editor.cs
index ae0e5ef..b03c090 100644
--- a/src/GitIssue.Tool/Editor.cs
+++ b/src/GitIssue.Tool/Editor.cs
@@ -17,13 +17,15 @@ public class Editor : IEditor
{
private static readonly char CommentChar = '#';
+ private static readonly string FieldHeaderRegex = @$"^{Editor.CommentChar}[\s]?([\w]*)[\s]?$";
+
private static readonly char Newline = '\n';
private static readonly string FieldTemplate =
- $"{Newline}{CommentChar} Please edit the field with your updates. Lines starting" +
- $"{Newline}{CommentChar} with '#' will be ignored, leave the file unchanged to abort. ";
+ $"{Editor.Newline}{Editor.CommentChar} Please edit the field with your updates. Lines starting" +
+ $"{Editor.Newline}{Editor.CommentChar} with '#' will be ignored, leave the file unchanged to abort. ";
+
- private static readonly string FieldHeaderRegex = @$"^{CommentChar}[\s]?([\w]*)[\s]?$";
public Editor(Configuration configuration)
{
@@ -32,9 +34,9 @@ public Editor(Configuration configuration)
}
///
- /// Gets or sets the successful result
+ /// Gets or sets the command
///
- public int Success { get; set; } = 0;
+ public string Arguments { get; set; } = string.Empty;
///
/// Gets or sets the command
@@ -42,49 +44,37 @@ public Editor(Configuration configuration)
public string Command { get; set; } = string.Empty;
///
- /// Gets or sets the command
+ /// Gets or sets the successful result
///
- public string Arguments { get; set; } = string.Empty;
+ public int Success { get; set; } = 0;
public void UpdateCommand(string command)
{
- var result = GetProcessAndArgumentsFromCommand(command);
+ (string, string) result = Editor.GetProcessAndArgumentsFromCommand(command);
this.Command = result.Item1;
this.Arguments = result.Item2;
}
- private static (string, string) GetProcessAndArgumentsFromCommand(string command)
- {
- try
- {
- var match = Regex.Match(command, "^\\s?([\\w.]+|\"[\\w\\s.]*\")\\s?(.*)?$");
- if (match.Success)
- if (match.Groups.Count == 3)
- return (match.Groups[1].ToString().Trim(), match.Groups[2].ToString().Trim());
- }
- catch (Exception)
- {
- // Ignored
- }
- return (command.Trim(), String.Empty);
- }
-
///
public async Task Edit(string header, string content)
{
- var temp = GetTempFile();
+ string temp = Editor.GetTempFile();
- await File.AppendAllTextAsync(temp, $"{CommentChar} {header} {Newline}");
+ await File.AppendAllTextAsync(temp, $"{Editor.CommentChar} {header} {Editor.Newline}");
await File.AppendAllTextAsync(temp, content);
- await File.AppendAllTextAsync(temp, FieldTemplate);
+ await File.AppendAllTextAsync(temp, Editor.FieldTemplate);
- var created = File.GetLastWriteTime(temp);
+ DateTime created = File.GetLastWriteTime(temp);
- if (await EditFileAsync(this.Command, this.Arguments + " " + temp))
+ if (await this.EditFileAsync(this.Command, this.Arguments + " " + temp))
+ {
if (created == File.GetLastWriteTime(temp))
+ {
return content;
+ }
+ }
- return RemoveComments(await File.ReadAllTextAsync(temp));
+ return Editor.RemoveComments(await File.ReadAllTextAsync(temp));
}
///
@@ -97,21 +87,23 @@ public async Task Open(IIssue issue)
public async Task Open(IEnumerable fields)
{
// Convert fields to a file
- var temp = GetTempFile();
- foreach (var field in fields)
+ string temp = Editor.GetTempFile();
+ foreach (IField field in fields)
{
- await File.AppendAllTextAsync(temp, $"{CommentChar} {field.Key} {Newline}");
- await File.AppendAllTextAsync(temp, $"{await field.ExportAsync()}{Newline}");
+ await File.AppendAllTextAsync(temp, $"{Editor.CommentChar} {field.Key} {Editor.Newline}");
+ await File.AppendAllTextAsync(temp, $"{await field.ExportAsync()}{Editor.Newline}");
}
- await File.AppendAllTextAsync(temp, FieldTemplate);
+ await File.AppendAllTextAsync(temp, Editor.FieldTemplate);
// Open and modify the file
- var created = File.GetLastWriteTime(temp);
- if (await EditFileAsync(this.Command, this.Arguments + " " + temp))
+ DateTime created = File.GetLastWriteTime(temp);
+ if (await this.EditFileAsync(this.Command, this.Arguments + " " + temp))
{
if (created == File.GetLastWriteTime(temp))
+ {
return;
+ }
}
else
{
@@ -119,11 +111,12 @@ public async Task Open(IEnumerable fields)
}
// Extract the field updates
- var key = FieldKey.None;
- var content = string.Empty;
- var updates = new Dictionary();
- await foreach (var line in ReadLinesAsync(temp))
- if (IsMatch(line, FieldHeaderRegex, out var match))
+ FieldKey key = FieldKey.None;
+ string content = string.Empty;
+ Dictionary updates = new Dictionary();
+ await foreach (string line in Editor.ReadLinesAsync(temp))
+ {
+ if (Editor.IsMatch(line, Editor.FieldHeaderRegex, out Match match))
{
if (key != FieldKey.None)
{
@@ -137,31 +130,65 @@ public async Task Open(IEnumerable fields)
else if (key != FieldKey.None)
{
if (string.IsNullOrEmpty(content))
+ {
content = line;
+ }
else
- content = content + Newline + line;
+ {
+ content = content + Editor.Newline + line;
+ }
}
+ }
// Update the fields
- foreach (var field in fields)
+ foreach (IField field in fields)
+ {
if (updates.ContainsKey(field.Key))
+ {
field.Update(updates[field.Key]);
+ }
+ }
}
///
public async Task Open(IField field)
{
- var content = await field.ExportAsync();
- var temp = GetTempFile();
+ string content = await field.ExportAsync();
+ string temp = Editor.GetTempFile();
await File.WriteAllTextAsync(temp, content);
- await File.AppendAllTextAsync(temp, FieldTemplate);
+ await File.AppendAllTextAsync(temp, Editor.FieldTemplate);
- var created = File.GetLastWriteTime(temp);
- if (await EditFileAsync(this.Command, this.Arguments + " " + temp))
+ DateTime created = File.GetLastWriteTime(temp);
+ if (await this.EditFileAsync(this.Command, this.Arguments + " " + temp))
+ {
if (created == File.GetLastWriteTime(temp))
+ {
return;
+ }
+ }
+
+ field.Update(Editor.RemoveComments(await File.ReadAllTextAsync(temp)));
+ }
+
+ private static (string, string) GetProcessAndArgumentsFromCommand(string command)
+ {
+ try
+ {
+ Match match = Regex.Match(command, "^\\s?([\\w.]+|\"[\\w\\s.]*\")\\s?(.*)?$");
+ if (match.Success)
+ {
+ if (match.Groups.Count == 3)
+ {
+ return (match.Groups[1].ToString().Trim(), match.Groups[2].ToString().Trim());
+ }
+ }
+ }
+ catch (Exception)
+ {
+ // Ignored
+ }
- field.Update(RemoveComments(await File.ReadAllTextAsync(temp)));
+ return (command.Trim(), string.Empty);
}
private static string GetTempFile()
@@ -184,8 +211,8 @@ private static bool IsMatch(string input, string pattern, out Match match)
private static async IAsyncEnumerable ReadLinesAsync(string file)
{
await using Stream stream = new FileStream(file, FileMode.Open, FileAccess.Read);
- using var reader = new StreamReader(stream);
- var line = await reader.ReadLineAsync();
+ using StreamReader reader = new StreamReader(stream);
+ string? line = await reader.ReadLineAsync();
while (line != null)
{
yield return line;
@@ -195,19 +222,19 @@ private static async IAsyncEnumerable ReadLinesAsync(string file)
private static string RemoveComments(string input)
{
- var comments = $@"^{CommentChar}(.*)$";
- var lines = input.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)
- .Where(l => Regex.IsMatch(l, comments) == false)
+ string comments = $@"^{Editor.CommentChar}(.*)$";
+ string[] lines = input.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None)
+ .Where(l => !Regex.IsMatch(l, comments))
.ToArray();
- return string.Join(Newline, lines);
+ return string.Join(Editor.Newline, lines);
}
private async Task EditFileAsync(string editor, string arguments)
{
- var result = 0;
+ int result = 0;
await Task.Run(() =>
{
- using var process = new Process();
+ using Process process = new Process();
process.StartInfo.FileName = editor;
process.StartInfo.Arguments = arguments;
@@ -222,8 +249,7 @@ await Task.Run(() =>
result = process.ExitCode;
});
- return result == Success;
+ return result == this.Success;
}
-
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/GitIssue.Tool.csproj b/src/GitIssue.Tool/GitIssue.Tool.csproj
index 74b662d..38b0e7f 100644
--- a/src/GitIssue.Tool/GitIssue.Tool.csproj
+++ b/src/GitIssue.Tool/GitIssue.Tool.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net10.0
enable
latest
@@ -19,18 +19,18 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/src/GitIssue.Tool/IEditor.cs b/src/GitIssue.Tool/IEditor.cs
index 8b6769c..c2d94db 100644
--- a/src/GitIssue.Tool/IEditor.cs
+++ b/src/GitIssue.Tool/IEditor.cs
@@ -11,7 +11,7 @@ namespace GitIssue.Tool
public interface IEditor
{
///
- /// Edits existing content
+ /// Edits existing content
///
/// the header
/// the content
diff --git a/src/GitIssue.Tool/Program.cs b/src/GitIssue.Tool/Program.cs
index 0e2e87f..8d61451 100644
--- a/src/GitIssue.Tool/Program.cs
+++ b/src/GitIssue.Tool/Program.cs
@@ -29,50 +29,13 @@ internal class Program
{
private static ILogger? logger;
- private static void Main(string[] args)
- {
- logger = new LoggerConfiguration()
- .WriteTo.Console()
- .MinimumLevel.Debug()
- .CreateLogger();
-
- var parser = new Parser(with =>
- {
- with.EnableDashDash = true;
- with.AutoHelp = true;
- with.CaseSensitive = false;
- with.HelpWriter = Console.Error;
- });
-
- parser.ParseArguments(args)
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait())
- .WithParsed(o => ExecAsync(o).Wait());
- }
-
private static async Task ExecAsync(T options)
where TC : Command
where T : Options
{
- var builder = new ContainerBuilder();
+ ContainerBuilder builder = new ContainerBuilder();
- builder.Register(c => logger!)
+ builder.Register(c => Program.logger!)
.As()
.SingleInstance();
@@ -86,8 +49,8 @@ private static async Task ExecAsync(T options)
// Initialize the repository root and save the configuration
InitCommand.Initializer onInitCommand = () =>
{
- var config = new IssueConfiguration();
- var root = RepositoryRoot.Create(options.Path, options.Name);
+ IssueConfiguration config = new IssueConfiguration();
+ RepositoryRoot root = RepositoryRoot.Create(options.Path, options.Name);
config.Save(root.ConfigFile);
};
return onInitCommand;
@@ -107,32 +70,68 @@ private static async Task ExecAsync(T options)
builder.RegisterModule();
- using var container = builder.Build();
+ using IContainer container = builder.Build();
if (options is ITrackedOptions keyOptions)
+ {
keyOptions.Tracked = TrackedIssue
- .Read(Path.Combine(options.Path, options.Name, options.Tracking), logger);
+ .Read(Path.Combine(options.Path, options.Name, options.Tracking), Program.logger);
+ }
- var command = container.Resolve>();
- await ExecAsync(command.Exec, options);
+ Command command = container.Resolve>();
+ await Program.ExecAsync(command.Exec, options);
}
private static async Task ExecAsync(Func func, T value)
where T : Options
{
- await Task.Run(async () =>
+ try
{
- try
- {
- Console.WriteLine();
- await func(value);
- Console.WriteLine();
- }
- catch (Exception e)
- {
- logger?.Error($"Exception caught when executing command: {e.Message}", e);
- }
+ Console.WriteLine();
+ await func(value);
+ Console.WriteLine();
+ }
+ catch (Exception e)
+ {
+ Program.logger?.Error($"Exception caught when executing command: {e.Message}", e);
+ }
+ }
+
+ private static void Main(string[] args)
+ {
+ Program.logger = new LoggerConfiguration()
+ .WriteTo.Console()
+ .MinimumLevel.Debug()
+ .CreateLogger();
+
+ Parser parser = new Parser(with =>
+ {
+ with.EnableDashDash = true;
+ with.AutoHelp = true;
+ with.CaseSensitive = false;
+ with.HelpWriter = Console.Error;
});
+
+ parser.ParseArguments(args)
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait())
+ .WithParsed(o => Program.ExecAsync(o).Wait());
}
}
}
\ No newline at end of file
diff --git a/src/GitIssue.Tool/Properties/PublishProfiles/Win10-x64_Profile.pubxml b/src/GitIssue.Tool/Properties/PublishProfiles/Win10-x64_Profile.pubxml
deleted file mode 100644
index 524cdc9..0000000
--- a/src/GitIssue.Tool/Properties/PublishProfiles/Win10-x64_Profile.pubxml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- FileSystem
- Release
- netcoreapp3.1
- ../output/GitIssue.Tool/bin/Release/netcoreapp3.1/win10-x64/publish/
- win10-x64
- Any CPU
- true
- True
- True
- False
-
-
\ No newline at end of file
diff --git a/src/GitIssue.Tool/TerminalFormatter.cs b/src/GitIssue.Tool/TerminalFormatter.cs
index 3bb5282..e295d2c 100644
--- a/src/GitIssue.Tool/TerminalFormatter.cs
+++ b/src/GitIssue.Tool/TerminalFormatter.cs
@@ -1,5 +1,4 @@
-
-using System;
+using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
@@ -8,31 +7,29 @@
using GitIssue.Issues;
using Humanizer;
using Pastel;
+using DateTime = GitIssue.Values.DateTime;
namespace GitIssue.Tool
{
public class TerminalFormatter : IssueFormatter
{
- private static Dictionary> terminalIssueFormatters = new Dictionary>
- {
- {"*", (t, i) => i.Select(f => $"{f.Key.ToString().PadRight(20,' ').Pastel(Color.FromArgb(102, 255, 102))} {t.Format(f.Value)}")
- .Aggregate((a, b) => $"{a}{Environment.NewLine}{b}") },
-
- { "Delta", (t, i) => $"({i.GetField("Updated").AsValue().Item.Humanize()})".Pastel(Color.FromArgb(255, 153, 0)) }
- };
+ private static readonly Dictionary> terminalFieldFormatters = new Dictionary> { { "Key", (t, f) => $"{f.ToString()?.PadRight(20, ' ').Pastel(Color.FromArgb(165, 229, 250))}" } };
- private static Dictionary> terminalFieldFormatters = new Dictionary>
+ private static readonly Dictionary> terminalIssueFormatters = new Dictionary>
{
- {"Key", (t, f) => $"{f.ToString()?.PadRight(20,' ').Pastel(Color.FromArgb(165, 229, 250))}"},
+ {
+ "*", (t, i) => i.Select(f => $"{f.Key.ToString().PadRight(20, ' ').Pastel(Color.FromArgb(102, 255, 102))} {t.Format(f.Value)}")
+ .Aggregate((a, b) => $"{a}{Environment.NewLine}{b}")
+ },
+ { "Delta", (t, i) => $"({i.GetField("Updated").AsValue().Item.Humanize()})".Pastel(Color.FromArgb(255, 153, 0)) },
};
- public TerminalFormatter(string format) : base(format, terminalIssueFormatters, terminalFieldFormatters)
+ public TerminalFormatter(string format) : base(format, TerminalFormatter.terminalIssueFormatters, TerminalFormatter.terminalFieldFormatters)
{
-
}
- public new static TerminalFormatter Simple => new TerminalFormatter("%Key %Title %Delta");
-
public new static TerminalFormatter Detailed => new TerminalFormatter("%*");
+
+ public new static TerminalFormatter Simple => new TerminalFormatter("%Key %Title %Delta");
}
-}
+}
\ No newline at end of file
diff --git a/src/GitIssue.sln.DotSettings b/src/GitIssue.sln.DotSettings
index ca6984b..5413fa4 100644
--- a/src/GitIssue.sln.DotSettings
+++ b/src/GitIssue.sln.DotSettings
@@ -1,3 +1,385 @@
+ Inherit
- <?xml version="1.0" encoding="utf-16"?><Profile name="GitIssue: Full Cleanup"><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><CSReorderTypeMembers>True</CSReorderTypeMembers><CSCodeStyleAttributes ArrangeVarStyle="True" ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" ArrangeArgumentsStyle="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeCodeBodyStyle="True" ArrangeTrailingCommas="True" ArrangeObjectCreation="True" ArrangeDefaultValue="True" ArrangeNamespaces="True" /><CssAlphabetizeProperties>True</CssAlphabetizeProperties><JSStringLiteralQuotesDescriptor>True</JSStringLiteralQuotesDescriptor><CorrectVariableKindsDescriptor>True</CorrectVariableKindsDescriptor><VariablesToInnerScopesDescriptor>True</VariablesToInnerScopesDescriptor><StringToTemplatesDescriptor>True</StringToTemplatesDescriptor><JsInsertSemicolon>True</JsInsertSemicolon><RemoveRedundantQualifiersTs>True</RemoveRedundantQualifiersTs><OptimizeImportsTs>True</OptimizeImportsTs><OptimizeReferenceCommentsTs>True</OptimizeReferenceCommentsTs><PublicModifierStyleTs>True</PublicModifierStyleTs><ExplicitAnyTs>True</ExplicitAnyTs><TypeAnnotationStyleTs>True</TypeAnnotationStyleTs><RelativePathStyleTs>True</RelativePathStyleTs><AsInsteadOfCastTs>True</AsInsteadOfCastTs><RemoveCodeRedundanciesVB>True</RemoveCodeRedundanciesVB><Xaml.RedundantFreezeAttribute>True</Xaml.RedundantFreezeAttribute><Xaml.RemoveRedundantModifiersAttribute>True</Xaml.RemoveRedundantModifiersAttribute><Xaml.RemoveRedundantNameAttribute>True</Xaml.RemoveRedundantNameAttribute><Xaml.RemoveRedundantResource>True</Xaml.RemoveRedundantResource><Xaml.RemoveRedundantCollectionProperty>True</Xaml.RemoveRedundantCollectionProperty><Xaml.RemoveRedundantAttachedPropertySetter>True</Xaml.RemoveRedundantAttachedPropertySetter><Xaml.RemoveRedundantStyledValue>True</Xaml.RemoveRedundantStyledValue><Xaml.RemoveRedundantNamespaceAlias>True</Xaml.RemoveRedundantNamespaceAlias><Xaml.RemoveForbiddenResourceName>True</Xaml.RemoveForbiddenResourceName><Xaml.RemoveRedundantGridDefinitionsAttribute>True</Xaml.RemoveRedundantGridDefinitionsAttribute><Xaml.RemoveRedundantUpdateSourceTriggerAttribute>True</Xaml.RemoveRedundantUpdateSourceTriggerAttribute><Xaml.RemoveRedundantBindingModeAttribute>True</Xaml.RemoveRedundantBindingModeAttribute><Xaml.RemoveRedundantGridSpanAttribut>True</Xaml.RemoveRedundantGridSpanAttribut><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSMakeAutoPropertyGetOnly>True</CSMakeAutoPropertyGetOnly><CSArrangeQualifiers>True</CSArrangeQualifiers><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CssReformatCode>True</CssReformatCode><HtmlReformatCode>True</HtmlReformatCode><JsReformatCode>True</JsReformatCode><JsFormatDocComments>True</JsFormatDocComments><VBOptimizeImports>True</VBOptimizeImports><VBShortenReferences>True</VBShortenReferences><XMLReformatCode>True</XMLReformatCode><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><VBReformatCode>True</VBReformatCode><VBFormatDocComments>True</VBFormatDocComments><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><FormatAttributeQuoteDescriptor>True</FormatAttributeQuoteDescriptor></Profile>
\ No newline at end of file
+
+ True
+ True
+ PerTechnology
+ False
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ WARNING
+ SUGGESTION
+ SUGGESTION
+ WARNING
+ WARNING
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+ SUGGESTION
+
+ DO_NOT_SHOW
+ SUGGESTION
+ SUGGESTION
+ WARNING
+ SUGGESTION
+ False
+ ECMAScript 2016
+ <?xml version="1.0" encoding="utf-16"?><Profile name="GitIssue: Full Cleanup"><AspOptimizeRegisterDirectives>True</AspOptimizeRegisterDirectives><CppAddTypenameTemplateKeywords>True</CppAddTypenameTemplateKeywords><CppCStyleToStaticCastDescriptor>True</CppCStyleToStaticCastDescriptor><CppRedundantDereferences>True</CppRedundantDereferences><CppDeleteRedundantAccessSpecifier>True</CppDeleteRedundantAccessSpecifier><CppRemoveCastDescriptor>True</CppRemoveCastDescriptor><CppRemoveElseKeyword>True</CppRemoveElseKeyword><CppShortenQualifiedName>True</CppShortenQualifiedName><CppDeleteRedundantSpecifier>True</CppDeleteRedundantSpecifier><CppRemoveStatement>True</CppRemoveStatement><CppDeleteRedundantTypenameTemplateKeywords>True</CppDeleteRedundantTypenameTemplateKeywords><CppReplaceExpressionWithBooleanConst>True</CppReplaceExpressionWithBooleanConst><CppMakeIfConstexpr>True</CppMakeIfConstexpr><CppMakePostfixOperatorPrefix>True</CppMakePostfixOperatorPrefix><CppMakeVariableConstexpr>True</CppMakeVariableConstexpr><CppChangeSmartPointerToMakeFunction>True</CppChangeSmartPointerToMakeFunction><CppReplaceThrowWithRethrowFix>True</CppReplaceThrowWithRethrowFix><CppTypeTraitAliasDescriptor>True</CppTypeTraitAliasDescriptor><CppRemoveRedundantConditionalExpressionDescriptor>True</CppRemoveRedundantConditionalExpressionDescriptor><CppSimplifyConditionalExpressionDescriptor>True</CppSimplifyConditionalExpressionDescriptor><CppReplaceExpressionWithNullptr>True</CppReplaceExpressionWithNullptr><CppReplaceTieWithStructuredBindingDescriptor>True</CppReplaceTieWithStructuredBindingDescriptor><CppUseAssociativeContainsDescriptor>True</CppUseAssociativeContainsDescriptor><CppUseEraseAlgorithmDescriptor>True</CppUseEraseAlgorithmDescriptor><CppCodeStyleCleanupDescriptor ArrangeBraces="True" ArrangeAuto="True" ArrangeFunctionDeclarations="True" ArrangeNestedNamespaces="True" ArrangeTypeAliases="True" ArrangeCVQualifiers="True" ArrangeSlashesInIncludeDirectives="True" ArrangeOverridingFunctions="True" SortDefinitions="True" SortIncludeDirectives="True" SortMemberInitializers="True" /><CppReformatCode>True</CppReformatCode><CSReorderTypeMembers>True</CSReorderTypeMembers><CSCodeStyleAttributes ArrangeVarStyle="True" ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" ArrangeArgumentsStyle="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeCodeBodyStyle="True" ArrangeTrailingCommas="True" ArrangeObjectCreation="True" ArrangeDefaultValue="True" ArrangeNamespaces="True" ArrangeNullCheckingPattern="True" /><CSArrangeQualifiers>True</CSArrangeQualifiers><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><ShaderLabReformatCode>True</ShaderLabReformatCode><StandaloneSqlReformatCode>True</StandaloneSqlReformatCode><InjectedSqlReformatCode>True</InjectedSqlReformatCode><RemoveCodeRedundanciesVB>True</RemoveCodeRedundanciesVB><VBMakeFieldReadonly>True</VBMakeFieldReadonly><Xaml.RemoveRedundantNamespaceAlias>True</Xaml.RemoveRedundantNamespaceAlias><Xaml.RedundantFreezeAttribute>True</Xaml.RedundantFreezeAttribute><Xaml.RemoveRedundantModifiersAttribute>True</Xaml.RemoveRedundantModifiersAttribute><Xaml.RemoveRedundantNameAttribute>True</Xaml.RemoveRedundantNameAttribute><Xaml.RemoveRedundantResource>True</Xaml.RemoveRedundantResource><Xaml.RemoveRedundantCollectionProperty>True</Xaml.RemoveRedundantCollectionProperty><Xaml.RemoveRedundantAttachedPropertySetter>True</Xaml.RemoveRedundantAttachedPropertySetter><Xaml.RemoveRedundantStyledValue>True</Xaml.RemoveRedundantStyledValue><Xaml.RemoveForbiddenResourceName>True</Xaml.RemoveForbiddenResourceName><Xaml.RemoveRedundantGridDefinitionsAttribute>True</Xaml.RemoveRedundantGridDefinitionsAttribute><Xaml.RemoveRedundantUpdateSourceTriggerAttribute>True</Xaml.RemoveRedundantUpdateSourceTriggerAttribute><Xaml.RemoveRedundantBindingModeAttribute>True</Xaml.RemoveRedundantBindingModeAttribute><Xaml.RemoveRedundantGridSpanAttribut>True</Xaml.RemoveRedundantGridSpanAttribut><XMLReformatCode>True</XMLReformatCode><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSMakeAutoPropertyGetOnly>True</CSMakeAutoPropertyGetOnly><HtmlReformatCode>True</HtmlReformatCode><VBOptimizeImports>True</VBOptimizeImports><VBShortenReferences>True</VBShortenReferences><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><VBReformatCode>True</VBReformatCode><VBFormatDocComments>True</VBFormatDocComments><CSReformatCode>True</CSReformatCode><CSharpFormatDocComments>True</CSharpFormatDocComments><CSharpReformatComments>True</CSharpReformatComments><FormatAttributeQuoteDescriptor>True</FormatAttributeQuoteDescriptor></Profile>
+
+ Required
+ Required
+ Required
+ Required
+ Required
+ DefaultLiteral
+ DefaultExpression
+ Separate
+ BlockScoped
+ ExplicitlyTyped
+ Shift, Relational, Equality, Bitwise, Conditional
+ Field, Property, Event, Method
+ Field, Property, Event, Method
+ True
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ True
+ False
+ False
+ False
+ True
+ False
+ False
+ False
+ False
+ False
+ 3
+ 3
+ True
+ NEVER
+ IF_OWNER_IS_SINGLE_LINE
+ True
+ NEVER
+ True
+ DO_NOT_CHANGE
+ False
+ True
+ CHOP_IF_LONG
+
+ 320
+ True
+
+ True
+ 1
+ 80
+ ByFirstAttr
+ 160
+ OneStep
+ OneStep
+ OnDifferentLines
+ False
+ 320
+ <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
+ <TypePattern DisplayName="Non-reorderable types">
+ <TypePattern.Match>
+ <Or>
+ <And>
+ <Kind Is="Interface" />
+ <Or>
+ <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
+ <HasAttribute Name="System.Runtime.InteropServices.ComImport" />
+ </Or>
+ </And>
+ <Kind Is="Struct" />
+ <HasAttribute Name="JetBrains.Annotations.NoReorderAttribute" />
+ <HasAttribute Name="JetBrains.Annotations.NoReorder" />
+ </Or>
+ </TypePattern.Match>
+ </TypePattern>
+ <TypePattern DisplayName="xUnit.net Test Classes" RemoveRegions="All">
+ <TypePattern.Match>
+ <And>
+ <Kind Is="Class" />
+ <HasMember>
+ <And>
+ <Kind Is="Method" />
+ <HasAttribute Inherited="True" Name="Xunit.FactAttribute" />
+ </And>
+ </HasMember>
+ </And>
+ </TypePattern.Match>
+ <Entry DisplayName="Setup/Teardown Methods">
+ <Entry.Match>
+ <Or>
+ <Kind Is="Constructor" />
+ <And>
+ <Kind Is="Method" />
+ <ImplementsInterface Name="System.IDisposable" />
+ </And>
+ </Or>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Kind Is="0" Order="Constructor" />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="All other members" />
+ <Entry DisplayName="Test Methods" Priority="100">
+ <Entry.Match>
+ <And>
+ <Kind Is="Method" />
+ <HasAttribute Name="Xunit.FactAttribute" />
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ </TypePattern>
+ <TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All">
+ <TypePattern.Match>
+ <And>
+ <Kind Is="Class" />
+ <HasAttribute Inherited="True" Name="NUnit.Framework.TestFixtureAttribute" />
+ </And>
+ </TypePattern.Match>
+ <Entry DisplayName="Setup/Teardown Methods">
+ <Entry.Match>
+ <And>
+ <Kind Is="Method" />
+ <Or>
+ <HasAttribute Inherited="True" Name="NUnit.Framework.SetUpAttribute" />
+ <HasAttribute Inherited="True" Name="NUnit.Framework.TearDownAttribute" />
+ <HasAttribute Inherited="True" Name="NUnit.Framework.FixtureSetUpAttribute" />
+ <HasAttribute Inherited="True" Name="NUnit.Framework.FixtureTearDownAttribute" />
+ </Or>
+ </And>
+ </Entry.Match>
+ </Entry>
+ <Entry DisplayName="All other members" />
+ <Entry DisplayName="Test Methods" Priority="100">
+ <Entry.Match>
+ <And>
+ <Kind Is="Method" />
+ <HasAttribute Name="NUnit.Framework.TestAttribute" />
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ </TypePattern>
+ <TypePattern DisplayName="Default Pattern">
+ <Entry DisplayName="Enums">
+ <Entry.Match>
+ <Kind Is="Enum" />
+ </Entry.Match>
+ <Entry.SortBy>
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Constants">
+ <Entry.Match>
+ <Kind Is="Constant" />
+ </Entry.Match>
+ <Entry.SortBy>
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Public Delegates">
+ <Entry.Match>
+ <And>
+ <Access Is="Public" />
+ <Kind Is="Delegate" />
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Fields">
+ <Entry.Match>
+ <Kind Is="Field" />
+ </Entry.Match>
+ <Entry.SortBy>
+ <Static />
+ <Readonly />
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Constructors" Priority="100">
+ <Entry.Match>
+ <Kind Is="Constructor" />
+ </Entry.Match>
+ </Entry>
+ <Entry DisplayName="IDisposable" Priority="100">
+ <Entry.Match>
+ <And>
+ <ImplementsInterface Name="IDisposable" />
+ <Kind Is="Method" />
+ </And>
+ </Entry.Match>
+ </Entry>
+ <Entry DisplayName="Properties, Indexers">
+ <Entry.Match>
+ <Or>
+ <Kind Is="Property" />
+ <Kind Is="Autoproperty" />
+ <Kind Is="Indexer" />
+ </Or>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Static />
+ <Access Is="0" />
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Public Methods" Priority="100">
+ <Entry.Match>
+ <And>
+ <Kind Is="Method" />
+ <Or>
+ <Access Is="Public" />
+ <Access Is="Internal" />
+ </Or>
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Static />
+ <Access Is="0" />
+ <ImplementsInterface />
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Protected Methods">
+ <Entry.Match>
+ <And>
+ <Kind Is="Method" />
+ <Or>
+ <Access Is="Protected" />
+ <Access Is="ProtectedInternal" />
+ </Or>
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Static />
+ <Access Is="0" />
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Private Methods">
+ <Entry.Match>
+ <And>
+ <Kind Is="Method" />
+ <Access Is="Private" />
+ </And>
+ </Entry.Match>
+ <Entry.SortBy>
+ <Static />
+ <Access Is="0" />
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="All other members" Priority="25">
+ <Entry.SortBy>
+ <Static />
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ <Entry DisplayName="Nested Types">
+ <Entry.Match>
+ <Kind Is="Type" />
+ </Entry.Match>
+ <Entry.SortBy>
+ <Name />
+ </Entry.SortBy>
+ </Entry>
+ </TypePattern>
+</Patterns>
+ UseExplicitType
+ UseExplicitType
+ UseExplicitType
+ False
+ True
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static readonly fields (private)"><ElementKinds><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Private static"><ElementKinds><Kind Name="METHOD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Any" AccessRightKinds="Private" Description="Constant fields (private)"><ElementKinds><Kind Name="CONSTANT_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"><ElementKinds><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+
+ True
+
+ True
+ <Policy><Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Private methods"><ElementKinds><Kind Name="ASYNC_METHOD" /><Kind Name="FIELD" /><Kind Name="READONLY_FIELD" /><Kind Name="CLASS" /><Kind Name="METHOD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy><Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"><ElementKinds><Kind Name="FIELD" /></ElementKinds></Descriptor><Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /></Policy>
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+
+
\ No newline at end of file
diff --git a/src/GitIssue/ChangeLog.cs b/src/GitIssue/ChangeLog.cs
index a2f0ee5..55bdfa3 100644
--- a/src/GitIssue/ChangeLog.cs
+++ b/src/GitIssue/ChangeLog.cs
@@ -19,47 +19,67 @@ public class ChangeLog : IChangeLog
///
public Dictionary> Log { get; set; } = new Dictionary>();
- ///
- public void Clear()
+ ///
+ /// Reads the configuration from a file
+ ///
+ /// the configuration file
+ /// the
+ public static ChangeLog Read(string file)
{
- hasChanged = true;
- Log.Clear();
+ if (!File.Exists(file))
+ {
+ return new ChangeLog();
+ }
+
+ try
+ {
+ using FileStream stream = new FileStream(file, FileMode.Open, FileAccess.Read);
+ using StreamReader reader = new StreamReader(stream);
+ JsonSerializer serializer = new JsonSerializer();
+ ChangeLog? configuration = serializer.Deserialize(reader, typeof(ChangeLog)) as ChangeLog;
+ return configuration ?? new ChangeLog();
+ }
+ catch (Exception ex)
+ {
+ throw new AggregateException($"Unable to deserialize {file} as change log ", ex);
+ }
}
///
public void Add(IssueKey key, ChangeType change)
{
- Add(key, change, string.Empty);
+ this.Add(key, change, string.Empty);
}
///
public void Add(IssueKey key, ChangeType change, string summary)
{
- hasChanged = true;
- if (Log.ContainsKey(key) == false)
- Log[key] = new List();
+ this.hasChanged = true;
+ if (!this.Log.ContainsKey(key))
+ {
+ this.Log[key] = new List();
+ }
- Log[key].Add($"{DateTime.Now}: {GetChangeDescription(change)}");
+ this.Log[key].Add($"{DateTime.Now}: {ChangeLog.GetChangeDescription(change)}");
}
///
public void Add(IIssue issue, ChangeType change)
{
- Add(issue.Key, change, string.Empty);
+ this.Add(issue.Key, change, string.Empty);
}
///
public void Add(IIssue issue, ChangeType change, string summary)
{
- Add(issue.Key, change, string.Empty);
+ this.Add(issue.Key, change, string.Empty);
}
- private static string GetChangeDescription(ChangeType change)
+ ///
+ public void Clear()
{
- var attribute = typeof(ChangeType)
- .GetField(change.ToString())
- ?.GetCustomAttribute();
- return attribute != null ? attribute.Description : change.ToString();
+ this.hasChanged = true;
+ this.Log.Clear();
}
///
@@ -68,18 +88,16 @@ private static string GetChangeDescription(ChangeType change)
/// the configuration file
public void Save(string file)
{
- if (hasChanged == false)
+ if (!this.hasChanged)
+ {
return;
+ }
try
{
- using var stream = new FileStream(file, FileMode.Create, FileAccess.ReadWrite);
- using var writer = new StreamWriter(stream);
- var serializer = JsonSerializer.Create(new JsonSerializerSettings
- {
- Formatting = Formatting.Indented,
- DefaultValueHandling = DefaultValueHandling.Ignore
- });
+ using FileStream stream = new FileStream(file, FileMode.Create, FileAccess.ReadWrite);
+ using StreamWriter writer = new StreamWriter(stream);
+ JsonSerializer serializer = JsonSerializer.Create(new JsonSerializerSettings { Formatting = Formatting.Indented, DefaultValueHandling = DefaultValueHandling.Ignore });
serializer.Serialize(writer, this, typeof(ChangeLog));
}
catch (Exception ex)
@@ -88,28 +106,12 @@ public void Save(string file)
}
}
- ///
- /// Reads the configuration from a file
- ///
- /// the configuration file
- /// the
- public static ChangeLog Read(string file)
+ private static string GetChangeDescription(ChangeType change)
{
- if (File.Exists(file) == false)
- return new ChangeLog();
-
- try
- {
- using var stream = new FileStream(file, FileMode.Open, FileAccess.Read);
- using var reader = new StreamReader(stream);
- var serializer = new JsonSerializer();
- var configuration = serializer.Deserialize(reader, typeof(ChangeLog)) as ChangeLog;
- return configuration ?? new ChangeLog();
- }
- catch (Exception ex)
- {
- throw new AggregateException($"Unable to deserialize {file} as change log ", ex);
- }
+ DescriptionAttribute? attribute = typeof(ChangeType)
+ .GetField(change.ToString())
+ ?.GetCustomAttribute();
+ return attribute != null ? attribute.Description : change.ToString();
}
}
}
\ No newline at end of file
diff --git a/src/GitIssue/ChangeLogExtensions.cs b/src/GitIssue/ChangeLogExtensions.cs
index 16e4b19..68d02f4 100644
--- a/src/GitIssue/ChangeLogExtensions.cs
+++ b/src/GitIssue/ChangeLogExtensions.cs
@@ -1,9 +1,11 @@
-using System.Text;
+using System.Collections.Generic;
+using System.Text;
+using GitIssue.Issues;
namespace GitIssue
{
///
- /// Extension methods for the change log
+ /// Extension methods for the change log
///
public static class ChangeLogExtensions
{
@@ -14,15 +16,23 @@ public static class ChangeLogExtensions
///
public static string GenerateComments(this IChangeLog log)
{
- var builder = new StringBuilder();
- var count = 0;
- foreach (var changes in log.Log)
+ StringBuilder builder = new StringBuilder();
+ int count = 0;
+ foreach (KeyValuePair> changes in log.Log)
{
- if (count++ > 0) builder.AppendLine();
+ if (count++ > 0)
+ {
+ builder.AppendLine();
+ }
+
builder.AppendLine($"Issue: {changes.Key}");
- foreach (var change in changes.Value) builder.AppendLine($" - {change}");
+ foreach (string change in changes.Value)
+ {
+ builder.AppendLine($" - {change}");
+ }
}
+
return builder.ToString();
}
}
-}
+}
\ No newline at end of file
diff --git a/src/GitIssue/ChangeType.cs b/src/GitIssue/ChangeType.cs
index 7c2a068..6c3528a 100644
--- a/src/GitIssue/ChangeType.cs
+++ b/src/GitIssue/ChangeType.cs
@@ -7,7 +7,8 @@ public enum ChangeType
{
[Description("Created new issue")] Create,
- [Description("Deleted existing issue")] Delete
+ [Description("Deleted existing issue")]
+ Delete,
}
#pragma warning restore 1591
}
\ No newline at end of file
diff --git a/src/GitIssue/Fields/Array/ArrayField.cs b/src/GitIssue/Fields/Array/ArrayField.cs
index 38e0ff4..9de110e 100644
--- a/src/GitIssue/Fields/Array/ArrayField.cs
+++ b/src/GitIssue/Fields/Array/ArrayField.cs
@@ -26,20 +26,62 @@ protected ArrayField(FieldKey key, T[] values) : base(key)
this.values = new List(values);
}
+ ///
+ public int Count => this.values.Count;
+
+ ///
+ public T this[int index]
+ {
+ get => this.values[index];
+ set => this.values[index] = value;
+ }
+
+ ///
+ public T[] Values
+ {
+ get => this.values.ToArray();
+ set => this.values = new List(value);
+ }
+
///
public Type ValueType => typeof(T);
+ ///
+ int ICollection.Count => ((ICollection)this.values).Count;
+
+ bool IList.IsFixedSize => ((IList)this.values).IsFixedSize;
+
+ ///
+ bool IList.IsReadOnly => ((IList)this.values).IsReadOnly;
+
+ bool ICollection.IsReadOnly => ((ICollection)this.values).IsReadOnly;
+
+ ///
+ bool ICollection.IsSynchronized => ((ICollection)this.values).IsSynchronized;
+
+ ///
+ object? IList.this[int index]
+ {
+ get => ((IList)this.values)[index];
+ set => ((IList)this.values)[index] = value;
+ }
+
+ ///
+ object ICollection.SyncRoot => ((ICollection)this.values).SyncRoot;
+
///
object[]? IArrayField.Values
{
- get => Values.Cast