X Tutup
Skip to content

fix: use rprint instead of click.echo for Rich markup error messages#1437

Open
frankgoldfish wants to merge 1 commit intopython-semantic-release:masterfrom
frankgoldfish:fix/version-error-message-not-formatted-1423
Open

fix: use rprint instead of click.echo for Rich markup error messages#1437
frankgoldfish wants to merge 1 commit intopython-semantic-release:masterfrom
frankgoldfish:fix/version-error-message-not-formatted-1423

Conversation

@frankgoldfish
Copy link

Problem

When running semantic-release --verbose --noop --strict version with no new commits since the last release, the error message is printed with literal Rich markup tags instead of formatted text:

Actual: [bold orange1]No release will be made, ...
Expected: Formatted bold orange message

Root cause

In cli/commands/version.py, the if opts.strict branch uses click.echo(err_msg, err=True) which doesn't process Rich markup. The non-strict path correctly uses rprint(err_msg).

Fix

Replace click.echo(err_msg, err=True) with rprint(err_msg, file=sys.stderr) so both paths render Rich markup consistently.

Fixes #1423

When `semantic-release version` is run with `--strict` and no new
commits have been found, the error message containing Rich markup
([bold orange1]...) was passed to `click.echo()` instead of
`rprint()`, causing the markup tags to be printed literally rather
than rendered as formatted text.

The non-strict path correctly used `rprint()`. This commit makes the
strict path consistent by also using `rprint(file=sys.stderr)` to
render the markup before writing to stderr.

Fixes python-semantic-release#1423
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

error message misformatted

1 participant

X Tutup