-
Notifications
You must be signed in to change notification settings - Fork 282
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
Code Cleanup | 123 == x
=> x == 123
etc
#2766
base: main
Are you sure you want to change the base?
Conversation
Have you validated the AI analysis? Usually these come with an asterisk saying "AI content may be incorrect" |
Also @benrr101 please open a tracking issue for this work and describe the significance of doing this for tracking purposes. |
Please hold off on the merge of this PR till we drive #2714 and JSON work to conclusion. |
@saurabh500 the "ai analysis" is provided for your convenience. If you don't trust it, you are free to analyze all 104 changed files, but considering most people's eyes will glaze over after about 5 files, this analysis of the patch file is provided to give a summary of the changes and their safety. Yoda conditions are a name for conditions whose expressions are reversed from their typical ordering. https://en.wikipedia.org/wiki/Yoda_conditions The reason for making these changes is to make the code more readable and supportable by changing the order to what is typical for both programming and the mental english translation ("x is greater than 0" is more natural than "0 is less than x"). If we do not take these changes, nothing happens, although I will be mentally cursing at the code each time I encounter one of these backwards conditions when I have to support it in the future. Considering the support that was given to making similar changes for null comparisons, I believe other engineers will be mentally cursing the code each time they encounter them, as well. Code hygiene is important and in the absence of anyone else feeling brave enough stand up for it, I'll gladly take up that torch. |
Moving to Backlog due to unresolved conflicts. |
Description: In the latest in my series of code cleanup PRs to remove Yoda conditions, this PR flips conditions where
0 == x
tox == 0
. This is also applied for >, >=, <, <=, and !=.AI Analysis:
Testing: Again, if it builds and passes CI, I think it's safe.