Skip to content

Commit

Permalink
chores: add code format in github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ereali-aneo committed Jul 10, 2024
1 parent 8e36459 commit b009350
Show file tree
Hide file tree
Showing 9 changed files with 829 additions and 500 deletions.
164 changes: 164 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
root = true

[*.{appxmanifest,axaml,axml,build,c,config,cs,csproj,cpp,dbml,discomap,dtd,html,js,json,jsproj,lsproj,md,njsproj,nuspec,paml,proj,props,proto,resjson,StyleCop,targets,tasks,vbproj,xaml,xamlx,xml,xoml,xsd}]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

indent_style = space
indent_size = 2
tab_width = 2


[*]
# Microsoft .NET properties
csharp_preferred_modifier_order = public, private, protected, internal, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async:suggestion
csharp_space_after_cast = false
csharp_style_expression_bodied_accessors = true:suggestion
csharp_style_expression_bodied_constructors = true:none
csharp_style_expression_bodied_methods = true:none
csharp_style_expression_bodied_properties = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
dotnet_naming_rule.private_constants_rule.import_to_resharper = as_predefined
dotnet_naming_rule.private_constants_rule.severity = warning
dotnet_naming_rule.private_constants_rule.style = upper_camel_case_style
dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
dotnet_naming_rule.private_instance_fields_rule.import_to_resharper = as_predefined
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_static_fields_rule.import_to_resharper = as_predefined
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 = as_predefined
dotnet_naming_rule.private_static_readonly_rule.severity = warning
dotnet_naming_rule.private_static_readonly_rule.style = upper_camel_case_style
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.lower_camel_case_style.required_prefix = _
dotnet_naming_style.lower_camel_case__style.capitalization = camel_case
dotnet_naming_style.lower_camel_case__style.required_suffix = _
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_instance_fields_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
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_readonly_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = static, readonly
dotnet_separate_import_directive_groups = true
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
file_header_template = This file is part of the ArmoniK project\n\nCopyright (C) ANEO, 2021-$CURRENT_YEAR$. All rights reserved.\n\nLicensed under the Apache License, Version 2.0 (the "License")\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n

# diagnostics
dotnet_diagnostic.ca2213.severity = error

# IDE0018: Inline variable declaration
csharp_style_inlined_variable_declaration = false

# ReSharper properties
resharper_align_linq_query = true
resharper_align_multiline_argument = true
resharper_align_multiline_array_and_object_initializer = true
resharper_align_multiline_binary_patterns = true
resharper_align_multiline_calls_chain = true
resharper_align_multiline_expression = true
resharper_align_multiline_for_stmt = true
resharper_align_multiline_property_pattern = true
resharper_align_multiline_switch_expression = true
resharper_align_multline_type_parameter_constrains = true
resharper_align_multline_type_parameter_list = true
resharper_align_tuple_components = true
resharper_braces_for_for = required
resharper_braces_for_foreach = required
resharper_braces_for_ifelse = required
resharper_braces_for_using = required
resharper_braces_for_while = required
resharper_csharp_align_first_arg_by_paren = true
resharper_csharp_align_multiline_parameter = true
resharper_csharp_align_multiple_declaration = true
resharper_csharp_allow_far_alignment = true
resharper_csharp_indent_size = 2
resharper_csharp_insert_final_newline = true
resharper_csharp_max_line_length = 169
resharper_csharp_naming_rule.private_constants = AaBb
resharper_csharp_naming_rule.private_static_fields = _ + aaBb
resharper_csharp_naming_rule.private_static_readonly = AaBb
resharper_csharp_outdent_commas = true
resharper_csharp_place_type_constraints_on_same_line = false
resharper_csharp_prefer_qualified_reference = false
resharper_csharp_use_indent_from_vs = false
resharper_csharp_wrap_arguments_style = chop_always
resharper_csharp_wrap_chained_method_calls = chop_always
resharper_csharp_wrap_for_stmt_header_style = wrap_if_long
resharper_csharp_wrap_multiple_declaration_style = chop_always
resharper_csharp_wrap_multiple_type_parameter_constraints_style = chop_always
resharper_csharp_wrap_parameters_style = chop_always
resharper_csharp_wrap_ternary_expr_style = chop_always
resharper_indent_anonymous_method_block = true
resharper_indent_text = OneIndent
resharper_int_align = true
resharper_keep_existing_arrangement = false
resharper_local_function_body = expression_body
resharper_max_enum_members_on_line = 1
resharper_nested_ternary_style = expanded
resharper_place_attribute_on_same_line = false
resharper_place_constructor_initializer_on_same_line = false
resharper_place_expr_method_on_single_line = false
resharper_place_expr_property_on_single_line = false
resharper_place_linq_into_on_new_line = false
resharper_place_simple_anonymousmethod_on_single_line = false
resharper_place_simple_embedded_statement_on_same_line = false
resharper_place_simple_initializer_on_single_line = false
resharper_place_simple_property_pattern_on_single_line = false
resharper_enforce_line_ending_style = true
resharper_protobuf_indent_size = 2
resharper_protobuf_tab_width = 2
resharper_protobuf_use_indent_from_vs = false
resharper_trailing_comma_in_multiline_lists = true
resharper_wrap_after_primary_constructor_declaration_lpar = false
resharper_wrap_array_initializer_style = chop_always
resharper_wrap_before_arrow_with_expressions = true
resharper_wrap_before_binary_pattern_op = false
resharper_wrap_before_linq_expression = true
resharper_wrap_linq_expressions = chop_always
resharper_wrap_object_and_collection_initializer_style = chop_always
resharper_wrap_primary_constructor_parameters_style = chop_always
resharper_wrap_property_pattern = chop_always
resharper_xmldoc_indent_text = OneIndent
resharper_xml_indent_size = 2
resharper_xml_tab_width = 2
resharper_xml_use_indent_from_vs = false

# ReSharper inspection severities
resharper_arrange_redundant_parentheses_highlighting = hint
resharper_arrange_this_qualifier_highlighting = hint
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_enforce_foreach_statement_braces_highlighting = warning
resharper_enforce_for_statement_braces_highlighting = warning
resharper_enforce_if_statement_braces_highlighting = warning
resharper_enforce_while_statement_braces_highlighting = warning
resharper_redundant_base_qualifier_highlighting = warning
resharper_suggest_var_or_type_built_in_types_highlighting = hint
resharper_suggest_var_or_type_elsewhere_highlighting = hint
resharper_suggest_var_or_type_simple_types_highlighting = hintroot = true
57 changes: 57 additions & 0 deletions .github/workflows/code-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Code Formatting

on:
pull_request:
workflow_dispatch:

jobs:
format-csharp:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: ${{ github.ref }}

- name: Install .NET Core
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4
with:
dotnet-version: 8.x

- name: Install ReSharper
run: |
dotnet tool install -g JetBrains.ReSharper.GlobalTools --version 2022.3.3
- name: Restore
run: |
dotnet restore ArmoniK.TaskReRunner.sln
- name: Reformat
run: |
jb cleanupcode --profile="Full Cleanup With Headers" ArmoniK.TaskReRunner.sln
- name: Check Diff
id: check-diff
run: |
DIFF="$(git diff --name-only)"
if [ -z "$DIFF" ]; then
echo "OK: Format is clean"
else
echo "Error: Format was not clean"
echo "List of files:"
echo "$DIFF"
git diff
exit 1
fi
- name: Generate patch
if: ${{ failure() && steps.check-diff.conclusion == 'failure' }}
run: |
git diff > patch-csharp.diff
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4
if: ${{ failure() && steps.check-diff.conclusion == 'failure' }}
with:
name: patch-csharp
path: ./patch-csharp.diff
2 changes: 1 addition & 1 deletion ArmoniK.TaskReRunner.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.10.34916.146
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArmoniK.TaskReRunner", "ArmoniK.TaskReRunner.csproj", "{4734A3B6-02C9-4F53-8127-A97F2F6D4DDD}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArmoniK.TaskReRunner", "./src/TaskReRunner/ArmoniK.TaskReRunner.csproj", "{4734A3B6-02C9-4F53-8127-A97F2F6D4DDD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Loading

0 comments on commit b009350

Please sign in to comment.