Skip to content
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

SA1520 consistent use of opening and closing braces on if statements #7198

Merged
merged 2 commits into from
Jan 10, 2022

Conversation

elachlan
Copy link
Contributor

@elachlan elachlan commented Jan 2, 2022

Copy link
Member

@sharwell sharwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Consider updating the .globalconfig to increase the severity of SA1520 to warning. Also note that you can achieve similar results using built-in code analysis rule IDE0011:

# IDE0011: Add braces
csharp_prefer_braces = when_multiline:warning
dotnet_diagnostic.IDE0011.severity = warning

@elachlan
Copy link
Contributor Author

elachlan commented Jan 3, 2022

💡 Consider updating the .globalconfig to increase the severity of SA1520 to warning. Also note that you can achieve similar results using built-in code analysis rule IDE0011:

# IDE0011: Add braces
csharp_prefer_braces = when_multiline:warning
dotnet_diagnostic.IDE0011.severity = warning

If #7192 is merged first, then we can enable the rule/s in the .globalconfig

Copy link
Member

@Forgind Forgind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistency is good, but having unnecessary curly braces always feels wasteful to me. Little bittersweet, but I believe others were less equivocal when we talked about it.

src/Deprecated/Engine/Choose/GroupingCollection.cs Outdated Show resolved Hide resolved
@Forgind Forgind merged commit cefeea2 into dotnet:main Jan 10, 2022
@elachlan elachlan deleted the SA1520 branch January 10, 2022 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants