OS: Ubuntu 19.10
App Version: pre-commit 2.1.0
Trying to create a commit-msg hook with the following hook yaml:
---
- id: conform
name: Conform
description: Run 'conform enforce' for policy enforcement
entry: conform enforce --commit-msg-file
language: golang
stages: [commit-msg]
However, when I run the try-repo command...
➜ pre-commit try-repo --hook-stage commit-msg .
[WARNING] Creating temporary repo with uncommitted changes...
[INFO] Initializing environment for /tmp/tmpinmhjsj2/shadow-repo.
===============================================================================
Using config:
===============================================================================
repos:
- repo: /tmp/tmpinmhjsj2/shadow-repo
rev: a4536d3f16eeddbe6faa39a19b3857b77967bd03
hooks:
- id: conform
===============================================================================
[INFO] Installing environment for /tmp/tmpinmhjsj2/shadow-repo.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: TypeError: expected string or bytes-like object
Check the log at /home/joelinux/.cache/pre-commit/pre-commit.log
The pre-commit.log file shows me this traceback:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/pre_commit/error_handler.py", line 54, in error_handler
yield
File "/usr/local/lib/python3.7/dist-packages/pre_commit/main.py", line 375, in main
return try_repo(args)
File "/usr/local/lib/python3.7/dist-packages/pre_commit/commands/try_repo.py", line 77, in try_repo
return run(config_filename, store, args)
File "/usr/local/lib/python3.7/dist-packages/pre_commit/commands/run.py", line 339, in run
return _run_hooks(config, hooks, args, environ)
File "/usr/local/lib/python3.7/dist-packages/pre_commit/commands/run.py", line 242, in _run_hooks
_all_filenames(args), config['files'], config['exclude'],
File "/usr/local/lib/python3.7/dist-packages/pre_commit/commands/run.py", line 62, in filter_by_include_exclude
filename for filename in names
File "/usr/local/lib/python3.7/dist-packages/pre_commit/commands/run.py", line 63, in <listcomp>
if include_re.search(filename)
TypeError: expected string or bytes-like object
Looking through the code it looks like it's expecting to run the filter_by_include_exclude() method and it attempts to iterate over names which has a value of (None,). Not sure if this is expected behavior but I wouldn't expect a commit-msg hook to filter any files since the only thing it should get is the filename of the commit message?
OS: Ubuntu 19.10
App Version: pre-commit 2.1.0
Trying to create a commit-msg hook with the following hook yaml:
However, when I run the
try-repocommand...The
pre-commit.logfile shows me this traceback:Looking through the code it looks like it's expecting to run the
filter_by_include_exclude()method and it attempts to iterate overnameswhich has a value of(None,). Not sure if this is expected behavior but I wouldn't expect a commit-msg hook to filter any files since the only thing it should get is the filename of the commit message?