Commit Graph

15 Commits

Author SHA1 Message Date
Anthony Sottile a49f812a96 py39+
Committed via https://github.com/asottile/all-repos
2024-10-11 19:30:07 -04:00
pre-commit-ci[bot] effeb7a743 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2024-07-29 22:00:04 +00:00
Kurt von Laven 2cbabf90cc
Check Git core.fileMode rather than infer from OS.
There was already a guard preventing the check-executables-have-shebangs
hook from raising false positives on win32 by looking up the Git file
mode rather than relying on the file mode in the file system. Git already
automatically probes the file system for executable bit support. Leverage
Git's core.fileMode config variable to prevent false positives on all
file systems that don't track executable bits.
2022-04-28 11:23:36 -07:00
Anthony Sottile 8f6152921e drop python3.6 support
python 3.6 reached end of life on 2021-12-23

Committed via https://github.com/asottile/all-repos
2022-01-15 19:24:05 -05:00
Pujit Mehrotra 16bc739ce7 Suggest usable call when exec files lack shebang on Windows
Resolves Issue #686
2021-12-07 15:53:54 -05:00
Anthony Sottile 39ab2ed85e replace exit(main()) with raise SystemExit(main())
Committed via https://github.com/asottile/all-repos
2021-10-23 13:23:50 -04:00
Ville Skyttä 9e7cd9f13a Refactor check_executables_have_shebangs for git ls-files reuse 2021-05-04 18:45:42 -07:00
Ville Skyttä dae0cbd2fa check_executables_have_shebangs: avoid unneeded shebang reads on win32 2021-01-08 16:22:33 +02:00
Mikhail Khvoinitsky 1e87d59a2d New hook 'destroyed-symlinks' to detect symlinks which are changed to regular files with a content of a path which that symlink was pointing to; move zsplit to util 2020-11-18 11:45:05 -08:00
Timothée Mazzucotelli 4faed34fbc Fix parsing of git output with unusual characters
On Windows, all files are "executable".
Therefore, to know if a file is supposed to be executed,
we check how its attributes were recorded by git:
we run a `git ls-files` command in a subprocess.

By default, this command outputs information
on multiple lines (file and their data separated by newlines).
When a file contains an unusual character,
the character is escaped with an integer sequence
(such as `\303\261`), and git wraps the whole filename
in double-quotes because of the backslashes.
It breaks the current code because we try to open
the filename containing the double-quotes:
it doesn't exist, of course.

Instead of trying to fix this special case by removing
the double-quotes, and breaking other cases
(a double-quote is a valid filename character on Linux),
we tell git to separate each item with the null character `\0`
instead of a new line `\n`, with the option `-z`.
With this option, git doesn't escape unusual characters
with integer sequence, so the output is fixed, and we
parse it by splitting on `\0` instead of `\n`.

Fixes #508.
2020-07-30 11:58:24 -07:00
Max Rozentsveyg 5195ba3449 Check git mode on Windows 2020-05-18 16:11:10 -07:00
Anthony Sottile f5c42a050b pre-commit-hooks: python3.6+ 2020-02-05 11:22:18 -08:00
Anthony Sottile 4575652bd2 Use default flake8 config 2019-02-11 19:56:15 -08:00
Anthony Sottile 030bfac7e4 Apply typing to all of pre-commit-hooks 2019-01-31 20:09:15 -08:00
Chris Kuehl 13991f09d2 Add a checker for executables without shebangs 2017-07-02 21:14:25 -07:00