-
Notifications
You must be signed in to change notification settings - Fork 314
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 new analyzer/fixer for async void [RelayCommand] methods #714
Conversation
64e3aea
to
d843aab
Compare
cc. @Youssef1313 as usual in case you felt in the mood to double check some analyzers/fixers 😄 |
...m.SourceGenerators.Roslyn401.UnitTests/Test_AsyncVoidReturningRelayCommandMethodCodeFixer.cs
Show resolved
Hide resolved
src/CommunityToolkit.Mvvm.CodeFixers/AsyncVoidReturningRelayCommandMethodCodeFixer.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Mvvm.CodeFixers/AsyncVoidReturningRelayCommandMethodCodeFixer.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Mvvm.CodeFixers/AsyncVoidReturningRelayCommandMethodCodeFixer.cs
Outdated
Show resolved
Hide resolved
src/CommunityToolkit.Mvvm.CodeFixers/AsyncVoidReturningRelayCommandMethodCodeFixer.cs
Outdated
Show resolved
Hide resolved
d843aab
to
ce23265
Compare
tests/CommunityToolkit.Mvvm.SourceGenerators.UnitTests/Test_SourceGeneratorsDiagnostics.cs
Show resolved
Hide resolved
...m.SourceGenerators.Roslyn401.UnitTests/Test_AsyncVoidReturningRelayCommandMethodCodeFixer.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
id: AsyncVoidReturningRelayCommandMethodId, | ||
title: "Async void returning method annotated with RelayCommand", | ||
messageFormat: "The method {0} annotated with [RelayCommand] is async void (make sure to return a Task type instead)", | ||
category: typeof(RelayCommandGenerator).FullName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this is already existing for all other descriptors, but I never seen categories to be very long names (CommunityToolkit.Mvvm.SourceGenerators.RelayCommandGenerator
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmh good point. We might want to address this in a separate PR for all descriptors 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note: this will be a breaking change if someone is currently changing severity via dotnet_analyzer_diagnostic.category-TheLongCategoryName.severity = ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. I suppose we could do that in 9.0 then 🙂
Description
This PR adds a new analyzer and code fixer for
async void
returning[RelayCommand]
methods.PR Checklist