-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix(console): do not fail on warnings on check command #9983
Conversation
Reviewer's Guide by SourceryThis pull request introduces a new Sequence diagram for Poetry check command behaviorsequenceDiagram
actor User
participant CLI
participant CheckCommand
User->>CLI: poetry check [--strict]
CLI->>CheckCommand: handle()
CheckCommand->>CheckCommand: validate and check
Note over CheckCommand: Collect errors and warnings
alt has errors OR (has warnings AND strict mode)
CheckCommand-->>CLI: return code 1
CLI-->>User: Show errors/warnings & exit 1
else no errors AND (no warnings OR not strict)
CheckCommand-->>CLI: return code 0
CLI-->>User: Show "All set!" & exit 0
end
State diagram for check command return statusstateDiagram-v2
[*] --> Checking
Checking --> HasErrors: Errors found
Checking --> HasWarnings: Only warnings found
Checking --> Success: No issues
HasErrors --> Failure: return 1
HasWarnings --> StrictMode: --strict
HasWarnings --> Success: no --strict
StrictMode --> Failure: return 1
Success --> [*]: return 0
Failure --> [*]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @finswimmer - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
src/poetry/console/commands/check.py
Outdated
|
||
return 0 | ||
if return_code == 0: |
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.
issue: The 'All set!' message might be misleading when warnings are present
Consider only showing 'All set!' when there are no errors AND no warnings, regardless of the no-strict setting. Currently, it will show 'All set!' followed by warnings when no-strict is enabled.
I'm inclined to agree with the camp that thinks that warnings should not have resulted in exit code 1 in the first place. Warnings are only warnings, only errors are errors. so I'd vote that way rather than throw more flags at it Perhaps a |
I agree with you. But @Secrus and I had a short conversation about it on discord. Changing the current default, would be a breaking change. Of course one could argue, the current behavior is a bug and the change is only a fix ... Would like to hear opinions from the other maintainers. |
"breaking" only in rather a weak sense of not failing where it could have done. I doubt that this will actually break anything for anyone, though it might cause them to not notice warnings. imo 2.0 is sufficiently recent and the current behaviour is sufficiently unpopular that it is ok to rip the bandage and do what we think is right. Having to wait for poetry 3.0 to address this paper cut of backwards defaults seems worse in the long run. (unless the team anticipates more regular major releases and 3.0 is relatively close...) |
Current behavior definitely feels more like a bug. There was no transition period with warnings from poetry. This has resulted in breaking many production CI pipelines. there is a command, If the intention is for poetry check to throw exit 1, then these warnings should just be thrown as errors. imo it is bad form to suddenly have an exit 1 for warnings. Especially with no prior warning to users. |
in fact warnings from |
Just to add my voice to the conversation, I tend to agree that current behavior is a bug. We should not fail on warnings. It could be considered a breaking change if we are to assume that the current behavior is intentional. It really is not. I am also cautiously optimistic that the change in behavior will not break anyone's already passing CI environments as one would assume they are already in-effect passing on a strict check. Further, historically we only really consider cli interference changes as breaking change candidates. My vote here is to change behavior to not fail on warnings and ass a |
Pedantically speaking, it feels like a breaking change. However, I agree that in the long run, it is better to consider it as bugfix and do it the way it feels right ( |
2bf2115
to
1db972f
Compare
check
command for warnings handling
Ok, I changed the behavior. |
1db972f
to
5cd312c
Compare
@sourcery-ai review |
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.
Hey @finswimmer - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
LGTM
Old behavior is retained by new parameter `--strict`.
5cd312c
to
3bfa4cb
Compare
Pull Request Check List
Old behavior is retained by new parameter
--strict
.Resolves: #9971
Summary by Sourcery
Add the
--strict
option to thecheck
command to make it fail if warnings are reported. By default, the command will only report warnings and exit with a success code.New Features:
--strict
option to thepoetry check
command.Tests:
--strict
option.