-
-
Notifications
You must be signed in to change notification settings - Fork 302
fix(Init): raise InitFailedError on keyboard interrupt on pre-commit … #1604
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
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v4-9-2 #1604 +/- ##
=========================================
Coverage ? 98.32%
=========================================
Files ? 58
Lines ? 2684
Branches ? 0
=========================================
Hits ? 2639
Misses ? 45
Partials ? 0
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:
|
6663767 to
38e1e98
Compare
| if hook_types is None: | ||
| hook_types = ["commit-msg", "pre-push"] |
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.
This branch is redundant. hook_types is never None as we already checked it at callsite.
|
Just adding a note that I have confirmed the issue with @Lee-W offline |
|
|
||
| def _gen_pre_commit_cmd(self, hook_types: list[str]) -> str: | ||
| """Generate pre-commit command according to given hook types""" | ||
| if not hook_types: |
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.
This not hook_types is again redundant.
| c = cmd.run(cmd_str) | ||
| if c.return_code != 0: | ||
| raise InitFailedError( | ||
| "Failed to install pre-commit hook.\n" |
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.
Just added this line to keep the original behavior.
| if not self.project_info.is_pre_commit_installed: | ||
| raise InitFailedError( | ||
| "Failed to install pre-commit hook.\n" | ||
| "pre-commit is not installed in current environment." |
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.
This line is also added to keep the original behavior.
2bc7b48 to
0064a9e
Compare
|
Added some more changes related to |
…hook question, simplify logic, remove unreachable code path
0064a9e to
71d98ab
Compare
…hook question, remove unreachable code path
Description
Checklist
Code Changes
poetry alllocally to ensure this change passes linter check and testsDocumentation Changes
poetry doclocally to ensure the documentation pages renders correctlyExpected Behavior
Steps to Test This Pull Request
Additional Context