-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Removed redundant variable assignment in remote debugger #50870
Conversation
I'm very new to GitHub and contributing to open source projects so if I've done something stupid please let me know :) |
The message needs to be amended to reflect the nature of change, not the line that you've touched. Something like "Remove a redundant assignment in the remote debugger" should suffice. |
@@ -408,7 +408,6 @@ struct RemoteDebugger::PerformanceProfiler { | |||
Variant monitor_value = performance->call("get_custom_monitor", custom_monitor_names[i]); | |||
if (!monitor_value.is_num()) { | |||
ERR_PRINT("Value of custom monitor '" + String(custom_monitor_names[i]) + "' is not a number"); | |||
arr[i + max] = Variant(); |
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.
This change preserves what was the current behavior, but I'm not sure that it's correct.
The intent of this code's author was that in the error case, arr[i + max]
should be Variant()
, not a non-numeral value. So this is probably what needs to be changed (with an else
instead of removing the assignment).
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.
Yeah, that seems to be the case. It slipped my review. Could also be arr[i + max] = 0
instead of Variant()
.
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.
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.
Sorry, I missed this comment, yes, the cast should be automatic and not fail, but better be safe, so I would add the check (setting the value to 0 is not is_num
).
Congrats for your first contribution :) I left a comment on whether this fix is the correct one, we might need input from contributors who know about it to confirm. Aside from this, on the workflow side, we usually want PRs with a self-contained change like this to only contain one commit, so that our Git history stays readable and useful (that's also why we require explicit commit messages so that we can see what a commit does at a glance - you already improved it, see CONTRIBUTING.md for more details for future contributions). For this PR, that means that you should squash the current 3 commits into one using the procedure described in PR workflow. |
Thanks for all of the help! I'll squash the commits and leave the rest of the request as it is (as I am assuming it is bad practice to push further changes mid review) |
415e2c9
to
2756221
Compare
Based on the current feedback you can already change the code. The correct fix would be something like: if (!monitor_value.is_num()) {
ERR_PRINT("Value of custom monitor '" + String(custom_monitor_names[i]) + "' is not a number");
arr[i + max] = 0;
} else {
arr[i + max] = monitor_value;
} |
Thanks for letting me know. I'll go ahead and change that now |
2756221
to
231b9d5
Compare
Your latest push added a merge commit which is not relevant for the merged history, you can remove it by rebasing on the |
cdd7e75
to
a8b42bb
Compare
a8b42bb
to
89c7fce
Compare
60856c3
to
a3f7983
Compare
a3f7983
to
9986f38
Compare
Really sorry about that - something went very wrong when I tried to remove the previous commit. |
4cc729d
to
9986f38
Compare
Sorry for the long pause. You've made the correct change, but we failed to approve it in a timely manner. In the meantime, this was fixed by #59911 alongside other potential code issues. Thanks anyway! |
Bugsquad edit: Fixes #50848.