-
Notifications
You must be signed in to change notification settings - Fork 6.5k
chore: Improve checkResourceStatus readability #21260
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
Conversation
Signed-off-by: Boxuan Tang <[email protected]>
❗ Preview Environment undeploy from Bunnyshell failedSee: Environment Details | Pipeline Logs Available commands (reply to this comment):
|
terrytangyuan
left a comment
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.
Can you fix the typo in the PR title?
Signed-off-by: Boxuan Tang <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21260 +/- ##
=========================================
Coverage ? 60.07%
=========================================
Files ? 343
Lines ? 57848
Branches ? 0
=========================================
Hits ? 34750
Misses ? 20328
Partials ? 2770 ☔ View full report in Codecov by Sentry. |
| } | ||
| } else { | ||
| healthCheckPassed = true | ||
| } |
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.
It may be more Go-style to init the variable as true and avoid else block this way.
reggie-k
left a comment
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.
Thanks for improving this code! LGTM with addressing Andrii's comment.
Signed-off-by: Boxuan Tang <[email protected]>
| return false | ||
| } | ||
|
|
||
| healthBeingChecked := watch.suspended || watch.health || watch.degraded |
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.
You don't have to init the variable and can just put a condition inline. But it's a small thing.
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.
Hmm, I thought it would be more readable that way as it is more obvious that the code is determining if one of the health conditions is being checked. Also happy to inline it if others feel differently.
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.
Idk, this way works too.
Signed-off-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Boxuan Tang <[email protected]> Signed-off-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Alexandre Gaudreault <[email protected]> Signed-off-by: Kanika Rana <[email protected]>
Signed-off-by: Boxuan Tang <[email protected]> Signed-off-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Alexandre Gaudreault <[email protected]> Signed-off-by: Oliver Gondža <[email protected]>
Signed-off-by: Boxuan Tang <[email protected]> Signed-off-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Alexandre Gaudreault <[email protected]>
Signed-off-by: Boxuan Tang <[email protected]> Signed-off-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Alexandre Gaudreault <[email protected]> Signed-off-by: dsuhinin <[email protected]>
Signed-off-by: Boxuan Tang <[email protected]> Signed-off-by: Alexandre Gaudreault <[email protected]> Co-authored-by: Alexandre Gaudreault <[email protected]> Signed-off-by: dsuhinin <[email protected]>
The previous
checkResourceStatusfunction was not very readable as it listed each combination of watch options for health, and this PR aims to simplify and improve the readability of the heath checks incheckResourceStatusfunction.