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

Add --check-change option, for pre-commit export hook #252

Closed
wants to merge 3 commits into from

Conversation

noamraph
Copy link

@noamraph noamraph commented Dec 19, 2023

This is required to fix python-poetry/poetry#8512 / #237.

Currently, the poetry-export pre-commit hook returns 0 even when it changes the requirements.txt file. As written here, pre-commit hooks should return a nonzero value when modifying files. This is required in order to make pipelines fail if files are not as expected - in this case, if the requirements.txt file was not updated.

I added a --check-change option, which causes poetry export to return 1 if it changed the output. python-poetry/poetry#8810 in the main poetry repository changes the hook to add the --check-change option.

Note: I didn't add a test yet. If you approve of the approach, I'll happily add a test.

Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

1 New issue
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@noamraph
Copy link
Author

noamraph commented Dec 21, 2023

I think that this change isn't needed - it turns out that pre-commit checks if the content was changed, and doesn't require a nonzero return code.

See: pre-commit/pre-commit.com#912 (comment)

@noamraph noamraph closed this Dec 21, 2023
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.

poetry-export pre-commit hook doesn't fail the commit/push
1 participant