-
-
Notifications
You must be signed in to change notification settings - Fork 301
Closed
Labels
bugSomething isn't workingSomething isn't workinguse casenot quite a feature and not quite a bug, something we just didn't think ofnot quite a feature and not quite a bug, something we just didn't think of
Description
Describe the bug
While trying to run pre-commit as a post-write hooks, I encountered a failure. My config was
hooks = pre-commit
pre-commit.type = console_scripts
pre-commit.entrypoint = pre-commit
pre-commit.options = run --files
The failure occurred because the pre-commit command was being run as
pre-commit /path/to/revision_file.py run --filesinstead of
pre-commit run --files /path/to/revision_file.pyExpected behavior
The documentation states:
The path of the revision file is sent as a single positional argument to the script after the options.
However, checking the code, this is not the case, as it is being passed as the first argument.
Additional note
The command line options are being split using str.split(), but for command line options it's much better to use shlex.split() since that properly handles things like quoting.
PR incoming...
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinguse casenot quite a feature and not quite a bug, something we just didn't think ofnot quite a feature and not quite a bug, something we just didn't think of