Skip to content
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

poetry check: distinguish warnings from errors? #9971

Closed
seub opened this issue Jan 6, 2025 · 3 comments · Fixed by #9983
Closed

poetry check: distinguish warnings from errors? #9971

seub opened this issue Jan 6, 2025 · 3 comments · Fixed by #9983
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@seub
Copy link

seub commented Jan 6, 2025

Issue Kind

Brand new capability

Description

poetry check exits with error code 1 even when there are only warnings and no hard errors.

This is standard UNIX behavior, but it makes it impossible to distinguish warnings from hard errors.

Example scenario

When upgrading Poetry to 2.0, my project.toml file caused poetry check to raise warnings, and exit with exit code 1:

Screenshot 2025-01-06 at 3 39 20 PM

I don't have a problem with that, but it seems inconvenient that there is no way to check for warnings vs hard errors.

Suggested solutions

Here are two ideas:

  1. Exit with error code 2 when there are only warnings and no hard errors
  2. Add a flag --soft-warnings causing poetry check to pass (exit code 0) when there are only warnings and no hard errors

Workarounds

Suboptimal workaroung:

poetry check || echo "Some errors or warnings were raised by 'poetry check'"
@seub seub added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Jan 6, 2025
@gridhead
Copy link

gridhead commented Jan 7, 2025

As mentioned before here #9965 (comment),

I'm going to chime in having the same observations as @Zlopez here with a couple of my projects.

If those are warnings - a non-zero exit code coming as a result of an impending release breaks things.

Context. https://github.com/fedora-infra/mdapi/actions/runs/12646184815/job/35236500953

image

Context. https://github.com/fedora-infra/firmitas/actions/runs/12624139412/job/35173984552#step:5:21

image

@futurwasfree
Copy link

+1 here this one stops us from migration to 2.0

@przemyslaw-sitek
Copy link

poetry check exits with error code 1 even when there are only warnings and no hard errors.

This is standard UNIX behavior, but it makes it impossible to distinguish warnings from hard errors.

I disagree. Most tools report success exit code if no errors were encountered, and tools that do, that feature requires explicit opt-in. For example gcc returns 0 exit code unless -Werror (Make all warnings into errors) option was explicitly provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants