style: enforce braces on all control flow blocks#263
Merged
Conversation
Add csharp_prefer_braces rule to src/.editorconfig since root=true was blocking inheritance from the repo-root config. Run dotnet format to auto-fix all 52 files with braceless if/else/for/foreach/while blocks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR enforces consistent use of braces on all C# control flow blocks across the codebase by adding the csharp_prefer_braces = true : error rule to src/.editorconfig and auto-fixing all violations using dotnet format style --diagnostics IDE0011.
Changes:
- Added
csharp_prefer_braces = true : errortosrc/.editorconfigto enforce braces on all control flow statements - Applied auto-formatting to add braces to 52 files across the entire solution
- Ran CSharpier to ensure consistent formatting after brace additions
Reviewed changes
Copilot reviewed 52 out of 52 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/.editorconfig | Added csharp_prefer_braces rule to overcome root=true blocking inheritance |
| src/AzureEventGridSimulator/Program.cs | Added braces to if statements and foreach loops |
| src/AzureEventGridSimulator/Infrastructure/ValidationIpAddressProvider.cs | Added braces to if statement in lock block |
| src/AzureEventGridSimulator/Infrastructure/Settings/Subscribers/*.cs | Added braces to validation if statements across all subscriber settings |
| src/AzureEventGridSimulator/Infrastructure/Settings/*.cs | Added braces to if/foreach statements in settings classes |
| src/AzureEventGridSimulator/Infrastructure/Middleware/SasKeyValidator.cs | Added braces to if statements in validation logic |
| src/AzureEventGridSimulator/Infrastructure/Mediator/ServiceCollectionExtensions.cs | Added braces to foreach loop |
| src/AzureEventGridSimulator/Infrastructure/Extensions/*.cs | Added braces to if/foreach statements in extension methods |
| src/AzureEventGridSimulator/Infrastructure/Dashboard/DashboardEndpoints.cs | Added braces to if statement |
| src/AzureEventGridSimulator/Domain/Services/Validation/ContentTypeValidator.cs | Added braces to if statements in content type validation |
| src/AzureEventGridSimulator/Domain/Services/Routing/RequestRouter.cs | Added braces to if statements in request routing |
| src/AzureEventGridSimulator/Domain/Services/Retry/*.cs | Added braces to if/while statements in retry logic |
| src/AzureEventGridSimulator/Domain/Services/*.cs | Added braces to if/foreach statements in schema parsers and detectors |
| src/AzureEventGridSimulator/Domain/Services/Delivery/*.cs | Added braces to if/foreach statements in delivery services |
| src/AzureEventGridSimulator/Domain/Services/Dashboard/EventHistoryStore.cs | Added braces to while/if statements |
| src/AzureEventGridSimulator/Domain/Entities/*.cs | Added braces to validation if statements |
| src/AzureEventGridSimulator/Domain/Commands/*.cs | Added braces to foreach loops in command handlers |
| src/AzureEventGridSimulator/Controllers/*.cs | Added braces to if statements in controllers |
| src/AzureEventGridSimulator.Tests/**/*.cs | Added braces to if/for/foreach statements across all test files |
| src/AzureEventGridSimulator.ServiceDefaults/Extensions.cs | Added braces to if statement |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/AzureEventGridSimulator/Infrastructure/Settings/AdvancedFilterSetting.cs
Show resolved
Hide resolved
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
csharp_prefer_braces = true : errortosrc/.editorconfig— theroot = truedirective was blocking inheritance of this rule from the repo-root configdotnet format style --diagnostics IDE0011to auto-fix all bracelessif/else/for/foreach/whileblocks across 52 filesTest plan
🤖 Generated with Claude Code