-
Notifications
You must be signed in to change notification settings - Fork 3
Set up dotnet format and CI enforcement #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1023b14
Add dotnet format config and CI enforcement workflow
hahn-kev d01da57
Fix xUnit1051 and IDE0019 format diagnostics
hahn-kev a50dcd3
Apply dotnet format across the codebase
hahn-kev cb541bc
Consolidate src/.editorconfig into root
hahn-kev 11dab1f
Fix 'CodeQL / Workflow does not contain permissions'
myieye File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| root = true | ||
|
|
||
| # All files | ||
| [*] | ||
| charset = utf-8 | ||
| insert_final_newline = true | ||
| trim_trailing_whitespace = true | ||
| indent_style = space | ||
| indent_size = 4 | ||
|
|
||
| # Project & config files | ||
| [*.{csproj,props,targets,json,yml,yaml}] | ||
| indent_size = 2 | ||
|
|
||
| [*.{md,markdown}] | ||
| trim_trailing_whitespace = false | ||
|
|
||
| # Verify snapshot files — must not be reformatted or snapshot tests break. | ||
| [*.{received,verified}.{txt,xml,json}] | ||
| charset = utf-8-bom | ||
| end_of_line = lf | ||
| indent_size = unset | ||
| indent_style = unset | ||
| insert_final_newline = false | ||
| tab_width = unset | ||
| trim_trailing_whitespace = false | ||
|
|
||
| # Vendored third-party code (C# port of Yjs) — excluded from formatting/analysis. | ||
| # dotnet format skips files marked as generated. | ||
| [src/Ycs/**.cs] | ||
| generated_code = true | ||
|
|
||
| # C# files | ||
| [*.cs] | ||
| # Namespaces | ||
| csharp_style_namespace_declarations = file_scoped:warning | ||
|
|
||
| # 'this.' preferences — prefer omitting | ||
| dotnet_style_qualification_for_field = false:warning | ||
| dotnet_style_qualification_for_property = false:warning | ||
| dotnet_style_qualification_for_method = false:warning | ||
| dotnet_style_qualification_for_event = false:warning | ||
|
|
||
| # Language keywords vs BCL types | ||
| dotnet_style_predefined_type_for_locals_parameters_members = true:warning | ||
| dotnet_style_predefined_type_for_member_access = true:warning | ||
|
|
||
| # var preferences — prefer var when the type is apparent | ||
| csharp_style_var_for_built_in_types = true:suggestion | ||
| csharp_style_var_when_type_is_apparent = true:suggestion | ||
| csharp_style_var_elsewhere = false:suggestion | ||
|
|
||
| # Modern language features | ||
| csharp_style_expression_bodied_methods = when_on_single_line:suggestion | ||
| csharp_style_expression_bodied_properties = true:suggestion | ||
| csharp_style_expression_bodied_accessors = true:suggestion | ||
| csharp_prefer_braces = true:suggestion | ||
| csharp_style_prefer_switch_expression = true:suggestion | ||
| csharp_style_pattern_matching_over_is_with_cast_check = true:warning | ||
| csharp_style_pattern_matching_over_as_with_null_check = true:warning | ||
|
|
||
| # Null checking | ||
| csharp_style_throw_expression = true:suggestion | ||
| csharp_style_conditional_delegate_call = true:suggestion | ||
|
|
||
| # Expression-level preferences | ||
| dotnet_style_object_initializer = true:suggestion | ||
| dotnet_style_collection_initializer = true:suggestion | ||
| dotnet_style_prefer_auto_properties = true:suggestion | ||
| dotnet_style_coalesce_expression = true:suggestion | ||
| dotnet_style_null_propagation = true:suggestion | ||
|
|
||
| # Using directives | ||
| csharp_using_directive_placement = outside_namespace:warning | ||
| dotnet_sort_system_directives_first = true | ||
|
|
||
| # New line preferences (Allman braces — matches existing code) | ||
| csharp_new_line_before_open_brace = all | ||
| csharp_new_line_before_else = true | ||
| csharp_new_line_before_catch = true | ||
| csharp_new_line_before_finally = true | ||
|
|
||
| # Indentation | ||
| csharp_indent_case_contents = true | ||
| csharp_indent_switch_labels = true | ||
|
|
||
| # Spacing | ||
| csharp_space_after_cast = false | ||
| csharp_space_after_keywords_in_control_flow_statements = true | ||
| csharp_space_between_method_declaration_parameter_list_parentheses = false | ||
| csharp_space_between_method_call_parameter_list_parentheses = false | ||
|
|
||
| # Analyzer diagnostics | ||
| # VSTHRD200: do not require the "Async" suffix on async methods | ||
| dotnet_diagnostic.VSTHRD200.severity = none |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| name: Format | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - main | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| format: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install .NET | ||
| uses: actions/setup-dotnet@v4 | ||
|
|
||
| # Verifies the code matches .editorconfig (whitespace + code style + analyzers). | ||
| # Fails the build if anything is out of format. To fix locally, run: | ||
| # dotnet format | ||
| - name: Verify formatting | ||
| run: dotnet format --verify-no-changes | ||
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| using System.Text.Json.Serialization; | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace SIL.Harmony.Core; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| namespace SIL.Harmony.Core; | ||
| namespace SIL.Harmony.Core; | ||
|
|
||
| public class CommitMetadata | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| namespace SIL.Harmony.Core; | ||
| namespace SIL.Harmony.Core; | ||
|
|
||
| public static class CrdtConstants | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| namespace SIL.Harmony.Core; | ||
| namespace SIL.Harmony.Core; | ||
|
|
||
| public class EntityNotFoundException(string message) : Exception(message); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| | ||
|
|
||
| namespace SIL.Harmony.Core; | ||
|
|
||
| /// <summary> | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| using System.Text.Json.Serialization; | ||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace SIL.Harmony.Core; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,4 +27,4 @@ public IObjectBase Copy() | |
| DeletedAt = DeletedAt | ||
| }; | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.