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

Fix pre-commit hook when called with multiple files #41

Merged
merged 9 commits into from
May 17, 2022

Conversation

abravalheri
Copy link
Owner

@abravalheri abravalheri commented May 16, 2022

The hook added by #40 seems to be called with all the files that match the file name pyproject.toml. However the CLI tool is only able to handle 1 file at time.

This change tries to fix that by allowing the CLI to validate multiple files.

Additionally, since this is the most common use case, the files regular expression is changed to only match pyproject.toml in the project root.

@wwuck, please let me know if you have any objections here.

@abravalheri
Copy link
Owner Author

I am testing the new hook in one of my projects (pyscaffold/pyscaffold#611) that contains other pyproject.toml files (e.g. inside the tests directory).

@abravalheri abravalheri changed the title Prevent pre-commit hook from being called with multiple files Fix pre-commit hook when called with multiple files May 16, 2022
@wwuck
Copy link
Contributor

wwuck commented May 17, 2022

I haven’t tested but looks ok to me. Most projects will only have one file in the top project directory so it shouldn’t be a problem

@abravalheri abravalheri merged commit 802c455 into main May 17, 2022
@abravalheri abravalheri deleted the fix-pre-commit-hook branch May 17, 2022 07:58
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.

None yet

2 participants