Skip to content

Conversation

@Sergio0694
Copy link
Member

Description

This PR adds a new analyzer and code fixer for async void returning [RelayCommand] methods.

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • Tested code with current supported SDKs
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

@Sergio0694 Sergio0694 added mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit analyzer 👓 A new analyzer being implemented or updated labels Jun 7, 2023
@Sergio0694 Sergio0694 force-pushed the dev/async-void-command-analyzer branch from 64e3aea to d843aab Compare June 7, 2023 22:34
@Sergio0694
Copy link
Member Author

cc. @Youssef1313 as usual in case you felt in the mood to double check some analyzers/fixers 😄

@Sergio0694 Sergio0694 force-pushed the dev/async-void-command-analyzer branch from d843aab to ce23265 Compare June 8, 2023 10:04
Copy link
Contributor

@Youssef1313 Youssef1313 left a 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,
Copy link
Contributor

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)

Copy link
Member Author

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 🤔

Copy link
Contributor

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 = ...

Copy link
Member Author

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 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

analyzer 👓 A new analyzer being implemented or updated mvvm-toolkit 🧰 Issues/PRs for the MVVM Toolkit

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants