-
Notifications
You must be signed in to change notification settings - Fork 196
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
Cleanup f-strings, logging and formats #443
Cleanup f-strings, logging and formats #443
Conversation
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.
Looked through most of them. 👍
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.
Only checked on the surface, could use some more time when back at a PC keyboard.
There's some semantic differences you should make sure are intended. And some opportunities to fix inconsistent formats while already touching the lines.
Initially I had planned to make this a like-for-like change to ensure no changed behavior. However, if it's wanted (it seems it is) we can fix inconsistencies. |
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.
@acolomb thank you for very valuable feedback 👌 . I will review and post an update.
* Apply suggestions from code review * Fixup minor syntax fixes Co-authored-by: Erlend E. Aasland <[email protected]>
* Fixup hex printing
I made the liberty to merge PR #442 into this PR and close 442. The PRs did get into each other's feet. |
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's a lot to review, but I think I've seen all and marked additional fixes spotted.
Thank you for the review. Before diving into the comments: I see that we tend to think "while at this, why can't just fix...". I'm worried that by fixing this, we mix the PR that makes no change to behavior with improvements that does. Do we care about that here? Other projects I've been involved with wants to keep them separate. |
In general, yes. No-op formatting or internal changes should be separated from feature work. But in this case, it'll get ridiculous to touch the same line in two PRs when it's only cleanup. Especially when there would be an intermediate step (e.g. changing to f-string first, then adjusting for hex output) which no-one cares about. |
Fixes part 1 Co-authored-by: André Colomb <[email protected]>
* Change print statements to use pretty_index() * Updates from code review
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.
I think this is good to go. Maybe one last look when I'm less tired. There's two unresolved conversations left, but only with partly unrelated questions, so they shouldn't prevent this from going over the finish line.
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.
Two more small issues that I'd like your opinion on. @sveinse
@acolomb I didn't see your latest replies about But reading the comments, do we want to revert this one? |
I'd vote for reverting, yes. Sorry for the confusion. I just misread your "outweighs the downsides" comment. Note that conditional evaluation of the formatting is not really the only benefit from using the %-formatting for logging. The biggest advantage I see is that |
883af8a
to
7129fed
Compare
@acolomb I have reverted the last commit and resolved the comments regarding formatting. As far as I can tell, I think I have completed all follow-up tasks, wouldn't you agree? |
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 for the back and forth on the last two changes. I simply saw the index (int) being formatted as string and wanted consistency with many other places where we use 0x%04X
formatting in logging calls. Calling for pretty_index()
usage here feels overkill as discussed, and as you noticed yourself, there are many other places where that could be applied as well then.
Let's just harmonize on printing in hex in these two cases (like elsewhere) and call it good.
Thank you very much for your patience and diligence in this cleanup effort! Nice to see people attending to detail and working to reduce our technical debt. 🥇 |
This PR changes all occurrences of
%
formatting andstr.format()
to f-strings.Please review, as it is easy to sneak in a typo in these changes.