-
Notifications
You must be signed in to change notification settings - Fork 570
[report] Fix html formatting for Plugin section #3781
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?
Conversation
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
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 thoughts, no particular preference on either:
-
We are only using these in 2 places, we could simply do the f-string in-line instead of breaking it out into a function. We haven't really made any major changes to how the HTML reports are generated for in a very long time so I doubt we're going to be expanding the use of these any time soon.
-
If we keep it as a function, then we don't use camelCase in sos, and PEP8 explicitly discourages it
Fair enough. The problem I tried to solve was for example with PLUGLISTITEM, we have a definition for plain text and another one for html, and while setting the variable via f-strings was a bit tricky. Do you know if there's a pythonic way to use f-strings with strings defined as variables like PLUGLISTITEM?
Sorry, it seems that old habits die hard... |
Replying to myself: List comprehension won't be the best approach here, because we are concatenating the result. Perhaps an old fashioned if/then could be simpler. |
As we use the
|
@pmoravec I think this may work as well. |
No strong preference. Just the %s-strings are quite obsolete (citation needed) and we might rather use |
Hi @jcastill , are you planning to update the PR..? |
@pmoravec will push a new PR with your suggestion asap. |
5018d7c
to
b88ead3
Compare
rpm build for Fedora 40 issue fixed by #4014 |
Could you please rebase your PR there? |
Ack, will do it this morning |
After moving from .format() to f-strings via 57d2134, the formatting for Plugin sections was lost. Related: sosreport#3780 Co-authored-by: Pavel Moravec <[email protected]> Signed-off-by: Jose Castillo <[email protected]>
b88ead3
to
875d86e
Compare
line += f" {section_name}" | ||
line += self.PLUGLISTITEM % {'name': section_name} |
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 removes leading spaces - isnt it a problem?
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 didn't see an issue when I checked the result, but I'll add the spaces to keep the same format
line_buf.append(f"{section_name}") | ||
line_buf.append(self.PLUGINFORMAT % {'name': section_name}) |
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.
Why the current f-string cant be used? (ditto for self.PLUGLISTITEM
)
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 used f-strings originally but then I used your approach as per #3781 (comment)
After moving from .format() to f-strings via
57d2134, the formatting for Plugin sections was
lost. This patch attempts to fix this while still
using f-strings.
Related: #3780
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines