Commit Graph

78 Commits

Author SHA1 Message Date
Anthony Sottile
017fa5c0b8 Merge pull request #2665 from pre-commit/move-parse-version
move parse_version to pre_commit.clientlib
2023-01-01 17:51:11 -05:00
Anthony Sottile
5425c754a0 move parse_version to pre_commit.clientlib 2023-01-01 17:17:00 -05:00
Anthony Sottile
0a0754e44a special rmtree is not needed for TemporaryDirectory in 3.8+ 2023-01-01 17:12:28 -05:00
marsha
42102a1bfd Remove expected_returncode from CalledProcessError 2022-10-30 15:31:45 -05:00
marsha
84b38f7b89 Change cmd_output_bs retcode arg to a boolean check 2022-10-30 14:49:42 -05:00
Gaige B. Paulsen
a84136d070 Switch pty use to fix solaris
Use the child instead of parent fd when manipulating pty for color.
2022-05-14 09:15:03 +00:00
Anthony Sottile
04de6a2e57 drop python 3.6 support
python 3.6 reached end of life on 2021-12-23
2022-01-18 18:44:20 -05:00
Anthony Sottile
270b539e8f improve coverage pragmas with covdefaults 2.1
Committed via https://github.com/asottile/all-repos
2021-11-29 20:45:40 -05:00
Anthony Sottile
f8e21cb78b add support for dart as a hook language 2021-08-29 08:57:56 -07:00
francisco souza
c598785b6f util: use set instead of tuple in errno check
Co-authored-by: Paul Fischer <70564747+paulhfischer@users.noreply.github.com>
2020-12-06 07:45:31 -08:00
francisco souza
bb0d9573a9 util: also run chmod on EPERM
Writing a test for this one is tricky, because I was seeing the issue
only when the directory being removed is a docker volume, so instead of
getting EACCES we get EPERM.

This is easy to reproduce though. The existing test fails when the
directory being used for the files is a docker volume:

```
% docker run \
	-v $(mktemp -d):/tmp \
	-v ${PWD}:/src \
	-w /src \
	python:3 \
	bash -c 'pip install -e . && pip install -r requirements-dev.txt && python -m pytest tests/util_test.py'
```
2020-12-05 22:26:38 -05:00
Anthony Sottile
24dfeed89c Replace EnvironT with MutableMapping[str, str] 2020-10-28 13:00:25 -07:00
Marc Jay
98d8a3d60f Maintain scalar quoting style when autoupdate re-writes rev
If rev is wrapped in single or double quotes (e.g. due to a yamllint quoted-strings rule), when
re-writing the rev to update it, honour the existing quotation style
2020-05-04 19:29:03 -07:00
Anthony Sottile
03617b2f98 Don't crash out on OSErrors in subprocess calls 2020-03-12 10:52:10 -07:00
Anthony Sottile
67c1beb322 Use covdefaults to handle coveragerc 2020-02-29 14:25:19 -08:00
Anthony Sottile
a64fa6d478 Replace aspy.yaml with sort_keys=False 2020-01-31 17:18:59 -08:00
Anthony Sottile
5779f93ec6 keyword only arguments in some places 2020-01-12 13:39:53 -08:00
Anthony Sottile
34c3a1580a unrelated cleanup 2020-01-12 13:39:53 -08:00
Anthony Sottile
49cf490697 Remove noop_context 2020-01-12 13:39:53 -08:00
Anthony Sottile
2a9893d0f0 mkdirp -> os.makedirs(..., exist_ok=True) 2020-01-12 13:39:53 -08:00
Anthony Sottile
67c2dcd90d Remove pre_commit.five 2020-01-12 13:39:53 -08:00
Anthony Sottile
9000e9dd41 Some manual .format() -> f-strings 2020-01-12 13:39:53 -08:00
Anthony Sottile
aefbe71765 Clean up calls to .encode() / .decode() 2020-01-12 10:46:33 -08:00
Anthony Sottile
327ed924a3 Add types to pre-commit 2020-01-12 10:15:01 -08:00
Anthony Sottile
fa536a8693 mypy passes with check_untyped_defs 2020-01-12 09:27:04 -08:00
Anthony Sottile
ab19b94811 some manual py2 cleanups 2020-01-12 09:27:04 -08:00
Anthony Sottile
30c1e8289f upgrade hooks, pyupgrade pre-commit 2020-01-12 09:27:04 -08:00
Anthony Sottile
b90412742e A few cleanups for CalledProcessError to hopefully make it more readable 2019-12-23 17:46:48 -08:00
Anthony Sottile
7c3404ef1f show color in hook outputs when attached to a tty 2019-10-12 23:17:36 -07:00
Anthony Sottile
f612aeb22b Split out cmd_output_b 2019-10-06 15:16:47 -07:00
Anthony Sottile
795506a486 Fix up some newlines in output 2019-09-24 10:22:44 -07:00
Anthony Sottile
da44d4267e Fix rmtree for readonly directories 2019-05-22 11:04:35 -07:00
Anthony Sottile
b1389603e0 Speed up filename filtering.
Before there was a `getcwd` syscall for every filename which was filtered.

Instead this is now cached per-run.

- When all files are identified by filename only: ~45% improvement
- When no files are identified by filename only: ~55% improvement

This makes little difference to overall execution, the bigger win is
eliminating the `memoize_by_cwd` hack.  Just removing the memoization would
have *increased* the runtime by 300-500%.
2019-01-23 20:48:41 -08:00
Anthony Sottile
bdc58cc33f Teach pre-commit try-repo to clone uncommitted changes 2019-01-01 15:01:36 -08:00
Anthony Sottile
9f60561d6f Replace resources with importlib_resources 2018-10-14 14:37:35 -07:00
Anthony Sottile
ebe5132576 Replace pkg_resources.get_distribution with importlib-metadata 2018-10-14 12:24:59 -07:00
Anthony Sottile
e55f51fb14 Remove unused __popen DI 2018-05-02 11:25:16 -04:00
Anthony Sottile
29033f10ca Move cwd() to tests-only 2018-02-24 16:44:59 -08:00
Rory Prendergast
355196f92e backs out unnecessary blank line 2018-01-02 13:05:41 -08:00
Rory Prendergast
9eadfb92fd reduces line length 2018-01-02 13:05:41 -08:00
Rory Prendergast
e3cf0975f9 Adds whitelist for GIT_* env vars containing only GIT_SSH 2018-01-02 13:05:41 -08:00
Anthony Sottile
18c9e061d8 Small cleanups 2017-09-30 15:53:44 -07:00
Anthony Sottile
0c70fa4229 Use asottile/add-trailing-comma 2017-07-12 18:30:51 -07:00
Anthony Sottile
c65a11ce3d Replace five with six 2017-03-08 14:25:54 -08:00
Anthony Sottile
f000241dcb Local repositories clone a blank repo 2017-02-15 15:36:53 -08:00
Anthony Sottile
ba75867c93 py27+ syntax improvements 2017-01-21 11:49:53 -08:00
Anthony Sottile
a157e1a63f xargs returns nonzero for negate + not found exe (fixes pcre + not found #447) 2016-12-04 15:07:35 -08:00
Anthony Sottile
a7169905dc Centralize logging initialization 2016-11-26 14:19:37 -08:00
Anthony Sottile
b81c9802ae Remove py26 format literals
Resolves #403
2016-09-15 08:41:58 -07:00
Anthony Sottile
57cc50e0ad Remove tarfile_open (tarfile open in 2.7+) 2016-08-31 16:24:30 -07:00