Compare commits

...

267 commits
v4.2.0 ... main

Author SHA1 Message Date
anthony sottile
f1dff44d3a
Merge pull request #1227 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-12-22 16:55:44 -05:00
pre-commit-ci[bot]
a77d5edb63
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v3.1.0 → v3.2.0](https://github.com/asottile/setup-cfg-fmt/compare/v3.1.0...v3.2.0)
2025-12-22 20:26:27 +00:00
anthony sottile
5dcc56558c
Merge pull request #1222 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-12-15 16:04:03 -06:00
pre-commit-ci[bot]
a780519d03
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.19.0 → v1.19.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.19.0...v1.19.1)
2025-12-15 20:48:45 +00:00
anthony sottile
6e513a2e71
Merge pull request #1217 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-12-01 16:11:12 -05:00
pre-commit-ci[bot]
401fb65f54
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.18.2 → v1.19.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.18.2...v1.19.0)
2025-12-01 21:05:20 +00:00
anthony sottile
e59bbe6db7
Merge pull request #1215 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-11-25 10:52:14 -05:00
pre-commit-ci[bot]
ce6aed3bbe
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.21.1 → v3.21.2](https://github.com/asottile/pyupgrade/compare/v3.21.1...v3.21.2)
2025-11-24 20:53:37 +00:00
anthony sottile
459b301556
Merge pull request #1213 from pre-commit/check-docstring-first-deprecated
deprecate check-docstring-first without replacement
2025-11-22 15:23:59 -05:00
anthony sottile
d2cf95b9cf deprecate check-docstring-first without replacement
this hook has unfixable false positives and is not that useful

perhaps someone can write a flake8 plugin to replace the functionality
2025-11-22 15:21:07 -05:00
anthony sottile
f4e025486b
Merge pull request #1209 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-11-10 16:54:00 -05:00
pre-commit-ci[bot]
1592578eeb
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.21.0 → v3.21.1](https://github.com/asottile/pyupgrade/compare/v3.21.0...v3.21.1)
2025-11-10 20:59:49 +00:00
anthony sottile
3fed74c572
Merge pull request #1202 from pre-commit/fix-builtin-literal-check
fix nested calls for check-builtin-literals
2025-10-16 09:35:52 -04:00
Anthony Sottile
a804ba5239 fix nested calls for check-builtin-literals 2025-10-16 09:30:42 -04:00
anthony sottile
9ba250d7b3
Merge pull request #1200 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-10-13 16:53:54 -04:00
pre-commit-ci[bot]
b51ca91889
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v2.8.0 → v3.1.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.8.0...v3.1.0)
- [github.com/asottile/reorder-python-imports: v3.15.0 → v3.16.0](https://github.com/asottile/reorder-python-imports/compare/v3.15.0...v3.16.0)
- [github.com/asottile/add-trailing-comma: v3.2.0 → v4.0.0](https://github.com/asottile/add-trailing-comma/compare/v3.2.0...v4.0.0)
- [github.com/asottile/pyupgrade: v3.20.0 → v3.21.0](https://github.com/asottile/pyupgrade/compare/v3.20.0...v3.21.0)
2025-10-13 20:38:50 +00:00
anthony sottile
8e6ea961b7
Merge pull request #1197 from pre-commit/all-repos_autofix_all-repos-manual
py310+
2025-10-10 12:09:55 -04:00
anthony sottile
3411068391 py310+
Committed via https://github.com/asottile/all-repos
2025-10-09 17:44:52 -04:00
Anthony Sottile
a2cdab0afe
Merge pull request #1194 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-09-23 09:36:33 -04:00
pre-commit-ci[bot]
9148219126
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.18.1 → v1.18.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.18.1...v1.18.2)
2025-09-22 20:44:07 +00:00
Anthony Sottile
3ab664f766
Merge pull request #1192 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-09-19 13:51:26 -04:00
pre-commit-ci[bot]
0925e7a9d1
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.17.1 → v1.18.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.17.1...v1.18.1)
2025-09-15 20:23:54 +00:00
anthony sottile
e5e94e8702 what year is it? 2025-08-09 15:27:15 -04:00
anthony sottile
3e8a870326 v6.0.0 2025-08-09 15:24:33 -04:00
Anthony Sottile
a8f86514f4
Merge pull request #1185 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-08-04 18:09:18 -04:00
pre-commit-ci[bot]
1acd88e5a4
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.17.0 → v1.17.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.17.0...v1.17.1)
2025-08-04 20:31:35 +00:00
Anthony Sottile
1450343284
Merge pull request #1182 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-07-24 11:21:42 +02:00
pre-commit-ci[bot]
b554d0acae
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.16.1 → v1.17.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.16.1...v1.17.0)
2025-07-21 20:02:20 +00:00
Anthony Sottile
582b9c66e0
Merge pull request #1174 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-06-24 15:37:13 -04:00
pre-commit-ci[bot]
84f8a9d27f
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/flake8: 7.2.0 → 7.3.0](https://github.com/PyCQA/flake8/compare/7.2.0...7.3.0)
- [github.com/pre-commit/mirrors-mypy: v1.16.0 → v1.16.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.16.0...v1.16.1)
2025-06-23 19:55:23 +00:00
Anthony Sottile
ec458dc1db
Merge pull request #1166 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-06-02 17:30:00 -07:00
pre-commit-ci[bot]
1ea82dfbb9
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.16.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.16.0)
2025-06-02 19:57:11 +00:00
Anthony Sottile
540cd64f14
Merge pull request #1164 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-05-27 21:36:07 -07:00
pre-commit-ci[bot]
60e8a23c68
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder-python-imports: v3.14.0 → v3.15.0](https://github.com/asottile/reorder-python-imports/compare/v3.14.0...v3.15.0)
- [github.com/asottile/add-trailing-comma: v3.1.0 → v3.2.0](https://github.com/asottile/add-trailing-comma/compare/v3.1.0...v3.2.0)
- [github.com/asottile/pyupgrade: v3.19.1 → v3.20.0](https://github.com/asottile/pyupgrade/compare/v3.19.1...v3.20.0)
2025-05-26 19:45:56 +00:00
Anthony Sottile
2a9bc76ca7
Merge pull request #1034 from pre-commit/remove-fix-encoding-pragma
Remove `check-byte-order-marker` and `fix-encoding-pragma`
2025-05-25 08:10:16 -07:00
Max R
5920aee766 Remove check-byte-order-marker and fix-encoding-pragma 2025-05-25 11:03:00 -04:00
Anthony Sottile
5c514f85cc
Merge pull request #1158 from pre-commit/rm-master
remove master references from tests
2025-04-19 11:48:46 -04:00
Anthony Sottile
0a0af6796b remove master references from tests 2025-04-19 11:46:43 -04:00
Anthony Sottile
6db05e22aa
Merge pull request #1153 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-03-31 15:54:55 -04:00
pre-commit-ci[bot]
09121de963 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-03-31 19:44:27 +00:00
pre-commit-ci[bot]
b4b46a81df
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v2.7.0 → v2.8.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.7.0...v2.8.0)
- [github.com/PyCQA/flake8: 7.1.2 → 7.2.0](https://github.com/PyCQA/flake8/compare/7.1.2...7.2.0)
2025-03-31 19:43:55 +00:00
Anthony Sottile
31903eabdb
Merge pull request #1136 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-02-17 16:20:31 -05:00
pre-commit-ci[bot]
16bd239a69
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/flake8: 7.1.1 → 7.1.2](https://github.com/PyCQA/flake8/compare/7.1.1...7.1.2)
2025-02-17 21:07:26 +00:00
Anthony Sottile
e505130ab7
Merge pull request #1134 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-02-12 09:34:10 -05:00
pre-commit-ci[bot]
e521ab251d
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.14.1 → v1.15.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.14.1...v1.15.0)
2025-02-10 22:44:02 +00:00
Anthony Sottile
bf885a482a
Merge pull request #1131 from pre-commit/all-repos_autofix_all-repos-sed
upgrade asottile/workflows
2025-01-30 14:59:46 -05:00
Anthony Sottile
6a28b51c01 upgrade asottile/workflows
Committed via https://github.com/asottile/all-repos
2025-01-30 14:58:58 -05:00
Anthony Sottile
73c57635b1
Merge pull request #1129 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-01-20 20:43:12 -05:00
pre-commit-ci[bot]
78084c34eb
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/hhatto/autopep8: v2.3.1 → v2.3.2](https://github.com/hhatto/autopep8/compare/v2.3.1...v2.3.2)
2025-01-20 22:29:46 +00:00
Anthony Sottile
c0d5684142
Merge pull request #1123 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2025-01-07 20:21:25 -05:00
pre-commit-ci[bot]
afea58a65f
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.14.0 → v1.14.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.14.0...v1.14.1)
2025-01-06 23:30:22 +00:00
Anthony Sottile
ccf815675d
Merge pull request #1115 from homebysix/patch-1
Fix grammar of check-shebang-scripts error
2024-12-24 12:48:47 -05:00
Anthony Sottile
318854d2b5
Merge pull request #1120 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-12-23 21:10:00 -05:00
pre-commit-ci[bot]
385434feb0
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.19.0 → v3.19.1](https://github.com/asottile/pyupgrade/compare/v3.19.0...v3.19.1)
- [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.14.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.13.0...v1.14.0)
2024-12-23 22:45:27 +00:00
Elliot Jordan
4c9457c08b
Fix grammar of check-shebang-scripts error 2024-12-18 19:58:24 -08:00
Anthony Sottile
e437b7ed51
Merge pull request #1104 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-10-28 21:23:35 -04:00
pre-commit-ci[bot]
475f1259da
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.18.0 → v3.19.0](https://github.com/asottile/pyupgrade/compare/v3.18.0...v3.19.0)
- [github.com/pre-commit/mirrors-mypy: v1.12.1 → v1.13.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.12.1...v1.13.0)
2024-10-28 22:56:52 +00:00
Anthony Sottile
0beaecb1f7
Merge pull request #1095 from nemacysts/file-contents-sorter-mutex
Disallow --unique alongside --ignore-cases in file-contents-sorter
2024-10-26 15:07:36 -04:00
Luis Pérez
6883485395 Disallow --unique alongside --ignore-cases in file-contents-sorter
Closes #794: using these flags at the same time results in undefined
behavior - the final ordering is not guaranteed as --unique breaks
sorting due to passing the contents through a set.

NOTE: I added a newline before and after the mutex group to be
consistent with other usages of mutex groups (e.g.,
check_builtin_literals.py) in this repo.
2024-10-26 15:04:34 -04:00
Anthony Sottile
873992cf07
Merge pull request #1100 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-10-21 20:32:07 -04:00
pre-commit-ci[bot]
d7ef621445
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v2.5.0 → v2.7.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.5.0...v2.7.0)
- [github.com/asottile/reorder-python-imports: v3.13.0 → v3.14.0](https://github.com/asottile/reorder-python-imports/compare/v3.13.0...v3.14.0)
- [github.com/asottile/pyupgrade: v3.17.0 → v3.18.0](https://github.com/asottile/pyupgrade/compare/v3.17.0...v3.18.0)
- [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.12.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.2...v1.12.1)
2024-10-21 22:30:23 +00:00
Anthony Sottile
51c43c4b29
Merge pull request #1098 from pre-commit/all-repos_autofix_all-repos-manual
py39+
2024-10-11 19:51:10 -04:00
Anthony Sottile
a49f812a96 py39+
Committed via https://github.com/asottile/all-repos
2024-10-11 19:30:07 -04:00
Anthony Sottile
cef0300fd0 v5.0.0 2024-10-05 14:42:33 -04:00
Anthony Sottile
f47ab2f43c
Merge pull request #1049 from Jeffrey-Lim/main
Extend check for illegal Windows filenames
2024-10-05 14:19:40 -04:00
Jeffrey Lim
fd011242fd Extend check for illegal Windows filenames 2024-10-05 14:10:25 -04:00
Anthony Sottile
515e8b32ba
Merge pull request #1085 from AdrianDC/destroyed-symlinks
set stages for `destroyed-symlinks`
2024-10-05 14:04:09 -04:00
Adrian DC
c7d1e85f24 set stages for destroyed-symlinks
The 'destroyed-symlinks' hook runs upon 'commit-msg' hook,
however when used in 'git submodules', repository scope breaks

> pre_commit_hooks.util.CalledProcessError: (('git', 'status',
> '--porcelain=v2', '-z', '--', '.../COMMIT_EDITMSG'), 0, 128, '',
> b"fatal: .../COMMIT_EDITMSG: '...' is outside repository at '...'\n")
---

Signed-off-by: Adrian DC <radian.dc@gmail.com>
2024-10-05 14:01:50 -04:00
Anthony Sottile
5b5b46dc75
Merge pull request #1093 from pre-commit/non-deprecated-stages-names
update stages names to the non-deprecated names
2024-09-30 20:54:28 -04:00
Anthony Sottile
003dfa55c9 update stages names to the non-deprecated names 2024-09-30 20:49:24 -04:00
Anthony Sottile
ed714747d7
Merge pull request #1088 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-08-26 19:30:06 -04:00
Anthony Sottile
6553d02eb9 remove types-all 2024-08-26 19:24:42 -04:00
pre-commit-ci[bot]
6952eeb163
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.11.1 → v1.11.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.1...v1.11.2)
2024-08-26 22:18:38 +00:00
Anthony Sottile
429455474b
Merge pull request #1080 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-08-05 18:41:45 -04:00
pre-commit-ci[bot]
2bcdd3ccff
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/flake8: 7.1.0 → 7.1.1](https://github.com/PyCQA/flake8/compare/7.1.0...7.1.1)
- [github.com/pre-commit/mirrors-mypy: v1.11.0 → v1.11.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.0...v1.11.1)
2024-08-05 22:39:35 +00:00
Anthony Sottile
c6144a0218
Merge pull request #1077 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-07-29 21:35:31 -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
pre-commit-ci[bot]
282f7ae54d
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.16.0 → v3.17.0](https://github.com/asottile/pyupgrade/compare/v3.16.0...v3.17.0)
2024-07-29 21:59:19 +00:00
Anthony Sottile
0c625349aa
Merge pull request #1073 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-07-22 19:39:48 -04:00
pre-commit-ci[bot]
9e7917b35e
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.1...v1.11.0)
2024-07-22 22:04:19 +00:00
Anthony Sottile
ae7cee538b
Merge pull request #1067 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-07-05 18:34:05 -04:00
pre-commit-ci[bot]
f895cde3c7
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.10.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.10.1)
2024-07-01 23:34:16 +00:00
Anthony Sottile
9759ac692d
Merge pull request #1065 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-06-25 14:16:22 -04:00
pre-commit-ci[bot]
2b5af89b17
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/hhatto/autopep8: v2.3.0 → v2.3.1](https://github.com/hhatto/autopep8/compare/v2.3.0...v2.3.1)
2024-06-24 21:49:05 +00:00
Anthony Sottile
6fc8413192
Merge pull request #1062 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-06-18 20:13:59 -04:00
pre-commit-ci[bot]
b6fb5ca711
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/hhatto/autopep8: v2.2.0 → v2.3.0](https://github.com/hhatto/autopep8/compare/v2.2.0...v2.3.0)
- [github.com/PyCQA/flake8: 7.0.0 → 7.1.0](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.0)
2024-06-17 21:57:24 +00:00
Anthony Sottile
cf1d5bf3bc
Merge pull request #1060 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-06-13 10:27:57 -04:00
pre-commit-ci[bot]
bd4e487247
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.15.2 → v3.16.0](https://github.com/asottile/pyupgrade/compare/v3.15.2...v3.16.0)
2024-06-10 21:56:59 +00:00
Anthony Sottile
0f946c1b47
Merge pull request #1059 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-06-03 21:46:13 -04:00
pre-commit-ci[bot]
b06e32ef41
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder-python-imports: v3.12.0 → v3.13.0](https://github.com/asottile/reorder-python-imports/compare/v3.12.0...v3.13.0)
- [github.com/hhatto/autopep8: v2.1.1 → v2.2.0](https://github.com/hhatto/autopep8/compare/v2.1.1...v2.2.0)
2024-06-03 21:46:58 +00:00
Anthony Sottile
ee30c6ada9
Merge pull request #1056 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-05-27 17:46:09 -04:00
pre-commit-ci[bot]
a508c71a29
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/hhatto/autopep8: v2.1.0 → v2.1.1](https://github.com/hhatto/autopep8/compare/v2.1.0...v2.1.1)
2024-05-27 21:34:23 +00:00
Anthony Sottile
d0293ebc40
Merge pull request #1051 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-04-29 20:54:26 -04:00
pre-commit-ci[bot]
fcbfb901ea
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.10.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.9.0...v1.10.0)
2024-04-29 22:03:55 +00:00
Anthony Sottile
528a309bbd
Merge pull request #1039 from amarvin/patch-1
Continues processing JSONs even if hook fails (fixes #1038)
2024-04-20 13:17:30 -04:00
Alex Marvin
25cdd5457b Continues processing JSONs even if hook fails (fixes #1038) 2024-04-20 13:15:14 -04:00
Anthony Sottile
8c24e2c2e6
Merge pull request #1044 from ericfrederich/more_illegal_windows_filenames
support more illegal Windows filenames
2024-04-20 12:47:34 -04:00
Eric L Frederich
714f1e57b1
support more illegal Windows filenames
See comments in #1031
2024-04-16 14:43:15 -04:00
Anthony Sottile
0d20f18212
Merge pull request #1031 from ericfrederich/check-illegal-windows-names
Add check for illegal Widnows names
2024-04-14 11:49:39 -04:00
Eric L Frederich
865409743e Add check for illegal Widnows names
Fixes #589
2024-04-14 11:47:45 -04:00
Anthony Sottile
b73acb198e
Merge pull request #850 from ericfrederich/fix-requirements-fixer
Stop pkg_resources from being added as well
2024-04-06 14:35:41 -04:00
Anthony Sottile
2c9f875913 v4.6.0 2024-04-06 14:24:38 -04:00
Anthony Sottile
d87a28b79d
Merge pull request #1033 from pre-commit/fix-encoding-pragma
Add deprecation messaging for `fix-encoding-pragma`
2024-04-06 14:12:02 -04:00
Max R
cef973f323 Add deprecation messaging for fix-encoding-pragma 2024-04-06 14:09:51 -04:00
Anthony Sottile
c8715b78af
Merge pull request #1028 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-03-27 17:20:35 -04:00
Eric L Frederich
eadcce2e03
Stop pkg_resources from being added as well
This package with an underscore instead of a dash seems to be
new behavior (at least on Ubuntu 20.04 with Python 3.8)

fixes #1030
2024-03-26 15:27:01 -04:00
pre-commit-ci[bot]
41912f6f5a
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.15.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.15.1...v3.15.2)
2024-03-25 21:31:45 +00:00
Anthony Sottile
6afc57465d
Merge pull request #1027 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-03-20 09:29:16 -04:00
pre-commit-ci[bot]
6880fa1d4d
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/hhatto/autopep8: v2.0.4 → v2.1.0](https://github.com/hhatto/autopep8/compare/v2.0.4...v2.1.0)
2024-03-18 21:47:33 +00:00
Anthony Sottile
2d948977cf
Merge pull request #1024 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-03-13 10:01:26 -04:00
pre-commit-ci[bot]
bda540f53c
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0)
2024-03-13 00:16:08 +00:00
Anthony Sottile
aae27b8a3e
Merge pull request #1014 from vhoulbreque-withings/960-fix-requirements-txt-fixer-duplicated-elements
Remove duplicated packages
2024-02-25 12:18:30 -05:00
Vincent Houlbrèque
0d6d0a79df Remove duplicated packages 2024-02-25 12:15:29 -05:00
Anthony Sottile
454ade935b
Merge pull request #1013 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-02-20 10:22:00 -05:00
pre-commit-ci[bot]
16f5239fab
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.15.0 → v3.15.1](https://github.com/asottile/pyupgrade/compare/v3.15.0...v3.15.1)
2024-02-20 00:02:27 +00:00
Anthony Sottile
77c7147e52
Merge pull request #1005 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2024-01-08 17:41:03 -05:00
pre-commit-ci[bot]
8e040424dc
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0)
2024-01-08 20:21:22 +00:00
Anthony Sottile
e68665eb2e
Merge pull request #1002 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-12-26 13:50:46 -05:00
pre-commit-ci[bot]
8212857ada
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.7.1 → v1.8.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.7.1...v1.8.0)
2023-12-25 20:20:03 +00:00
Anthony Sottile
42bc79146f
Merge pull request #996 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-11-27 17:55:04 -05:00
pre-commit-ci[bot]
34b4ce8685
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.7.0 → v1.7.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.7.0...v1.7.1)
2023-11-27 20:01:20 +00:00
Anthony Sottile
7b2234e6dd
Merge pull request #992 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-11-13 21:40:56 -05:00
pre-commit-ci[bot]
d0d3f3ac05
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.6.1 → v1.7.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.1...v1.7.0)
2023-11-13 20:35:42 +00:00
Anthony Sottile
6306a48f7d
Merge pull request #983 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-10-23 16:57:52 -04:00
pre-commit-ci[bot]
81954a7ca6
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.6.0 → v1.6.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.6.0...v1.6.1)
2023-10-23 20:28:12 +00:00
Anthony Sottile
848f775476
Merge pull request #977 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-10-16 22:08:19 -04:00
pre-commit-ci[bot]
82ad7d5eca
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.6.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.1...v1.6.0)
2023-10-16 20:03:39 +00:00
Anthony Sottile
27dcd3fd1d
Merge pull request #975 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-10-09 16:41:34 -04:00
pre-commit-ci[bot]
6e0df5d9bb
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.14.0 → v3.15.0](https://github.com/asottile/pyupgrade/compare/v3.14.0...v3.15.0)
2023-10-09 20:33:33 +00:00
Anthony Sottile
c4a0b88311 v4.5.0 2023-10-07 14:04:19 -04:00
Anthony Sottile
ae9b59f2d4
Merge pull request #973 from pre-commit/string-fixer-3-12
don't rewrite string quotes inside f-strings
2023-10-07 13:53:40 -04:00
Anthony Sottile
f27ee318d2 don't rewrite string quotes inside f-strings 2023-10-07 13:50:33 -04:00
Anthony Sottile
6cad77080c
Merge pull request #969 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-10-03 12:57:07 -04:00
pre-commit-ci[bot]
038e3dd964
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v2.4.0 → v2.5.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.4.0...v2.5.0)
- [github.com/asottile/reorder-python-imports: v3.11.0 → v3.12.0](https://github.com/asottile/reorder-python-imports/compare/v3.11.0...v3.12.0)
- [github.com/asottile/pyupgrade: v3.13.0 → v3.14.0](https://github.com/asottile/pyupgrade/compare/v3.13.0...v3.14.0)
2023-10-03 08:58:19 +00:00
Anthony Sottile
516a8a263c
Merge pull request #966 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-09-26 09:04:08 -04:00
pre-commit-ci[bot]
30f4ca331f
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.11.0 → v3.13.0](https://github.com/asottile/pyupgrade/compare/v3.11.0...v3.13.0)
2023-09-26 07:23:59 +00:00
Anthony Sottile
f96db964c4
Merge pull request #965 from eumiro/drop-int
Remove redundant int() conversion
2023-09-21 15:22:21 -04:00
Miroslav Šedivý
2e4efef07e Remove redundant int() conversion 2023-09-21 20:12:26 +02:00
Anthony Sottile
064d489b35
Merge pull request #964 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-09-19 09:06:18 -04:00
pre-commit-ci[bot]
0837e0aede
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder-python-imports: v3.10.0 → v3.11.0](https://github.com/asottile/reorder-python-imports/compare/v3.10.0...v3.11.0)
- [github.com/asottile/pyupgrade: v3.10.1 → v3.11.0](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.11.0)
2023-09-19 07:06:39 +00:00
Anthony Sottile
7501a4639f
Merge pull request #961 from Maetveis/document-sort-line-ending
Document newline behavior of `file-contents-sorter`
2023-09-14 16:13:13 -04:00
Mészáros Gergely
95e2fe33af Document newline behavior of file-contents-sorter 2023-09-12 06:35:38 +00:00
Max R
8ef58bed01
Merge pull request #936 from szepeviktor/patch-1 2023-09-05 15:26:30 -04:00
Anthony Sottile
2a72b3df1c
Merge pull request #953 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-09-05 09:07:11 -04:00
pre-commit-ci[bot]
7bf53fac34
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/add-trailing-comma: v3.0.1 → v3.1.0](https://github.com/asottile/add-trailing-comma/compare/v3.0.1...v3.1.0)
- https://github.com/pre-commit/mirrors-autopep8https://github.com/hhatto/autopep8
2023-09-05 06:46:56 +00:00
Anthony Sottile
d20d9444df
Merge pull request #952 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-08-29 11:15:52 -04:00
pre-commit-ci[bot]
baa6589e9d
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-autopep8: v2.0.2 → v2.0.4](https://github.com/pre-commit/mirrors-autopep8/compare/v2.0.2...v2.0.4)
2023-08-29 05:38:18 +00:00
Anthony Sottile
b9a2d83876
Merge pull request #950 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-08-22 09:09:18 -04:00
pre-commit-ci[bot]
98c67bd3b5
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.5.0 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.0...v1.5.1)
2023-08-22 06:16:07 +00:00
Anthony Sottile
3a569ca957
Merge pull request #947 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-08-15 10:18:50 -04:00
pre-commit-ci[bot]
7b72d56327
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.4.1...v1.5.0)
2023-08-15 06:03:44 +00:00
Anthony Sottile
61b5f7e6f7
Merge pull request #944 from RoelAdriaans/file-content-sorted-blank-line-fix
Fix blank lines in file-contents-sorter plugin
2023-08-05 17:02:49 -04:00
Roel Adriaans
fdbaeb81fa Fix blank lines
As stated in the documentation: `Note that this hook WILL remove blank lines`
Previously this hook would always add blank a blank line.

With this fix, if the file is empty, a newline will not be added, and multpline blanklines in a file will be removed.

Fixes #935
2023-08-05 22:56:46 +02:00
Anthony Sottile
1790c6b40a
Merge pull request #942 from mwip/add_bpdb_to_debug_statements_hook
Add bpdb to debug_statements_hook
2023-08-02 12:53:29 -04:00
mwip
bc7973eb59 Add bpdb to debug_statements_hook
This patch adds the bpython debugger import `bpdb` to the
debug_statements_hook.
2023-08-02 15:47:15 +02:00
Anthony Sottile
d2bd9cd497
Merge pull request #939 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-08-01 11:56:43 -04:00
pre-commit-ci[bot]
8cd2371e27
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/add-trailing-comma: v3.0.0 → v3.0.1](https://github.com/asottile/add-trailing-comma/compare/v3.0.0...v3.0.1)
- [github.com/asottile/pyupgrade: v3.9.0 → v3.10.1](https://github.com/asottile/pyupgrade/compare/v3.9.0...v3.10.1)
- [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](https://github.com/PyCQA/flake8/compare/6.0.0...6.1.0)
2023-08-01 07:08:59 +00:00
Viktor Szépe
268a93037b
Fix a typo in check_yaml 2023-07-23 05:28:40 +02:00
Anthony Sottile
85ef03e3b7
Merge pull request #932 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-07-11 06:28:50 -04:00
pre-commit-ci[bot]
a87e8bc645
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.8.0 → v3.9.0](https://github.com/asottile/pyupgrade/compare/v3.8.0...v3.9.0)
2023-07-11 05:21:06 +00:00
Anthony Sottile
b8256a5b1e
Merge pull request #931 from abelsiqueira/patch-1
Fix missing file-contents-sorter options in the README
2023-07-07 08:34:13 -04:00
Abel Soares Siqueira
249f515287
Fix missing file-contents-sorter options in the README 2023-07-07 12:45:16 +02:00
Anthony Sottile
950e8063e1
Merge pull request #927 from pre-commit/py38-shlex-join
shlex.join is always available in 3.8+
2023-07-01 17:43:16 -04:00
Anthony Sottile
e432efb74b shlex.join is always available in 3.8+ 2023-07-01 17:35:45 -04:00
Anthony Sottile
aa54f0d4ac
Merge pull request #926 from pre-commit/all-repos_autofix_py38-plus
py38-plus
2023-07-01 15:49:06 -04:00
Anthony Sottile
50a9fefe01 py38-plus
Committed via https://github.com/asottile/all-repos
2023-07-01 15:41:17 -04:00
Anthony Sottile
dd97157e54
Merge pull request #923 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-06-27 00:12:56 -04:00
pre-commit-ci[bot]
59a2109884
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.3.0 → v1.4.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.3.0...v1.4.1)
2023-06-27 03:52:03 +00:00
Anthony Sottile
f8d8c45220
Merge pull request #922 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-06-20 19:13:48 -07:00
pre-commit-ci[bot]
36e6a062d2
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder-python-imports: v3.9.0 → v3.10.0](https://github.com/asottile/reorder-python-imports/compare/v3.9.0...v3.10.0)
- [github.com/asottile/pyupgrade: v3.6.0 → v3.7.0](https://github.com/asottile/pyupgrade/compare/v3.6.0...v3.7.0)
2023-06-20 04:34:08 +00:00
Anthony Sottile
bb4e628bb4
Merge pull request #917 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-06-13 04:49:05 -04:00
pre-commit-ci[bot]
7ed9210de7
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/add-trailing-comma: v2.4.0 → v2.5.1](https://github.com/asottile/add-trailing-comma/compare/v2.4.0...v2.5.1)
- [github.com/asottile/pyupgrade: v3.4.0 → v3.6.0](https://github.com/asottile/pyupgrade/compare/v3.4.0...v3.6.0)
2023-06-13 03:58:38 +00:00
Anthony Sottile
56205cd9e0
Merge pull request #913 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-06-06 00:00:21 -04:00
pre-commit-ci[bot]
d05d4d7f17 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2023-06-06 03:14:40 +00:00
pre-commit-ci[bot]
361ce37796
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v2.2.0 → v2.3.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.2.0...v2.3.0)
2023-06-06 03:14:19 +00:00
Anthony Sottile
a4d9d1386f
Merge pull request #912 from pre-commit/all-repos_autofix_all-repos-sed
fix tags trigger for github actions
2023-06-01 19:29:26 -04:00
Anthony Sottile
f45f36e8ff fix tags trigger for github actions
the old syntax worked for azure pipelines but not GHA

Committed via https://github.com/asottile/all-repos
2023-06-01 19:12:53 -04:00
Anthony Sottile
ca84e50020
Merge pull request #907 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-05-16 07:51:10 -07:00
pre-commit-ci[bot]
35d6db054a
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.2.0 → v1.3.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.2.0...v1.3.0)
2023-05-16 03:20:22 +00:00
Anthony Sottile
6fc46f9940
Merge pull request #905 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-05-09 08:40:49 -04:00
pre-commit-ci[bot]
894c7c474f
[pre-commit.ci] pre-commit autoupdate
updates:
- https://github.com/asottile/reorder_python_importshttps://github.com/asottile/reorder-python-imports
- [github.com/asottile/pyupgrade: v3.3.2 → v3.4.0](https://github.com/asottile/pyupgrade/compare/v3.3.2...v3.4.0)
2023-05-09 04:04:00 +00:00
Anthony Sottile
0122e76bfe
Merge pull request #900 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-04-25 00:53:47 -04:00
pre-commit-ci[bot]
f34b527ff1
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.3.1 → v3.3.2](https://github.com/asottile/pyupgrade/compare/v3.3.1...v3.3.2)
2023-04-25 03:21:09 +00:00
Anthony Sottile
84e478bc42
Merge pull request #888 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-04-12 16:07:37 -04:00
pre-commit-ci[bot]
56107f5301
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.1.1 → v1.2.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.1.1...v1.2.0)
2023-04-11 02:57:50 +00:00
Anthony Sottile
b0f11fe246
Merge pull request #885 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-03-14 00:57:43 -04:00
pre-commit-ci[bot]
49cf0d461a
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.0.1 → v1.1.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.0.1...v1.1.1)
2023-03-14 03:18:43 +00:00
Anthony Sottile
cc9d172a22
Merge pull request #884 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-03-06 21:54:37 -05:00
pre-commit-ci[bot]
e556d94c70
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-autopep8: v2.0.1 → v2.0.2](https://github.com/pre-commit/mirrors-autopep8/compare/v2.0.1...v2.0.2)
2023-03-07 02:51:56 +00:00
Anthony Sottile
9260cbc9c8
Merge pull request #877 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-02-20 21:12:24 -05:00
pre-commit-ci[bot]
be44903ab6
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v1.0.0 → v1.0.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.0.0...v1.0.1)
2023-02-21 02:06:38 +00:00
Anthony Sottile
7e7049a0bf
Merge pull request #872 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2023-02-13 22:57:45 -05:00
pre-commit-ci[bot]
6c509f9650
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v0.991 → v1.0.0](https://github.com/pre-commit/mirrors-mypy/compare/v0.991...v1.0.0)
2023-02-14 02:25:07 +00:00
Anthony Sottile
5191f112df
Merge pull request #857 from lev-blit/sort-constraints
add constraints file to requirements-txt-fixer files
2023-01-14 11:39:56 -05:00
Lev Blit
03cb9e7007 add constraints file to requirements-txt-fixer files 2023-01-14 13:31:45 +02:00
Anthony Sottile
507fb40267
Merge pull request #853 from pre-commit/gha
azure pipelines -> github actions
2022-12-29 18:15:11 -05:00
Anthony Sottile
a13cf6492e azure pipelines -> github actions 2022-12-29 18:11:25 -05:00
Anthony Sottile
66ecc5beb4
Merge pull request #852 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-12-19 20:49:17 -05:00
pre-commit-ci[bot]
23e603312a
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-autopep8: v2.0.0 → v2.0.1](https://github.com/pre-commit/mirrors-autopep8/compare/v2.0.0...v2.0.1)
2022-12-20 00:30:13 +00:00
Anthony Sottile
931126759f
Merge pull request #849 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-12-12 23:59:27 -05:00
pre-commit-ci[bot]
a18227963d
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/add-trailing-comma: v2.3.0 → v2.4.0](https://github.com/asottile/add-trailing-comma/compare/v2.3.0...v2.4.0)
- [github.com/asottile/pyupgrade: v3.3.0 → v3.3.1](https://github.com/asottile/pyupgrade/compare/v3.3.0...v3.3.1)
2022-12-13 00:40:00 +00:00
Anthony Sottile
a41c4b94b2
Merge pull request #848 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-12-05 20:42:39 -08:00
pre-commit-ci[bot]
9c40982c4a
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.2.2 → v3.3.0](https://github.com/asottile/pyupgrade/compare/v3.2.2...v3.3.0)
2022-12-05 23:51:59 +00:00
Anthony Sottile
6336b8e792
Merge pull request #844 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-11-28 18:42:30 -08:00
pre-commit-ci[bot]
6c514cc2c0
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/flake8: 5.0.4 → 6.0.0](https://github.com/PyCQA/flake8/compare/5.0.4...6.0.0)
2022-11-29 01:10:15 +00:00
Anthony Sottile
f71fa2c1f9 v4.4.0 2022-11-23 14:36:02 -05:00
Anthony Sottile
afb705d488
Merge pull request #841 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-11-21 19:57:22 -05:00
pre-commit-ci[bot]
a63d8f319e
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v0.990 → v0.991](https://github.com/pre-commit/mirrors-mypy/compare/v0.990...v0.991)
2022-11-21 23:12:14 +00:00
Anthony Sottile
b4982b5a6f
Merge pull request #840 from pre-commit/all-repos_autofix_no-implicit-optional
remove no_implicit_optional
2022-11-16 20:03:45 -05:00
Anthony Sottile
360df52788 remove no_implicit_optional
this is the default in mypy 0.990

Committed via https://github.com/asottile/all-repos
2022-11-16 19:19:56 -05:00
Anthony Sottile
5d205e6459
Merge pull request #838 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-11-14 19:08:25 -05:00
pre-commit-ci[bot]
c44770d972
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v3.2.0 → v3.2.2](https://github.com/asottile/pyupgrade/compare/v3.2.0...v3.2.2)
- [github.com/pre-commit/mirrors-mypy: v0.982 → v0.990](https://github.com/pre-commit/mirrors-mypy/compare/v0.982...v0.990)
2022-11-14 23:36:53 +00:00
Anthony Sottile
c03226380c
Merge pull request #829 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-10-31 16:34:50 -07:00
pre-commit-ci[bot]
0a7d3b7d59
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v2.1.0 → v2.2.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.1.0...v2.2.0)
- [github.com/asottile/reorder_python_imports: v3.8.5 → v3.9.0](https://github.com/asottile/reorder_python_imports/compare/v3.8.5...v3.9.0)
- [github.com/asottile/pyupgrade: v3.1.0 → v3.2.0](https://github.com/asottile/pyupgrade/compare/v3.1.0...v3.2.0)
- [github.com/pre-commit/mirrors-autopep8: v1.7.0 → v2.0.0](https://github.com/pre-commit/mirrors-autopep8/compare/v1.7.0...v2.0.0)
2022-10-31 23:27:38 +00:00
Anthony Sottile
4dcb74a498
Merge pull request #822 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-10-17 19:32:40 -04:00
pre-commit-ci[bot]
596f4aece8
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v2.0.0 → v2.1.0](https://github.com/asottile/setup-cfg-fmt/compare/v2.0.0...v2.1.0)
- [github.com/asottile/reorder_python_imports: v3.8.4 → v3.8.5](https://github.com/asottile/reorder_python_imports/compare/v3.8.4...v3.8.5)
2022-10-17 23:10:37 +00:00
Anthony Sottile
5420c705a4
Merge pull request #821 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-10-10 17:03:19 -07:00
pre-commit-ci[bot]
f9af4e2668
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v3.8.3 → v3.8.4](https://github.com/asottile/reorder_python_imports/compare/v3.8.3...v3.8.4)
- [github.com/asottile/pyupgrade: v2.38.2 → v3.1.0](https://github.com/asottile/pyupgrade/compare/v2.38.2...v3.1.0)
- [github.com/pre-commit/mirrors-mypy: v0.981 → v0.982](https://github.com/pre-commit/mirrors-mypy/compare/v0.981...v0.982)
2022-10-10 23:49:59 +00:00
Anthony Sottile
3971569588
Merge pull request #820 from nuztalgia/patch-1
Alphabetize & clarify `file-contents-sorter` in README
2022-10-08 20:04:30 -07:00
Nuz / Lovegood
14ac91fb70 Remove example. 2022-10-08 11:16:50 -07:00
Nuz / Lovegood
8fe064d0bd
Alphabetize & clarify file-contents-sorter in README 2022-10-08 10:58:42 -07:00
Anthony Sottile
6b03546fc3
Merge pull request #815 from pre-commit/forbid-submodules
add forbid-submodules hook
2022-10-04 21:07:47 -04:00
Anthony Sottile
a9b6a7e7fa add forbid-submodules hook 2022-10-04 15:56:38 -04:00
Anthony Sottile
927380bee2
Merge pull request #813 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-10-03 19:13:41 -04:00
pre-commit-ci[bot]
3a406f068f
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v0.971 → v0.981](https://github.com/pre-commit/mirrors-mypy/compare/v0.971...v0.981)
2022-10-03 22:51:47 +00:00
Anthony Sottile
d970d5bf10
Merge pull request #809 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-09-26 19:21:26 -04:00
pre-commit-ci[bot]
3c82985dcc
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v3.8.2 → v3.8.3](https://github.com/asottile/reorder_python_imports/compare/v3.8.2...v3.8.3)
- [github.com/asottile/add-trailing-comma: v2.2.3 → v2.3.0](https://github.com/asottile/add-trailing-comma/compare/v2.2.3...v2.3.0)
- [github.com/asottile/pyupgrade: v2.38.0 → v2.38.2](https://github.com/asottile/pyupgrade/compare/v2.38.0...v2.38.2)
2022-09-26 22:58:10 +00:00
Anthony Sottile
f9c8bfab65
Merge pull request #807 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-09-19 18:11:26 -05:00
pre-commit-ci[bot]
1f52105403
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.37.3 → v2.38.0](https://github.com/asottile/pyupgrade/compare/v2.37.3...v2.38.0)
2022-09-19 22:48:44 +00:00
Anthony Sottile
5d4843d977
Merge pull request #800 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-08-15 17:23:13 -04:00
pre-commit-ci[bot]
f508ebb46e
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-autopep8: v1.6.0 → v1.7.0](https://github.com/pre-commit/mirrors-autopep8/compare/v1.6.0...v1.7.0)
2022-08-15 21:15:55 +00:00
Anthony Sottile
98c88b23b7
Merge pull request #798 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-08-08 18:53:10 -04:00
pre-commit-ci[bot]
ceeb44086c
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/PyCQA/flake8: 5.0.2 → 5.0.4](https://github.com/PyCQA/flake8/compare/5.0.2...5.0.4)
2022-08-08 22:25:11 +00:00
Anthony Sottile
1697d0b133
Merge pull request #797 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-08-01 18:51:13 -04:00
pre-commit-ci[bot]
52dac67bb4 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2022-08-01 22:41:53 +00:00
pre-commit-ci[bot]
ef24d53d5b
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v1.20.2 → v2.0.0](https://github.com/asottile/setup-cfg-fmt/compare/v1.20.2...v2.0.0)
- [github.com/asottile/pyupgrade: v2.37.2 → v2.37.3](https://github.com/asottile/pyupgrade/compare/v2.37.2...v2.37.3)
- [github.com/PyCQA/flake8: 4.0.1 → 5.0.2](https://github.com/PyCQA/flake8/compare/4.0.1...5.0.2)
2022-08-01 22:41:09 +00:00
Anthony Sottile
08b4be84be
Merge pull request #793 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-07-25 18:10:06 -04:00
pre-commit-ci[bot]
085ce874ea
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/setup-cfg-fmt: v1.20.1 → v1.20.2](https://github.com/asottile/setup-cfg-fmt/compare/v1.20.1...v1.20.2)
- [github.com/asottile/reorder_python_imports: v3.8.1 → v3.8.2](https://github.com/asottile/reorder_python_imports/compare/v3.8.1...v3.8.2)
- [github.com/asottile/pyupgrade: v2.37.1 → v2.37.2](https://github.com/asottile/pyupgrade/compare/v2.37.1...v2.37.2)
- [github.com/pre-commit/mirrors-mypy: v0.961 → v0.971](https://github.com/pre-commit/mirrors-mypy/compare/v0.961...v0.971)
2022-07-25 21:44:53 +00:00
Anthony Sottile
18c2496e4c
Merge pull request #787 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-07-11 17:44:25 -04:00
pre-commit-ci[bot]
c2b640f9cb
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v3.3.0 → v3.8.1](https://github.com/asottile/reorder_python_imports/compare/v3.3.0...v3.8.1)
- [github.com/asottile/pyupgrade: v2.34.0 → v2.37.1](https://github.com/asottile/pyupgrade/compare/v2.34.0...v2.37.1)
2022-07-11 21:25:32 +00:00
Anthony Sottile
35d73e14d0
Merge pull request #784 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-07-04 18:02:36 -04:00
pre-commit-ci[bot]
dd347f86bc
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v3.1.0 → v3.3.0](https://github.com/asottile/reorder_python_imports/compare/v3.1.0...v3.3.0)
2022-07-04 21:58:20 +00:00
Anthony Sottile
b0f06dc9f2
Merge pull request #783 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-06-13 18:47:44 -04:00
pre-commit-ci[bot]
2345f2efb2
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.32.1 → v2.34.0](https://github.com/asottile/pyupgrade/compare/v2.32.1...v2.34.0)
- [github.com/pre-commit/mirrors-mypy: v0.960 → v0.961](https://github.com/pre-commit/mirrors-mypy/compare/v0.960...v0.961)
2022-06-13 21:56:48 +00:00
Anthony Sottile
3298ddab3c v4.3.0 2022-06-07 10:08:29 -07:00
Anthony Sottile
526d9b0c3d
Merge pull request #779 from pre-commit/test-conventions
name-test-tests: add --pytest-test-first convention
2022-06-07 12:21:34 -04:00
Anthony Sottile
412564fa95 add --pytest-test-first convention 2022-06-07 09:10:42 -07:00
Anthony Sottile
621f50e155
Merge pull request #778 from pre-commit/asottile-patch-1
set stages for `check-added-large-files`
2022-06-07 09:23:10 -04:00
Anthony Sottile
d17fe994c6
set stages for check-added-large-files
looks like this was accidentally running on `commit-msg` hooks
2022-06-06 12:24:03 -04:00
Anthony Sottile
2b6a486744
Merge pull request #771 from DanielNoord/tomli
Use tomli and tomllib instead of toml
2022-05-31 10:52:18 -04:00
Daniël van Noord
fc88f3fa49 Use tomli and tomllib instead of toml 2022-05-31 10:48:00 -04:00
Anthony Sottile
6a5ae704e5
Merge pull request #776 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-05-30 16:46:31 -04:00
pre-commit-ci[bot]
091d224a6c
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/mirrors-mypy: v0.950 → v0.960](https://github.com/pre-commit/mirrors-mypy/compare/v0.950...v0.960)
2022-05-30 20:33:16 +00:00
Anthony Sottile
08792de8d1
Merge pull request #774 from mdeweerd/updateChmodHelp
Add instruction to change executable mode on windows
2022-05-26 11:36:37 -04:00
MDW
bd70bc119d Add instruction to change executable mode on windows 2022-05-26 17:31:24 +02:00
Anthony Sottile
0a88f14e07
Merge pull request #730 from Kurt-von-Laven/support-git-file-mode-false
Check Git core.fileMode rather than infer from OS.
2022-05-26 09:49:49 -04:00
Anthony Sottile
974bb4de56
Merge pull request #764 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-05-09 14:10:52 -07:00
pre-commit-ci[bot]
821fb690da
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.32.0 → v2.32.1](https://github.com/asottile/pyupgrade/compare/v2.32.0...v2.32.1)
2022-05-09 20:28:29 +00:00
Anthony Sottile
4d46e7884a
Merge pull request #761 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-05-02 16:22:44 -04:00
pre-commit-ci[bot]
54611ef08a
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/reorder_python_imports: v3.0.1 → v3.1.0](https://github.com/asottile/reorder_python_imports/compare/v3.0.1...v3.1.0)
- [github.com/pre-commit/mirrors-mypy: v0.942 → v0.950](https://github.com/pre-commit/mirrors-mypy/compare/v0.942...v0.950)
2022-05-02 20:18:30 +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
f5c26753e4
Merge pull request #759 from bagerard/bagerard-patch-check-merge-conflict-doc
Document check-merge-conflict argument
2022-04-25 09:01:38 -04:00
Bastien Gérard
aa56da8535
Document check-merge-conflict argument
Document --assume-in-merge in README
2022-04-25 12:20:30 +02:00
Anthony Sottile
5d1ab6d7f3
Merge pull request #754 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-04-18 16:08:18 -04:00
pre-commit-ci[bot]
3a4b21ad3f
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/add-trailing-comma: v2.2.2 → v2.2.3](https://github.com/asottile/add-trailing-comma/compare/v2.2.2...v2.2.3)
2022-04-18 19:50:45 +00:00
Anthony Sottile
c7a7ffb9a7
Merge pull request #751 from pre-commit/pre-commit-ci-update-config
[pre-commit.ci] pre-commit autoupdate
2022-04-11 17:04:34 -04:00
pre-commit-ci[bot]
5d69701a83
[pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.31.1 → v2.32.0](https://github.com/asottile/pyupgrade/compare/v2.31.1...v2.32.0)
2022-04-11 20:55:02 +00:00
53 changed files with 503 additions and 558 deletions

19
.github/workflows/main.yml vendored Normal file
View file

@ -0,0 +1,19 @@
name: main
on:
push:
branches: [main, test-me-*]
tags: '*'
pull_request:
jobs:
main-windows:
uses: asottile/workflows/.github/workflows/tox.yml@v1.8.1
with:
env: '["py310"]'
os: windows-latest
main-linux:
uses: asottile/workflows/.github/workflows/tox.yml@v1.8.1
with:
env: '["py310", "py311", "py312", "py313"]'
os: ubuntu-latest

View file

@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
@ -10,34 +10,32 @@ repos:
- id: name-tests-test
- id: requirements-txt-fixer
- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.1
rev: v3.2.0
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.0.1
- repo: https://github.com/asottile/reorder-python-imports
rev: v3.16.0
hooks:
- id: reorder-python-imports
args: [--py37-plus, --add-import, 'from __future__ import annotations']
args: [--py310-plus, --add-import, 'from __future__ import annotations']
- repo: https://github.com/asottile/add-trailing-comma
rev: v2.2.2
rev: v4.0.0
hooks:
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
rev: v3.21.2
hooks:
- id: pyupgrade
args: [--py37-plus]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v1.6.0
args: [--py310-plus]
- repo: https://github.com/hhatto/autopep8
rev: v2.3.2
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
rev: 7.3.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.942
rev: v1.19.1
hooks:
- id: mypy
additional_dependencies: [types-all]

View file

@ -3,6 +3,8 @@
description: prevents giant files from being committed.
entry: check-added-large-files
language: python
stages: [pre-commit, pre-push, manual]
minimum_pre_commit_version: 3.2.0
- id: check-ast
name: check python ast
description: simply checks whether the files parse as valid python.
@ -10,9 +12,9 @@
language: python
types: [python]
- id: check-byte-order-marker
name: 'check BOM - deprecated: use fix-byte-order-marker'
description: forbids files which have a utf-8 byte-order marker.
entry: check-byte-order-marker
name: check-byte-order-marker (removed)
description: (removed) use fix-byte-order-marker instead.
entry: pre-commit-hooks-removed check-byte-order-marker fix-byte-order-marker https://github.com/pre-commit/pre-commit-hooks
language: python
types: [text]
- id: check-builtin-literals
@ -27,7 +29,7 @@
entry: check-case-conflict
language: python
- id: check-docstring-first
name: check docstring is first
name: check docstring is first (deprecated)
description: checks a common error of defining a docstring after code.
entry: check-docstring-first
language: python
@ -38,7 +40,13 @@
entry: check-executables-have-shebangs
language: python
types: [text, executable]
stages: [commit, push, manual]
stages: [pre-commit, pre-push, manual]
minimum_pre_commit_version: 3.2.0
- id: check-illegal-windows-names
name: check illegal windows names
entry: Illegal Windows filenames detected
language: fail
files: '(?i)((^|/)(CON|PRN|AUX|NUL|COM[\d¹²³]|LPT[\d¹²³])(\.|/|$)|[<>:\"\\|?*\x00-\x1F]|/[^/]*[\.\s]/|[^/]*[\.\s]$)'
- id: check-json
name: check json
description: checks json files for parseable syntax.
@ -51,7 +59,8 @@
entry: check-shebang-scripts-are-executable
language: python
types: [text]
stages: [commit, push, manual]
stages: [pre-commit, pre-push, manual]
minimum_pre_commit_version: 3.2.0
- id: pretty-format-json
name: pretty format json
description: sets a standard for formatting json files.
@ -106,6 +115,7 @@
entry: destroyed-symlinks
language: python
types: [file]
stages: [pre-commit, pre-push, manual]
- id: detect-aws-credentials
name: detect aws credentials
description: detects *your* aws credentials from the aws cli credentials file.
@ -130,7 +140,8 @@
entry: end-of-file-fixer
language: python
types: [text]
stages: [commit, push, manual]
stages: [pre-commit, pre-push, manual]
minimum_pre_commit_version: 3.2.0
- id: file-contents-sorter
name: file contents sorter
description: sorts the lines in specified files (defaults to alphabetical). you must provide list of target files as input in your .pre-commit-config.yaml file.
@ -144,10 +155,10 @@
language: python
types: [text]
- id: fix-encoding-pragma
name: fix python encoding pragma
description: 'adds # -*- coding: utf-8 -*- to the top of python files.'
name: fix python encoding pragma (removed)
description: (removed) use pyupgrade instead.
entry: pre-commit-hooks-removed fix-encoding-pragma pyupgrade https://github.com/asottile/pyupgrade
language: python
entry: fix-encoding-pragma
types: [python]
- id: forbid-new-submodules
name: forbid new submodules
@ -155,6 +166,12 @@
language: python
entry: forbid-new-submodules
types: [directory]
- id: forbid-submodules
name: forbid submodules
description: forbids any submodules in the repository
language: fail
entry: 'submodules are not allowed in this repository:'
types: [directory]
- id: mixed-line-ending
name: mixed line ending
description: replaces or checks mixed line ending.
@ -163,7 +180,7 @@
types: [text]
- id: name-tests-test
name: python tests naming
description: this verifies that test files are named correctly.
description: verifies that test files are named correctly.
entry: name-tests-test
language: python
files: (^|/)tests/.+\.py$
@ -178,7 +195,7 @@
description: sorts entries in requirements.txt.
entry: requirements-txt-fixer
language: python
files: requirements.*\.txt$
files: (requirements|constraints).*\.txt$
- id: sort-simple-yaml
name: sort simple yaml files
description: sorts simple yaml files which consist only of top-level keys, preserving comments and blocks.
@ -191,4 +208,5 @@
entry: trailing-whitespace-fixer
language: python
types: [text]
stages: [commit, push, manual]
stages: [pre-commit, pre-push, manual]
minimum_pre_commit_version: 3.2.0

View file

@ -1,3 +1,115 @@
6.0.0 - 2025-08-09
==================
## Fixes
- `check-shebang-scripts-are-executable`: improve error message.
- #1115 PR by @homebysix.
## Migrating
- now requires python >= 3.9.
- #1098 PR by @asottile.
- `file-contents-sorter`: disallow `--unique` and `--ignore-case` at the same
time.
- #1095 PR by @nemacysts.
- #794 issue by @teksturi.
- Removed `check-byte-order-marker` and `fix-encoding-pragma`.
- `check-byte-order-marker`: migrate to `fix-byte-order-marker`.
- `fix-encoding-pragma`: migrate to `pyupgrade`.
- #1034 PR by @mxr.
- #1032 issue by @mxr.
- #522 PR by @jgowdy.
5.0.0 - 2024-10-05
==================
### Features
- `requirements-txt-fixer`: also remove `pkg_resources==...`.
- #850 PR by @ericfrederich.
- #1030 issue by @ericfrederich.
- `check-illegal-windows-names`: new hook!
- #1044 PR by @ericfrederich.
- #589 issue by @ericfrederich.
- #1049 PR by @Jeffrey-Lim.
- `pretty-format-json`: continue processing even if a file has a json error.
- #1039 PR by @amarvin.
- #1038 issue by @amarvin.
### Fixes
- `destroyed-symlinks`: set `stages` to `[pre-commit, pre-push, manual]`
- PR #1085 by @AdrianDC.
### Migrating
- pre-commit-hooks now requires `pre-commit>=3.2.0`.
- use non-deprecated names for `stages`.
- #1093 PR by @asottile.
4.6.0 - 2024-04-06
==================
### Features
- `requirements-txt-fixer`: remove duplicate packages.
- #1014 PR by @vhoulbreque-withings.
- #960 issue @csibe17.
### Migrating
- `fix-encoding-pragma`: deprecated -- will be removed in 5.0.0. use
[pyupgrade](https://github.com/asottile/pyupgrade) or some other tool.
- #1033 PR by @mxr.
- #1032 issue by @mxr.
4.5.0 - 2023-10-07
==================
### Features
- `requirements-txt-fixer`: also sort `constraints.txt` by default.
- #857 PR by @lev-blit.
- #830 issue by @PLPeeters.
- `debug-statements`: add `bpdb` debugger.
- #942 PR by @mwip.
- #941 issue by @mwip.
### Fixes
- `file-contents-sorter`: fix sorting an empty file.
- #944 PR by @RoelAdriaans.
- #935 issue by @paduszyk.
- `double-quote-string-fixer`: don't rewrite inside f-strings in 3.12+.
- #973 PR by @asottile.
- #971 issue by @XuehaiPan.
## Migrating
- now requires python >= 3.8.
- #926 PR by @asottile.
- #927 PR by @asottile.
4.4.0 - 2022-11-23
==================
### Features
- `forbid-submodules`: new hook which outright bans submodules.
- #815 PR by @asottile.
- #707 issue by @ChiefGokhlayeh.
4.3.0 - 2022-06-07
==================
### Features
- `check-executables-have-shebangs`: use `git config core.fileMode` to
determine if it should query `git`.
- #730 PR by @Kurt-von-Laven.
- `name-tests-test`: add `--pytest-test-first` test convention.
- #779 PR by @asottile.
### Fixes
- `check-shebang-scripts-are-executable`: update windows instructions.
- #774 PR by @mdeweerd.
- #770 issue by @mdeweerd.
- `check-toml`: use stdlib `tomllib` when available.
- #771 PR by @DanielNoord.
- #755 issue by @sognetic.
- `check-added-large-files`: don't run on non-file `stages`.
- #778 PR by @asottile.
- #777 issue by @skyj.
4.2.0 - 2022-04-06
==================

View file

@ -1,5 +1,4 @@
[![Build Status](https://asottile.visualstudio.com/asottile/_apis/build/status/pre-commit.pre-commit-hooks?branchName=main)](https://asottile.visualstudio.com/asottile/_build/latest?definitionId=17&branchName=main)
[![Azure DevOps coverage](https://img.shields.io/azure-devops/coverage/asottile/asottile/17/main.svg)](https://dev.azure.com/asottile/asottile/_build/latest?definitionId=17&branchName=main)
[![build status](https://github.com/pre-commit/pre-commit-hooks/actions/workflows/main.yml/badge.svg)](https://github.com/pre-commit/pre-commit-hooks/actions/workflows/main.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pre-commit/pre-commit-hooks/main.svg)](https://results.pre-commit.ci/latest/github/pre-commit/pre-commit-hooks/main)
pre-commit-hooks
@ -16,7 +15,7 @@ Add this to your `.pre-commit-config.yaml`
```yaml
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.2.0 # Use the ref you want to point at
rev: v6.0.0 # Use the ref you want to point at
hooks:
- id: trailing-whitespace
# - id: ...
@ -46,17 +45,18 @@ Require literal syntax when initializing empty or zero Python builtin types.
#### `check-case-conflict`
Check for files with names that would conflict on a case-insensitive filesystem like MacOS HFS+ or Windows FAT.
#### `check-docstring-first`
Checks for a common error of placing code before the docstring.
#### `check-executables-have-shebangs`
Checks that non-binary executables have a proper shebang.
#### `check-illegal-windows-names`
Check for files that cannot be created on Windows.
#### `check-json`
Attempts to load all json files to verify syntax.
#### `check-merge-conflict`
Check for files that contain merge conflict strings.
- `--assume-in-merge` - Allows running the hook when there is no ongoing merge operation
#### `check-shebang-scripts-are-executable`
Checks that scripts with shebangs are executable.
@ -113,25 +113,28 @@ This hook replaces double quoted strings with single quoted strings.
#### `end-of-file-fixer`
Makes sure files end in a newline and only a newline.
#### `fix-byte-order-marker`
removes UTF-8 byte order marker
#### `fix-encoding-pragma`
Add `# -*- coding: utf-8 -*-` to the top of python files.
- To remove the coding pragma pass `--remove` (useful in a python3-only codebase)
#### `file-contents-sorter`
Sort the lines in specified files (defaults to alphabetical).
You must provide list of target files as input to it.
You must provide the target [`files`](https://pre-commit.com/#config-files) as input.
Note that this hook WILL remove blank lines and does NOT respect any comments.
All newlines will be converted to line feeds (`\n`).
The following arguments are available:
- `--ignore-case` - fold lower case to upper case characters.
- `--unique` - ensure each line is unique.
#### `fix-byte-order-marker`
removes UTF-8 byte order marker
#### `forbid-new-submodules`
Prevent addition of new git submodules.
This is intended as a helper to migrate away from submodules. If you want to
ban them entirely use `forbid-submodules`
#### `forbid-submodules`
forbids any submodules in the repository.
#### `mixed-line-ending`
Replaces or checks mixed line ending.
- `--fix={auto,crlf,lf,no}`
@ -141,8 +144,10 @@ Replaces or checks mixed line ending.
- `no` - Checks if there is any mixed line ending without modifying any file.
#### `name-tests-test`
Assert that files in tests/ end in `_test.py`.
- Use `args: ['--django']` to match `test*.py` instead.
verifies that test files are named correctly.
- `--pytest` (the default): ensure tests match `.*_test\.py`
- `--pytest-test-first`: ensure tests match `test_.*\.py`
- `--django` / `--unittest`: ensure tests match `test.*\.py`
#### `no-commit-to-branch`
Protect specific branches from direct checkins.
@ -171,7 +176,7 @@ the following commandline options:
- `--top-keys comma,separated,keys` - Keys to keep at the top of mappings.
#### `requirements-txt-fixer`
Sorts entries in requirements.txt and removes incorrect entry for `pkg-resources==0.0.0`
Sorts entries in requirements.txt and constraints.txt and removes incorrect entry for `pkg-resources==0.0.0`
#### `sort-simple-yaml`
Sorts simple YAML files which consist only of top-level
@ -198,6 +203,9 @@ Trims trailing whitespace.
### Deprecated / replaced hooks
- `check-byte-order-marker`: instead use fix-byte-order-marker
- `fix-encoding-pragma`: instead use [`pyupgrade`](https://github.com/asottile/pyupgrade)
- `check-docstring-first`: fundamentally flawed, deprecated without replacement.
### As a standalone package

View file

@ -1,23 +0,0 @@
trigger:
branches:
include: [main, test-me-*]
tags:
include: ['*']
resources:
repositories:
- repository: asottile
type: github
endpoint: github
name: asottile/azure-pipeline-templates
ref: refs/tags/v2.4.0
jobs:
- template: job--python-tox.yml@asottile
parameters:
toxenvs: [py38]
os: windows
- template: job--python-tox.yml@asottile
parameters:
toxenvs: [py37, py38, py39, py310]
os: linux

View file

@ -4,7 +4,7 @@ import argparse
import math
import os
import subprocess
from typing import Sequence
from collections.abc import Sequence
from pre_commit_hooks.util import added_files
from pre_commit_hooks.util import zsplit
@ -46,7 +46,7 @@ def find_large_added_files(
filenames_filtered &= added_files()
for filename in filenames_filtered:
kb = int(math.ceil(os.stat(filename).st_size / 1024))
kb = math.ceil(os.stat(filename).st_size / 1024)
if kb > maxkb:
print(f'{filename} ({kb} KB) exceeds {maxkb} KB.')
retv = 1

View file

@ -5,7 +5,7 @@ import ast
import platform
import sys
import traceback
from typing import Sequence
from collections.abc import Sequence
def main(argv: Sequence[str] | None = None) -> int:

View file

@ -2,8 +2,8 @@ from __future__ import annotations
import argparse
import ast
from collections.abc import Sequence
from typing import NamedTuple
from typing import Sequence
BUILTIN_TYPES = {
@ -26,36 +26,37 @@ class Call(NamedTuple):
class Visitor(ast.NodeVisitor):
def __init__(
self,
ignore: Sequence[str] | None = None,
ignore: set[str],
allow_dict_kwargs: bool = True,
) -> None:
self.builtin_type_calls: list[Call] = []
self.ignore = set(ignore) if ignore else set()
self.allow_dict_kwargs = allow_dict_kwargs
self._disallowed = BUILTIN_TYPES.keys() - ignore
def _check_dict_call(self, node: ast.Call) -> bool:
return self.allow_dict_kwargs and bool(node.keywords)
def visit_Call(self, node: ast.Call) -> None:
if not isinstance(node.func, ast.Name):
if (
# Ignore functions that are object attributes (`foo.bar()`).
# Assume that if the user calls `builtins.list()`, they know what
# they're doing.
return
if node.func.id not in set(BUILTIN_TYPES).difference(self.ignore):
return
if node.func.id == 'dict' and self._check_dict_call(node):
return
elif node.args:
return
self.builtin_type_calls.append(
Call(node.func.id, node.lineno, node.col_offset),
)
isinstance(node.func, ast.Name) and
node.func.id in self._disallowed and
(node.func.id != 'dict' or not self._check_dict_call(node)) and
not node.args
):
self.builtin_type_calls.append(
Call(node.func.id, node.lineno, node.col_offset),
)
self.generic_visit(node)
def check_file(
filename: str,
ignore: Sequence[str] | None = None,
*,
ignore: set[str],
allow_dict_kwargs: bool = True,
) -> list[Call]:
with open(filename, 'rb') as f:

View file

@ -1,24 +0,0 @@
from __future__ import annotations
import argparse
from typing import Sequence
def main(argv: Sequence[str] | None = None) -> int:
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='*', help='Filenames to check')
args = parser.parse_args(argv)
retv = 0
for filename in args.filenames:
with open(filename, 'rb') as f:
if f.read(3) == b'\xef\xbb\xbf':
retv = 1
print(f'{filename}: Has a byte-order marker')
return retv
if __name__ == '__main__':
raise SystemExit(main())

View file

@ -1,9 +1,9 @@
from __future__ import annotations
import argparse
from typing import Iterable
from typing import Iterator
from typing import Sequence
from collections.abc import Iterable
from collections.abc import Iterator
from collections.abc import Sequence
from pre_commit_hooks.util import added_files
from pre_commit_hooks.util import cmd_output

View file

@ -3,8 +3,8 @@ from __future__ import annotations
import argparse
import io
import tokenize
from collections.abc import Sequence
from tokenize import tokenize as tokenize_tokenize
from typing import Sequence
NON_CODE_TOKENS = frozenset((
tokenize.COMMENT, tokenize.ENDMARKER, tokenize.NEWLINE, tokenize.NL,

View file

@ -4,9 +4,9 @@ from __future__ import annotations
import argparse
import shlex
import sys
from typing import Generator
from collections.abc import Generator
from collections.abc import Sequence
from typing import NamedTuple
from typing import Sequence
from pre_commit_hooks.util import cmd_output
from pre_commit_hooks.util import zsplit
@ -15,7 +15,10 @@ EXECUTABLE_VALUES = frozenset(('1', '3', '5', '7'))
def check_executables(paths: list[str]) -> int:
if sys.platform == 'win32': # pragma: win32 cover
fs_tracks_executable_bit = cmd_output(
'git', 'config', 'core.fileMode', retcode=None,
).strip()
if fs_tracks_executable_bit == 'false': # pragma: win32 cover
return _check_git_filemode(paths)
else: # pragma: win32 no cover
retv = 0
@ -32,7 +35,7 @@ class GitLsFile(NamedTuple):
filename: str
def git_ls_files(paths: Sequence[str]) -> Generator[GitLsFile, None, None]:
def git_ls_files(paths: Sequence[str]) -> Generator[GitLsFile]:
outs = cmd_output('git', 'ls-files', '-z', '--stage', '--', *paths)
for out in zsplit(outs):
metadata, filename = out.split('\t')

View file

@ -2,8 +2,8 @@ from __future__ import annotations
import argparse
import json
from collections.abc import Sequence
from typing import Any
from typing import Sequence
def raise_duplicate_keys(

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import argparse
import os.path
from typing import Sequence
from collections.abc import Sequence
from pre_commit_hooks.util import cmd_output

View file

@ -4,7 +4,7 @@ from __future__ import annotations
import argparse
import shlex
import sys
from typing import Sequence
from collections.abc import Sequence
from pre_commit_hooks.check_executables_have_shebangs import EXECUTABLE_VALUES
from pre_commit_hooks.check_executables_have_shebangs import git_ls_files
@ -34,7 +34,9 @@ def _message(path: str) -> None:
f'{path}: has a shebang but is not marked executable!\n'
f' If it is supposed to be executable, try: '
f'`chmod +x {shlex.quote(path)}`\n'
f' If it not supposed to be executable, double-check its shebang '
f' If on Windows, you may also need to: '
f'`git add --chmod=+x {shlex.quote(path)}`\n'
f' If it is not supposed to be executable, double-check its shebang '
f'is wanted.\n',
file=sys.stderr,
)

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import argparse
import os.path
from typing import Sequence
from collections.abc import Sequence
def main(argv: Sequence[str] | None = None) -> int:

View file

@ -1,9 +1,13 @@
from __future__ import annotations
import argparse
from typing import Sequence
import sys
from collections.abc import Sequence
import toml
if sys.version_info >= (3, 11): # pragma: >=3.11 cover
import tomllib
else: # pragma: <3.11 cover
import tomli as tomllib
def main(argv: Sequence[str] | None = None) -> int:
@ -14,8 +18,9 @@ def main(argv: Sequence[str] | None = None) -> int:
retval = 0
for filename in args.filenames:
try:
toml.load(filename)
except toml.TomlDecodeError as exc:
with open(filename, mode='rb') as fp:
tomllib.load(fp)
except tomllib.TOMLDecodeError as exc:
print(f'{filename}: {exc}')
retval = 1
return retval

View file

@ -3,8 +3,8 @@ from __future__ import annotations
import argparse
import re
import sys
from typing import Pattern
from typing import Sequence
from collections.abc import Sequence
from re import Pattern
def _get_pattern(domain: str) -> Pattern[bytes]:

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import argparse
import xml.sax.handler
from typing import Sequence
from collections.abc import Sequence
def main(argv: Sequence[str] | None = None) -> int:

View file

@ -1,17 +1,17 @@
from __future__ import annotations
import argparse
from collections.abc import Generator
from collections.abc import Sequence
from typing import Any
from typing import Generator
from typing import NamedTuple
from typing import Sequence
import ruamel.yaml
yaml = ruamel.yaml.YAML(typ='safe')
def _exhaust(gen: Generator[str, None, None]) -> None:
def _exhaust(gen: Generator[str]) -> None:
for _ in gen:
pass
@ -46,7 +46,7 @@ def main(argv: Sequence[str] | None = None) -> int:
'--unsafe', action='store_true',
help=(
'Instead of loading the files, simply parse them for syntax. '
'A syntax-only check enables extensions and unsafe contstructs '
'A syntax-only check enables extensions and unsafe constructs '
'which would otherwise be forbidden. Using this option removes '
'all guarantees of portability to other yaml implementations. '
'Implies --allow-multiple-documents'

View file

@ -3,11 +3,12 @@ from __future__ import annotations
import argparse
import ast
import traceback
from collections.abc import Sequence
from typing import NamedTuple
from typing import Sequence
DEBUG_STATEMENTS = {
'bpdb',
'ipdb',
'pdb',
'pdbr',

View file

@ -3,7 +3,7 @@ from __future__ import annotations
import argparse
import shlex
import subprocess
from typing import Sequence
from collections.abc import Sequence
from pre_commit_hooks.util import cmd_output
from pre_commit_hooks.util import zsplit
@ -76,11 +76,7 @@ def main(argv: Sequence[str] | None = None) -> int:
for destroyed_link in destroyed_links:
print(f'- {destroyed_link}')
print('You should unstage affected files:')
print(
'\tgit reset HEAD -- {}'.format(
' '.join(shlex.quote(link) for link in destroyed_links),
),
)
print(f'\tgit reset HEAD -- {shlex.join(destroyed_links)}')
print(
'And retry commit. As a long term solution '
'you may try to explicitly tell git that your '

View file

@ -3,8 +3,8 @@ from __future__ import annotations
import argparse
import configparser
import os
from collections.abc import Sequence
from typing import NamedTuple
from typing import Sequence
class BadFile(NamedTuple):

View file

@ -1,7 +1,7 @@
from __future__ import annotations
import argparse
from typing import Sequence
from collections.abc import Sequence
BLACKLIST = [
b'BEGIN RSA PRIVATE KEY',

View file

@ -2,8 +2,8 @@ from __future__ import annotations
import argparse
import os
from collections.abc import Sequence
from typing import IO
from typing import Sequence
def fix_file(file_obj: IO[bytes]) -> int:

View file

@ -12,11 +12,11 @@ conflicts and keep the file nicely ordered.
from __future__ import annotations
import argparse
from collections.abc import Callable
from collections.abc import Iterable
from collections.abc import Sequence
from typing import Any
from typing import Callable
from typing import IO
from typing import Iterable
from typing import Sequence
PASS = 0
FAIL = 1
@ -37,7 +37,10 @@ def sort_file_contents(
after = sorted(lines, key=key)
before_string = b''.join(before)
after_string = b'\n'.join(after) + b'\n'
after_string = b'\n'.join(after)
if after_string:
after_string += b'\n'
if before_string == after_string:
return PASS
@ -51,18 +54,21 @@ def sort_file_contents(
def main(argv: Sequence[str] | None = None) -> int:
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='+', help='Files to sort')
parser.add_argument(
mutex = parser.add_mutually_exclusive_group(required=False)
mutex.add_argument(
'--ignore-case',
action='store_const',
const=bytes.lower,
default=None,
help='fold lower case to upper case characters',
)
parser.add_argument(
mutex.add_argument(
'--unique',
action='store_true',
help='ensure each line is unique',
)
args = parser.parse_args(argv)
retv = PASS

View file

@ -1,7 +1,7 @@
from __future__ import annotations
import argparse
from typing import Sequence
from collections.abc import Sequence
def main(argv: Sequence[str] | None = None) -> int:

View file

@ -1,149 +0,0 @@
from __future__ import annotations
import argparse
from typing import IO
from typing import NamedTuple
from typing import Sequence
DEFAULT_PRAGMA = b'# -*- coding: utf-8 -*-'
def has_coding(line: bytes) -> bool:
if not line.strip():
return False
return (
line.lstrip()[:1] == b'#' and (
b'unicode' in line or
b'encoding' in line or
b'coding:' in line or
b'coding=' in line
)
)
class ExpectedContents(NamedTuple):
shebang: bytes
rest: bytes
# True: has exactly the coding pragma expected
# False: missing coding pragma entirely
# None: has a coding pragma, but it does not match
pragma_status: bool | None
ending: bytes
@property
def has_any_pragma(self) -> bool:
return self.pragma_status is not False
def is_expected_pragma(self, remove: bool) -> bool:
expected_pragma_status = not remove
return self.pragma_status is expected_pragma_status
def _get_expected_contents(
first_line: bytes,
second_line: bytes,
rest: bytes,
expected_pragma: bytes,
) -> ExpectedContents:
ending = b'\r\n' if first_line.endswith(b'\r\n') else b'\n'
if first_line.startswith(b'#!'):
shebang = first_line
potential_coding = second_line
else:
shebang = b''
potential_coding = first_line
rest = second_line + rest
if potential_coding.rstrip(b'\r\n') == expected_pragma:
pragma_status: bool | None = True
elif has_coding(potential_coding):
pragma_status = None
else:
pragma_status = False
rest = potential_coding + rest
return ExpectedContents(
shebang=shebang, rest=rest, pragma_status=pragma_status, ending=ending,
)
def fix_encoding_pragma(
f: IO[bytes],
remove: bool = False,
expected_pragma: bytes = DEFAULT_PRAGMA,
) -> int:
expected = _get_expected_contents(
f.readline(), f.readline(), f.read(), expected_pragma,
)
# Special cases for empty files
if not expected.rest.strip():
# If a file only has a shebang or a coding pragma, remove it
if expected.has_any_pragma or expected.shebang:
f.seek(0)
f.truncate()
f.write(b'')
return 1
else:
return 0
if expected.is_expected_pragma(remove):
return 0
# Otherwise, write out the new file
f.seek(0)
f.truncate()
f.write(expected.shebang)
if not remove:
f.write(expected_pragma + expected.ending)
f.write(expected.rest)
return 1
def _normalize_pragma(pragma: str) -> bytes:
return pragma.encode().rstrip()
def main(argv: Sequence[str] | None = None) -> int:
parser = argparse.ArgumentParser(
'Fixes the encoding pragma of python files',
)
parser.add_argument('filenames', nargs='*', help='Filenames to fix')
parser.add_argument(
'--pragma', default=DEFAULT_PRAGMA, type=_normalize_pragma,
help=(
f'The encoding pragma to use. '
f'Default: {DEFAULT_PRAGMA.decode()}'
),
)
parser.add_argument(
'--remove', action='store_true',
help='Remove the encoding pragma (Useful in a python3-only codebase)',
)
args = parser.parse_args(argv)
retv = 0
if args.remove:
fmt = 'Removed encoding pragma from {filename}'
else:
fmt = 'Added `{pragma}` to {filename}'
for filename in args.filenames:
with open(filename, 'r+b') as f:
file_ret = fix_encoding_pragma(
f, remove=args.remove, expected_pragma=args.pragma,
)
retv |= file_ret
if file_ret:
print(
fmt.format(pragma=args.pragma.decode(), filename=filename),
)
return retv
if __name__ == '__main__':
raise SystemExit(main())

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import argparse
import os
from typing import Sequence
from collections.abc import Sequence
from pre_commit_hooks.util import cmd_output

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import argparse
import collections
from typing import Sequence
from collections.abc import Sequence
CRLF = b'\r\n'

View file

@ -2,8 +2,8 @@ from __future__ import annotations
import argparse
import re
from collections.abc import Sequence
from typing import AbstractSet
from typing import Sequence
from pre_commit_hooks.util import CalledProcessError
from pre_commit_hooks.util import cmd_output

View file

@ -3,9 +3,9 @@ from __future__ import annotations
import argparse
import json
import sys
from collections.abc import Mapping
from collections.abc import Sequence
from difflib import unified_diff
from typing import Mapping
from typing import Sequence
def _get_pretty_format(
@ -115,16 +115,20 @@ def main(argv: Sequence[str] | None = None) -> int:
f'Input File {json_file} is not a valid JSON, consider using '
f'check-json',
)
return 1
if contents != pretty_contents:
if args.autofix:
_autofix(json_file, pretty_contents)
else:
diff_output = get_diff(contents, pretty_contents, json_file)
sys.stdout.buffer.write(diff_output.encode())
status = 1
else:
if contents != pretty_contents:
if args.autofix:
_autofix(json_file, pretty_contents)
else:
diff_output = get_diff(
contents,
pretty_contents,
json_file,
)
sys.stdout.buffer.write(diff_output.encode())
status = 1
return status

View file

@ -1,7 +1,7 @@
from __future__ import annotations
import sys
from typing import Sequence
from collections.abc import Sequence
def main(argv: Sequence[str] | None = None) -> int:

View file

@ -2,8 +2,8 @@ from __future__ import annotations
import argparse
import re
from collections.abc import Sequence
from typing import IO
from typing import Sequence
PASS = 0
@ -45,6 +45,11 @@ class Requirement:
elif requirement.value == b'\n':
return False
else:
# if 2 requirements have the same name, the one with comments
# needs to go first (so that when removing duplicates, the one
# with comments is kept)
if self.name == requirement.name:
return bool(self.comments) > bool(requirement.comments)
return self.name < requirement.name
def is_complete(self) -> bool:
@ -110,13 +115,20 @@ def fix_requirements(f: IO[bytes]) -> int:
# which is automatically added by broken pip package under Debian
requirements = [
req for req in requirements
if req.value != b'pkg-resources==0.0.0\n'
if req.value not in [
b'pkg-resources==0.0.0\n',
b'pkg_resources==0.0.0\n',
]
]
# sort the requirements and remove duplicates
prev = None
for requirement in sorted(requirements):
after.extend(requirement.comments)
assert requirement.value, requirement.value
after.append(requirement.value)
if prev is None or requirement.value != prev.value:
after.append(requirement.value)
prev = requirement
after.extend(rest)
after_string = b''.join(after)

View file

@ -20,7 +20,7 @@ complicated YAML files.
from __future__ import annotations
import argparse
from typing import Sequence
from collections.abc import Sequence
QUOTES = ["'", '"']

View file

@ -3,8 +3,15 @@ from __future__ import annotations
import argparse
import io
import re
import sys
import tokenize
from typing import Sequence
from collections.abc import Sequence
if sys.version_info >= (3, 12): # pragma: >=3.12 cover
FSTRING_START = tokenize.FSTRING_START
FSTRING_END = tokenize.FSTRING_END
else: # pragma: <3.12 cover
FSTRING_START = FSTRING_END = -1
START_QUOTE_RE = re.compile('^[a-zA-Z]*"')
@ -40,11 +47,17 @@ def fix_strings(filename: str) -> int:
# Basically a mutable string
splitcontents = list(contents)
fstring_depth = 0
# Iterate in reverse so the offsets are always correct
tokens_l = list(tokenize.generate_tokens(io.StringIO(contents).readline))
tokens = reversed(tokens_l)
for token_type, token_text, (srow, scol), (erow, ecol), _ in tokens:
if token_type == tokenize.STRING:
if token_type == FSTRING_START: # pragma: >=3.12 cover
fstring_depth += 1
elif token_type == FSTRING_END: # pragma: >=3.12 cover
fstring_depth -= 1
elif fstring_depth == 0 and token_type == tokenize.STRING:
new_text = handle_match(token_text)
splitcontents[
line_offsets[srow] + scol:

View file

@ -3,29 +3,48 @@ from __future__ import annotations
import argparse
import os.path
import re
from typing import Sequence
from collections.abc import Sequence
def main(argv: Sequence[str] | None = None) -> int:
parser = argparse.ArgumentParser()
parser.add_argument('filenames', nargs='*')
parser.add_argument(
'--django', default=False, action='store_true',
help='Use Django-style test naming pattern (test*.py)',
mutex = parser.add_mutually_exclusive_group()
mutex.add_argument(
'--pytest',
dest='pattern',
action='store_const',
const=r'.*_test\.py',
default=r'.*_test\.py',
help='(the default) ensure tests match %(const)s',
)
mutex.add_argument(
'--pytest-test-first',
dest='pattern',
action='store_const',
const=r'test_.*\.py',
help='ensure tests match %(const)s',
)
mutex.add_argument(
'--django', '--unittest',
dest='pattern',
action='store_const',
const=r'test.*\.py',
help='ensure tests match %(const)s',
)
args = parser.parse_args(argv)
retcode = 0
test_name_pattern = r'test.*\.py' if args.django else r'.*_test\.py'
reg = re.compile(args.pattern)
for filename in args.filenames:
base = os.path.basename(filename)
if (
not re.match(test_name_pattern, base) and
not reg.fullmatch(base) and
not base == '__init__.py' and
not base == 'conftest.py'
):
retcode = 1
print(f'{filename} does not match pattern "{test_name_pattern}"')
print(f'{filename} does not match pattern "{args.pattern}"')
return retcode

View file

@ -2,7 +2,7 @@ from __future__ import annotations
import argparse
import os
from typing import Sequence
from collections.abc import Sequence
def _fix_file(

View file

@ -1,6 +1,6 @@
[metadata]
name = pre_commit_hooks
version = 4.2.0
version = 6.0.0
description = Some out-of-the-box hooks for pre-commit.
long_description = file: README.md
long_description_content_type = text/markdown
@ -8,15 +8,10 @@ url = https://github.com/pre-commit/pre-commit-hooks
author = Anthony Sottile
author_email = asottile@umich.edu
license = MIT
license_file = LICENSE
license_files = LICENSE
classifiers =
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
@ -24,8 +19,8 @@ classifiers =
packages = find:
install_requires =
ruamel.yaml>=0.15
toml
python_requires = >=3.7
tomli>=1.1.0;python_version<"3.11"
python_requires = >=3.10
[options.packages.find]
exclude =
@ -37,7 +32,6 @@ console_scripts =
check-added-large-files = pre_commit_hooks.check_added_large_files:main
check-ast = pre_commit_hooks.check_ast:main
check-builtin-literals = pre_commit_hooks.check_builtin_literals:main
check-byte-order-marker = pre_commit_hooks.check_byte_order_marker:main
check-case-conflict = pre_commit_hooks.check_case_conflict:main
check-docstring-first = pre_commit_hooks.check_docstring_first:main
check-executables-have-shebangs = pre_commit_hooks.check_executables_have_shebangs:main
@ -57,7 +51,6 @@ console_scripts =
end-of-file-fixer = pre_commit_hooks.end_of_file_fixer:main
file-contents-sorter = pre_commit_hooks.file_contents_sorter:main
fix-byte-order-marker = pre_commit_hooks.fix_byte_order_marker:main
fix-encoding-pragma = pre_commit_hooks.fix_encoding_pragma:main
forbid-new-submodules = pre_commit_hooks.forbid_new_submodules:main
mixed-line-ending = pre_commit_hooks.mixed_line_ending:main
name-tests-test = pre_commit_hooks.tests_should_end_in_test:main
@ -79,7 +72,6 @@ check_untyped_defs = true
disallow_any_generics = true
disallow_incomplete_defs = true
disallow_untyped_defs = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true

View file

@ -38,11 +38,6 @@ t1 = ()
'''
@pytest.fixture
def visitor():
return Visitor()
@pytest.mark.parametrize(
('expression', 'calls'),
[
@ -85,7 +80,8 @@ def visitor():
('builtins.tuple()', []),
],
)
def test_non_dict_exprs(visitor, expression, calls):
def test_non_dict_exprs(expression, calls):
visitor = Visitor(ignore=set())
visitor.visit(ast.parse(expression))
assert visitor.builtin_type_calls == calls
@ -102,7 +98,8 @@ def test_non_dict_exprs(visitor, expression, calls):
('builtins.dict()', []),
],
)
def test_dict_allow_kwargs_exprs(visitor, expression, calls):
def test_dict_allow_kwargs_exprs(expression, calls):
visitor = Visitor(ignore=set())
visitor.visit(ast.parse(expression))
assert visitor.builtin_type_calls == calls
@ -114,17 +111,18 @@ def test_dict_allow_kwargs_exprs(visitor, expression, calls):
('dict(a=1, b=2, c=3)', [Call('dict', 1, 0)]),
("dict(**{'a': 1, 'b': 2, 'c': 3})", [Call('dict', 1, 0)]),
('builtins.dict()', []),
pytest.param('f(dict())', [Call('dict', 1, 2)], id='nested'),
],
)
def test_dict_no_allow_kwargs_exprs(expression, calls):
visitor = Visitor(allow_dict_kwargs=False)
visitor = Visitor(ignore=set(), allow_dict_kwargs=False)
visitor.visit(ast.parse(expression))
assert visitor.builtin_type_calls == calls
def test_ignore_constructors():
visitor = Visitor(
ignore=('complex', 'dict', 'float', 'int', 'list', 'str', 'tuple'),
ignore={'complex', 'dict', 'float', 'int', 'list', 'str', 'tuple'},
)
visitor.visit(ast.parse(BUILTIN_CONSTRUCTORS))
assert visitor.builtin_type_calls == []

View file

@ -1,15 +0,0 @@
from __future__ import annotations
from pre_commit_hooks import check_byte_order_marker
def test_failure(tmpdir):
f = tmpdir.join('f.txt')
f.write_text('ohai', encoding='utf-8-sig')
assert check_byte_order_marker.main((str(f),)) == 1
def test_success(tmpdir):
f = tmpdir.join('f.txt')
f.write_text('ohai', encoding='utf-8')
assert check_byte_order_marker.main((str(f),)) == 0

View file

@ -0,0 +1,63 @@
from __future__ import annotations
import os.path
import re
import pytest
from pre_commit_hooks.check_yaml import yaml
@pytest.fixture(scope='module')
def hook_re():
here = os.path.dirname(__file__)
with open(os.path.join(here, '..', '.pre-commit-hooks.yaml')) as f:
hook_defs = yaml.load(f)
hook, = (
hook
for hook in hook_defs
if hook['id'] == 'check-illegal-windows-names'
)
yield re.compile(hook['files'])
@pytest.mark.parametrize(
's',
(
pytest.param('aux.txt', id='with ext'),
pytest.param('aux', id='without ext'),
pytest.param('AuX.tXt', id='capitals'),
pytest.param('com7.dat', id='com with digit'),
pytest.param(':', id='bare colon'),
pytest.param('file:Zone.Identifier', id='mid colon'),
pytest.param('path/COM¹.json', id='com with superscript'),
pytest.param('dir/LPT³.toml', id='lpt with superscript'),
pytest.param('with < less than', id='with less than'),
pytest.param('Fast or Slow?.md', id='with question mark'),
pytest.param('with "double" quotes', id='with double quotes'),
pytest.param('with_null\x00byte', id='with null byte'),
pytest.param('ends_with.', id='ends with period'),
pytest.param('ends_with ', id='ends with space'),
pytest.param('ends_with\t', id='ends with tab'),
pytest.param('dir/ends./with.txt', id='directory ends with period'),
pytest.param('dir/ends /with.txt', id='directory ends with space'),
),
)
def test_check_illegal_windows_names_matches(hook_re, s):
assert hook_re.search(s)
@pytest.mark.parametrize(
's',
(
pytest.param('README.md', id='standard file'),
pytest.param('foo.aux', id='as ext'),
pytest.param('com.dat', id='com without digit'),
pytest.param('.python-version', id='starts with period'),
pytest.param(' pseudo nan', id='with spaces'),
pytest.param('!@#$%^&;=≤\'~`¡¿€🤗', id='with allowed characters'),
pytest.param('path.to/file.py', id='standard path'),
),
)
def test_check_illegal_windows_names_does_not_match(hook_re, s):
assert hook_re.search(s) is None

View file

@ -27,10 +27,10 @@ def f1_is_a_conflict_file(tmpdir):
cmd_output('git', 'clone', str(repo1), str(repo2))
# Commit in master
# Commit in mainline
with repo1.as_cwd():
repo1_f1.write('parent\n')
git_commit('-am', 'master commit2')
git_commit('-am', 'mainline commit2')
# Commit in clone and pull
with repo2.as_cwd():
@ -82,10 +82,10 @@ def repository_pending_merge(tmpdir):
cmd_output('git', 'clone', str(repo1), str(repo2))
# Commit in master
# Commit in mainline
with repo1.as_cwd():
repo1_f1.write('parent\n')
git_commit('-am', 'master commit2')
git_commit('-am', 'mainline commit2')
# Commit in clone and pull without committing
with repo2.as_cwd():
@ -112,7 +112,7 @@ def test_merge_conflicts_git(capsys):
@pytest.mark.parametrize(
'contents', (b'<<<<<<< HEAD\n', b'=======\n', b'>>>>>>> master\n'),
'contents', (b'<<<<<<< HEAD\n', b'=======\n', b'>>>>>>> main\n'),
)
def test_merge_conflicts_failing(contents, repository_pending_merge):
repository_pending_merge.join('f2').write_binary(contents)
@ -150,7 +150,7 @@ def test_worktree_merge_conflicts(f1_is_a_conflict_file, tmpdir, capsys):
cmd_output('git', 'worktree', 'add', str(worktree))
with worktree.as_cwd():
cmd_output(
'git', 'pull', '--no-rebase', 'origin', 'master', retcode=None,
'git', 'pull', '--no-rebase', 'origin', 'HEAD', retcode=None,
)
msg = f1_is_a_conflict_file.join('.git/worktrees/worktree/MERGE_MSG')
assert msg.exists()

View file

@ -16,9 +16,9 @@ def test_passing(tmpdir):
# tags are ok
b'https://github.com/asottile/test/blob/1.0.0/foo%20bar#L1\n'
# links to files but not line numbers are ok
b'https://github.com/asottile/test/blob/master/foo%20bar\n'
b'https://github.com/asottile/test/blob/main/foo%20bar\n'
# regression test for overly-greedy regex
b'https://github.com/ yes / no ? /blob/master/foo#L1\n',
b'https://github.com/ yes / no ? /blob/main/foo#L1\n',
)
assert not main((str(f),))
@ -26,17 +26,15 @@ def test_passing(tmpdir):
def test_failing(tmpdir, capsys):
with tmpdir.as_cwd():
tmpdir.join('f.txt').write_binary(
b'https://github.com/asottile/test/blob/master/foo#L1\n'
b'https://example.com/asottile/test/blob/master/foo#L1\n'
b'https://github.com/asottile/test/blob/main/foo#L1\n'
b'https://example.com/asottile/test/blob/main/foo#L1\n',
)
assert main(('f.txt', '--additional-github-domain', 'example.com'))
out, _ = capsys.readouterr()
assert out == (
'f.txt:1:https://github.com/asottile/test/blob/master/foo#L1\n'
'f.txt:2:https://example.com/asottile/test/blob/master/foo#L1\n'
'f.txt:3:https://example.com/asottile/test/blob/main/foo#L1\n'
'f.txt:1:https://github.com/asottile/test/blob/main/foo#L1\n'
'f.txt:2:https://example.com/asottile/test/blob/main/foo#L1\n'
'\n'
'Non-permanent github link detected.\n'
'On any page on github press [y] to load a permalink.\n'

View file

@ -10,7 +10,9 @@ from pre_commit_hooks.file_contents_sorter import PASS
@pytest.mark.parametrize(
('input_s', 'argv', 'expected_retval', 'output'),
(
(b'', [], FAIL, b'\n'),
(b'', [], PASS, b''),
(b'\n', [], FAIL, b''),
(b'\n\n', [], FAIL, b''),
(b'lonesome\n', [], PASS, b'lonesome\n'),
(b'missing_newline', [], FAIL, b'missing_newline\n'),
(b'newline\nmissing', [], FAIL, b'missing\nnewline\n'),
@ -65,18 +67,6 @@ from pre_commit_hooks.file_contents_sorter import PASS
FAIL,
b'Fie\nFoe\nfee\nfum\n',
),
(
b'fee\nFie\nFoe\nfum\n',
['--unique', '--ignore-case'],
PASS,
b'fee\nFie\nFoe\nfum\n',
),
(
b'fee\nfee\nFie\nFoe\nfum\n',
['--unique', '--ignore-case'],
FAIL,
b'fee\nFie\nFoe\nfum\n',
),
),
)
def test_integration(input_s, argv, expected_retval, output, tmpdir):
@ -87,3 +77,24 @@ def test_integration(input_s, argv, expected_retval, output, tmpdir):
assert path.read_binary() == output
assert output_retval == expected_retval
@pytest.mark.parametrize(
('input_s', 'argv'),
(
(
b'fee\nFie\nFoe\nfum\n',
['--unique', '--ignore-case'],
),
(
b'fee\nfee\nFie\nFoe\nfum\n',
['--unique', '--ignore-case'],
),
),
)
def test_integration_invalid_args(input_s, argv, tmpdir):
path = tmpdir.join('file.txt')
path.write_binary(input_s)
with pytest.raises(SystemExit):
main([str(path)] + argv)

View file

@ -1,161 +0,0 @@
from __future__ import annotations
import io
import pytest
from pre_commit_hooks.fix_encoding_pragma import _normalize_pragma
from pre_commit_hooks.fix_encoding_pragma import fix_encoding_pragma
from pre_commit_hooks.fix_encoding_pragma import main
def test_integration_inserting_pragma(tmpdir):
path = tmpdir.join('foo.py')
path.write_binary(b'import httplib\n')
assert main((str(path),)) == 1
assert path.read_binary() == (
b'# -*- coding: utf-8 -*-\n'
b'import httplib\n'
)
def test_integration_ok(tmpdir):
path = tmpdir.join('foo.py')
path.write_binary(b'# -*- coding: utf-8 -*-\nx = 1\n')
assert main((str(path),)) == 0
def test_integration_remove(tmpdir):
path = tmpdir.join('foo.py')
path.write_binary(b'# -*- coding: utf-8 -*-\nx = 1\n')
assert main((str(path), '--remove')) == 1
assert path.read_binary() == b'x = 1\n'
def test_integration_remove_ok(tmpdir):
path = tmpdir.join('foo.py')
path.write_binary(b'x = 1\n')
assert main((str(path), '--remove')) == 0
@pytest.mark.parametrize(
'input_str',
(
b'',
(
b'# -*- coding: utf-8 -*-\n'
b'x = 1\n'
),
(
b'#!/usr/bin/env python\n'
b'# -*- coding: utf-8 -*-\n'
b'foo = "bar"\n'
),
),
)
def test_ok_inputs(input_str):
bytesio = io.BytesIO(input_str)
assert fix_encoding_pragma(bytesio) == 0
bytesio.seek(0)
assert bytesio.read() == input_str
@pytest.mark.parametrize(
('input_str', 'output'),
(
(
b'import httplib\n',
b'# -*- coding: utf-8 -*-\n'
b'import httplib\n',
),
(
b'#!/usr/bin/env python\n'
b'x = 1\n',
b'#!/usr/bin/env python\n'
b'# -*- coding: utf-8 -*-\n'
b'x = 1\n',
),
(
b'#coding=utf-8\n'
b'x = 1\n',
b'# -*- coding: utf-8 -*-\n'
b'x = 1\n',
),
(
b'#!/usr/bin/env python\n'
b'#coding=utf8\n'
b'x = 1\n',
b'#!/usr/bin/env python\n'
b'# -*- coding: utf-8 -*-\n'
b'x = 1\n',
),
# These should each get truncated
(b'#coding: utf-8\n', b''),
(b'# -*- coding: utf-8 -*-\n', b''),
(b'#!/usr/bin/env python\n', b''),
(b'#!/usr/bin/env python\n#coding: utf8\n', b''),
(b'#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n', b''),
),
)
def test_not_ok_inputs(input_str, output):
bytesio = io.BytesIO(input_str)
assert fix_encoding_pragma(bytesio) == 1
bytesio.seek(0)
assert bytesio.read() == output
def test_ok_input_alternate_pragma():
input_s = b'# coding: utf-8\nx = 1\n'
bytesio = io.BytesIO(input_s)
ret = fix_encoding_pragma(bytesio, expected_pragma=b'# coding: utf-8')
assert ret == 0
bytesio.seek(0)
assert bytesio.read() == input_s
def test_not_ok_input_alternate_pragma():
bytesio = io.BytesIO(b'x = 1\n')
ret = fix_encoding_pragma(bytesio, expected_pragma=b'# coding: utf-8')
assert ret == 1
bytesio.seek(0)
assert bytesio.read() == b'# coding: utf-8\nx = 1\n'
@pytest.mark.parametrize(
('input_s', 'expected'),
(
('# coding: utf-8', b'# coding: utf-8'),
# trailing whitespace
('# coding: utf-8\n', b'# coding: utf-8'),
),
)
def test_normalize_pragma(input_s, expected):
assert _normalize_pragma(input_s) == expected
def test_integration_alternate_pragma(tmpdir, capsys):
f = tmpdir.join('f.py')
f.write('x = 1\n')
pragma = '# coding: utf-8'
assert main((str(f), '--pragma', pragma)) == 1
assert f.read() == '# coding: utf-8\nx = 1\n'
out, _ = capsys.readouterr()
assert out == f'Added `# coding: utf-8` to {str(f)}\n'
def test_crlf_ok(tmpdir):
f = tmpdir.join('f.py')
f.write_binary(b'# -*- coding: utf-8 -*-\r\nx = 1\r\n')
assert not main((str(f),))
def test_crfl_adds(tmpdir):
f = tmpdir.join('f.py')
f.write_binary(b'x = 1\r\n')
assert main((str(f),))
assert f.read_binary() == b'# -*- coding: utf-8 -*-\r\nx = 1\r\n'

View file

@ -11,13 +11,13 @@ from testing.util import git_commit
def test_other_branch(temp_git_dir):
with temp_git_dir.as_cwd():
cmd_output('git', 'checkout', '-b', 'anotherbranch')
assert is_on_branch({'master'}) is False
assert is_on_branch({'placeholder'}) is False
def test_multi_branch(temp_git_dir):
with temp_git_dir.as_cwd():
cmd_output('git', 'checkout', '-b', 'another/branch')
assert is_on_branch({'master'}) is False
assert is_on_branch({'placeholder'}) is False
def test_multi_branch_fail(temp_git_dir):
@ -26,9 +26,10 @@ def test_multi_branch_fail(temp_git_dir):
assert is_on_branch({'another/branch'}) is True
def test_master_branch(temp_git_dir):
def test_exact_branch(temp_git_dir):
with temp_git_dir.as_cwd():
assert is_on_branch({'master'}) is True
cmd_output('git', 'checkout', '-b', 'branchname')
assert is_on_branch({'branchname'}) is True
def test_main_branch_call(temp_git_dir):
@ -50,11 +51,11 @@ def test_branch_pattern_fail(temp_git_dir):
assert is_on_branch(set(), {'another/.*'}) is True
@pytest.mark.parametrize('branch_name', ('master', 'another/branch'))
@pytest.mark.parametrize('branch_name', ('somebranch', 'another/branch'))
def test_branch_pattern_multiple_branches_fail(temp_git_dir, branch_name):
with temp_git_dir.as_cwd():
cmd_output('git', 'checkout', '-b', branch_name)
assert main(('--branch', 'master', '--pattern', 'another/.*'))
assert main(('--branch', 'somebranch', '--pattern', 'another/.*'))
def test_main_default_call(temp_git_dir):

View file

@ -82,6 +82,24 @@ def test_autofix_main(tmpdir):
assert ret == 0
def test_invalid_main(tmpdir):
srcfile1 = tmpdir.join('not_valid_json.json')
srcfile1.write(
'{\n'
' // not json\n'
' "a": "b"\n'
'}',
)
srcfile2 = tmpdir.join('to_be_json_formatted.json')
srcfile2.write('{ "a": "b" }')
# it should have skipped the first file and formatted the second one
assert main(['--autofix', str(srcfile1), str(srcfile2)]) == 1
# confirm second file was formatted (shouldn't trigger linter again)
assert main([str(srcfile2)]) == 0
def test_orderfile_get_pretty_format():
ret = main((
'--top-keys=alist', get_resource_path('pretty_formatted_json.json'),

View file

@ -68,6 +68,12 @@ from pre_commit_hooks.requirements_txt_fixer import Requirement
b'f<=2\n'
b'g<2\n',
),
(b'a==1\nb==1\na==1\n', FAIL, b'a==1\nb==1\n'),
(
b'a==1\nb==1\n#comment about a\na==1\n',
FAIL,
b'#comment about a\na==1\nb==1\n',
),
(b'ocflib\nDjango\nPyMySQL\n', FAIL, b'Django\nocflib\nPyMySQL\n'),
(
b'-e git+ssh://git_url@tag#egg=ocflib\nDjango\nPyMySQL\n',
@ -76,6 +82,8 @@ from pre_commit_hooks.requirements_txt_fixer import Requirement
),
(b'bar\npkg-resources==0.0.0\nfoo\n', FAIL, b'bar\nfoo\n'),
(b'foo\npkg-resources==0.0.0\nbar\n', FAIL, b'bar\nfoo\n'),
(b'bar\npkg_resources==0.0.0\nfoo\n', FAIL, b'bar\nfoo\n'),
(b'foo\npkg_resources==0.0.0\nbar\n', FAIL, b'bar\nfoo\n'),
(
b'git+ssh://git_url@tag#egg=ocflib\nDjango\nijk\n',
FAIL,

View file

@ -37,6 +37,12 @@ TESTS = (
1,
),
('"foo""bar"', "'foo''bar'", 1),
pytest.param(
"f'hello{\"world\"}'",
"f'hello{\"world\"}'",
0,
id='ignore nested fstrings',
),
)

View file

@ -43,3 +43,8 @@ def test_main_not_django_fails():
def test_main_django_fails():
ret = main(['--django', 'foo_test.py', 'test_bar.py', 'test_baz.py'])
assert ret == 1
def test_main_pytest_test_first():
assert main(['--pytest-test-first', 'test_foo.py']) == 0
assert main(['--pytest-test-first', 'foo_test.py']) == 1

View file

@ -1,5 +1,5 @@
[tox]
envlist = py37,py38,pypy3,pre-commit
envlist = py,pre-commit
[testenv]
deps = -rrequirements-dev.txt