Repository navigation
widget.py: Avoid extra empty lines when message-lines or error-lines is 0 - #2208
Open
Thanatos9404 wants to merge 2 commits into
Open
Thanatos9404 wants to merge 2 commits into
Thanatos9404 wants to merge 2 commits into
Conversation
…is 0 With message-lines set to 0, the detail of a message is truncated away entirely, but LogLine still prints an empty line, a line with only the indentation and another empty line after the message. Likewise, a failure message in verbose mode with error-lines set to 0 skips the log tail, but is still followed by two empty lines instead of the usual one. Only print the message detail when some of it is left, and only add the newline that introduces the failure details when they are printed. Failure messages keep the single empty line that separates them from the next message, and from the next entry in the failure summary. Fixes apache#2145
Render messages with LogLine and check that no empty lines are left behind when message-lines is 0, that a truncated message still reports how many lines were left out, and that a failure message is followed by a single empty line when error-lines is 0. This is a part of apache#2145
Thanatos9404
requested review from
BenjaminSchubert,
abderrahim,
cs-shadow,
gtristan and
juergbi
as code owners
October 19, 2026 18:33
juergbi
reviewed
Oct 20, 2026
| text += self._detail_profile.fmt(log_content) | ||
| text += "\n" | ||
| text += self._indent + self._err_profile.fmt("=" * 70) + "\n" | ||
| extra_nl = True |
Contributor
There was a problem hiding this comment.
Shouldn't this also be moved into the if branches, or is there a reason why this should be set independent of the conditionals?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With message-lines set to 0, the detail of a message is truncated to nothing, but LogLine still prints an empty line, a line holding only the indentation and another empty line after the message. A failure message in verbose mode with error-lines set to 0 is followed by two empty lines instead of one.
The detail is now only printed when some of it is left, and the newline before the failure details is only added when they are shown. Failure messages keep their single trailing empty line, so entries in the failure summary stay separated. Output is unchanged when both options are non-zero.
I added tests in tests/frontend/logging.py that render messages through LogLine, and ran tests/frontend, black, pylint and mypy locally.
Fixes #2145