-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix null checks in KeyboardTypeConverter #30562
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
base: main
Are you sure you want to change the base?
fix null checks in KeyboardTypeConverter #30562
Conversation
Hey there @@SimonCropp! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
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.
Pull Request Overview
This PR cleans up the null-check logic in the KeyboardTypeConverter
, removing redundant checks and simplifying how reflection calls retrieve static fields and properties.
- Removed unnecessary null checks around
parts
, sinceSplit
never returns null. - Dropped null-conditional operators on
GetFields()
andGetProperties()
and simplified the conditional checks. - Streamlined matching logic for both static fields and properties.
Comments suppressed due to low confidence (2)
src/Core/src/Converters/KeyboardTypeConverter.cs:26
- Add unit tests for both conversion formats (with and without the "Keyboard" prefix) to ensure these branches behave as expected after the cleanup.
if (parts.Length == 1 || (parts.Length == 2 && parts[0] == "Keyboard"))
src/Core/src/Converters/KeyboardTypeConverter.cs:30
- [nitpick] The variable name
keyboard
can be confused with theKeyboard
type; consider renaming it tokeyboardName
or similar for clarity.
string keyboard = parts[parts.Length - 1];
What does this fix? |
@rmarinho it remove redundant and misleading code |
/rebase |
2facf5b
to
c22c5f0
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
No description provided.