jumanjihouse / pre-commit-hooks

git pre-commit hooks that work with http://pre-commit.com/
MIT License
113 stars 52 forks source link

script-must-have-extension gets confused if path contains a dot #53

Closed dan-cohn closed 4 years ago

dan-cohn commented 4 years ago

Both script-must-have-extension and script-must-not-have-extension fail on files that don't have an extension but do have a dot in the path leading up to them. Here are some pathological examples:

my_dir/.foo/executable_script # script-must-not-have-extension complains my_dir/.foo/non_executable_script # script-must-have-extension does not complain

Scripts that begin with a dot are also problematic. For example: my_dir/.script

jumanjiman commented 4 years ago

Thanks, Dan, for reporting this!

I've created https://github.com/jumanjihouse/pre-commit-hooks/pull/54 to fix this. It works for me, including fixtures that match the path names you provided, so I'm going to merge the PR.

If you run into any other corner cases, please reopen this (or a new issue if it won't let you reopen).

Thanks again, -paul

jumanjiman commented 4 years ago

ps. the fix is in tag 2.0.2 https://github.com/jumanjihouse/pre-commit-hooks/releases/tag/2.0.2

dan-cohn commented 4 years ago

@jumanjiman Thank you for fixing this so quickly!