chore: replace percent strings for logging#1448
Conversation
| max_nvra_length = max(len(nvra) for nvra in package_info) | ||
|
|
||
| header = ( | ||
| "%-*s %-*s %s" |
There was a problem hiding this comment.
I've got this from Grok AI since it's been long since I wrote that code:
%-*s in print("%-*s" % (width, "text")) is a format specifier where: * means the width of the field is given by the first argument in the tuple (width in this case). - means left-align the text within that width. s means it's formatting a string.```
The format() replacement would look like print("{:<{}}".format("text", width)).
{:<{}} means: < aligns the text to the left. {} specifies the field width.```
There was a problem hiding this comment.
I checked on my own using https://pyformat.info/ and found a solution that looks a bit better
bf0c24f to
d78a11d
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1448 +/- ##
=======================================
Coverage 96.11% 96.11%
=======================================
Files 72 72
Lines 5176 5176
Branches 895 895
=======================================
Hits 4975 4975
Misses 119 119
Partials 82 82
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/packit test --labels sanity |
1 similar comment
|
/packit test --labels sanity |
|
/packit retest-failed |
|
/packit build |
d78a11d to
f11ae9b
Compare
updates: - [github.com/astral-sh/ruff-pre-commit: v0.7.3 → v0.8.2](astral-sh/ruff-pre-commit@v0.7.3...v0.8.2) - [github.com/teemtee/tmt.git: 1.38.0 → 1.39.0](https://github.com/teemtee/tmt.git/compare/1.38.0...1.39.0) - [github.com/jendrikseipp/vulture: v2.13 → v2.14](jendrikseipp/vulture@v2.13...v2.14)
This replaces logging with their best counterpart. Either normal logging methods with arguments, or by utilizing `.format()`
This changes `%-*s %-*s %s` %-string to their format counterpart `%-*s` = left-padded with next %-parameter indicating substring length or precision length.
f11ae9b to
a5d59e8
Compare
|
/packit test --labels sanity |
2 similar comments
|
/packit test --labels sanity |
|
/packit test --labels sanity |
This replaces logging with their best counterpart. Either normal logging
methods with arguments, or by utilizing
.format()Depends on #1431