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

Add analyzer RCS0062, put expression body on its own line (#1575) #1593

Merged
merged 7 commits into from
Feb 8, 2025

Conversation

cbersch
Copy link
Contributor

@cbersch cbersch commented Dec 6, 2024

Fixes #1575

Add new analyzer to put an existing expression body on its own line.

@cbersch
Copy link
Contributor Author

cbersch commented Dec 6, 2024

@dotnet-policy-service agree

@cbersch cbersch force-pushed the put-expression-body-on-its-own-line branch from 89144ec to 736c1a7 Compare December 9, 2024 07:53
@cbersch
Copy link
Contributor Author

cbersch commented Dec 9, 2024

@josefpihrt So now I tried to add bool option roslynator_expression_body_style_on_next_line.
The current implementation doesn't work, where I add a new line to the arrow token itself depending on the desired options.
I added one test, which currently fails.

I decided to go with the bool option instead of adding a third value for the expression_body_style, so that the RR0169 can be configured. Otherwise we would need a third refactoring in addition to RR0038 and RR0169 to "Convert block body to expression body on new line" to cover that.

@cbersch cbersch force-pushed the put-expression-body-on-its-own-line branch from 3fc981e to d016f62 Compare January 8, 2025 07:38
@cbersch cbersch force-pushed the put-expression-body-on-its-own-line branch from d016f62 to cd2e100 Compare January 20, 2025 06:59
@cbersch
Copy link
Contributor Author

cbersch commented Jan 25, 2025

@josefpihrt Thanks for the fixes, hopefully I'll get into the coding conventions quickly.

@josefpihrt
Copy link
Collaborator

@cbersch please update changelog

@cbersch
Copy link
Contributor Author

cbersch commented Jan 26, 2025

@josefpihrt Added to changelog

@cbersch cbersch force-pushed the put-expression-body-on-its-own-line branch from c44c0f6 to 9e9ab86 Compare January 31, 2025 08:40
@josefpihrt josefpihrt closed this Feb 2, 2025
@josefpihrt josefpihrt reopened this Feb 2, 2025
Copy link
Collaborator

@josefpihrt josefpihrt left a comment

Choose a reason for hiding this comment

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

Looking really good. I added some final comments and then we are good to go.

@josefpihrt josefpihrt merged commit 4b6dcf5 into dotnet:main Feb 8, 2025
17 checks passed
@josefpihrt
Copy link
Collaborator

@cbersch Great job! I think you were one of the first (if not the first) contributor to implement a new analyzer (including the code fix). Thanks!

@cbersch
Copy link
Contributor Author

cbersch commented Feb 8, 2025

@josefpihrt Thanks for your support, I'm happy to contribute.
Kudos for your awesome tool!

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.

Analyzer that checks the breaking behavior of expression bodies
2 participants