Skip to content

Conversation

@Sergio0694
Copy link
Member

@Sergio0694 Sergio0694 commented Jan 26, 2023

Closes #583

This PR adds a code fixer for ClassUsingAttributeInsteadOfInheritanceAnalyzer.

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 Jan 26, 2023
@Sergio0694
Copy link
Member Author

Hey @Youssef1313, would you have any suggestions on how to handle whitespaces in the code fixer? 😅

@Youssef1313
Copy link
Contributor

Hey @Youssef1313, would you have any suggestions on how to handle whitespaces in the code fixer? 😅

Trivia isn't trivial 😄

Given a quick look, I don't see why there is an extra new line. I'll see if I could debug it.

@Youssef1313
Copy link
Contributor

@Sergio0694 The identifier name already has a trailing EndOfLineTrivia, so when you add a base type, the new line remains. You'll have to remove the trivia from the identifier name. But when other interfaces exist, the trailing trivia of identifier name will be a space that you want to keep.

Instead of having to handle all that manually, which is hard to get right (for example, you need to keep trailing trivia after identifier name even if there is no existing base list if the user uses K&R braces), you can use SyntaxGenerator to handle everything for you.

#590

Youssef1313 and others added 2 commits January 28, 2023 11:38
@Sergio0694 Sergio0694 marked this pull request as ready for review January 28, 2023 10:19
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.

Code fixer for MVVMTK0032 and MVVMTK0033 (inherit from ObservableObject instead of attribute)

2 participants