-
Notifications
You must be signed in to change notification settings - Fork 542
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
Replacing all string formatting with f-strings. #3536
Replacing all string formatting with f-strings. #3536
Conversation
Signed-off-by: Trevor Benson <trevor.benson@gmail.com>
Signed-off-by: Trevor Benson <trevor.benson@gmail.com>
Signed-off-by: Trevor Benson <trevor.benson@gmail.com>
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. |
Signed-off-by: Trevor Benson <trevor.benson@gmail.com>
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.
A lot of this looks good. Have some comments that follow; going solely by comments-to-code ratio it's quite a low potential miss rate though - happy to see that semi-automated conversions are mostly reliable.
I'll be honest I only got through about half of the files at this on this first look before I started to go cross-eyed. Will take another look at this tomorrow or so.
sos/policies/runtimes/crio.py
Outdated
f"{self.run_cmd} {container_id} {quoted_cmd}" | ||
if container_id is not None | ||
else '' | ||
) |
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.
Ditto.
Yeah, mostly. Black didn't do the f-string conversion as I used another tool which I used for static analysis, and is generally very good for replacing formatting and concatenation with f-string. At least for the low-hanging fruit. Black was only for the E501 line length fixes since the first tool is great, but sometimes fails to achieve the intended line lengths. I manually went through the diff of every file after to restore contribution style guidelines, mostly for nested lists but a handful of other idiosyncrasies that stood out on quick pass. I'll add your comments to my checklist and look for additional unintended changes or style breakage. I'll mark this as Draft again until I do the manual review and look back through for the unfixed string formatting. Most look to be multiline strings or other variations the first tool skipped, I had that underway last night, but was trying to make it a single commit with the final changes, instead of many little commits. |
936b5f2
to
7ac50d8
Compare
d5aa5b7
to
b111b59
Compare
Signed-off-by: Trevor Benson <trevor.benson@gmail.com>
b111b59
to
118087f
Compare
I went through each file manually and reviewed its existing styles/syntax. I went with a previous line/PR wins methodology. Meaning if it had a specific style, even if that diverged from the style guide or earlier comments, it wins out as being reviewed and approved previously. This should keep the changes as minimal as possible to the existing code, and keep the file diffs to a minimum number of changed or new lines There are of course a few cases where this changed.
Anything that still has a % string formatting is up for discussion, but if left in place it either:
|
Signed-off-by: Trevor Benson <trevor.benson@gmail.com>
Signed-off-by: Trevor Benson <trevor.benson@gmail.com>
Signed-off-by: Trevor Benson <trevor.benson@gmail.com>
2912a8f
to
07a1054
Compare
I restored the f-strings for the I'll count this as one of the cases that is now up for discussion. Flake8 returns no issues on the @TurboTurtle I believe this is ready for discussion on the build failures since some RPMs appear to build ok, but not packit. I'll go ahead and mark it as ready for review. |
@TurboTurtle @pmoravec Any suggestions on how I should diagnose the packit builds failing while non packit RPM builds appear successful? |
The packit builds are passing. The cirrus jobs are failing due to avocado not being able to tell that the tests are....well, tests. This typically happens when there is something within the test class that prevents python from being able to import the class. Nothing immediately jumps out at me in the diffs, so I'd need to dig into the updated test code a bit more to figure out what's going on here. |
I must have had an old check open via cirrus when I found the error for packit? If they are building fine then I'll review the tests again. Everything was done by hand/manually. However, I did that with the rpm plugin as well and there was something that expected the current format I did not account for there as well. |
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines
This is mostly for checks, and tests and to allow a first review by maintainers for further discussion in #3472.