提问人:zerocewl 提问时间:11/18/2023 最后编辑:anthony sottilezerocewl 更新时间:11/18/2023 访问量:82
如何修复黑色预提交的 InvalidManifestError?
How to fix InvalidManifestError for pre-commit with black?
问:
使用最新版本运行 python 会导致有线 .pre-commit
black
23.11.0
InvalidManifestError
片段来自.pre-commit-config.yaml
repos:
- repo: https://github.com/psf/black
rev: 23.11.0
hooks:
- id: black
types: []
files: ^.*.pyi?$ # format .py and .pyi files`
输出消息:
│ │ stdout = 'An error has occurred: InvalidManifestError: \n==> File │ │
│ │ /Users/robot/.cache/pre-c'+329 │ │
│ │ stdout_list = [ │ │
│ │ │ 'An error has occurred: InvalidManifestError: \n', │ │
│ │ │ '==> File │ │
│ │ /Users/robot/.cache/pre-commit/repoxhmwyits/.pre-commit-hooks.yaml\n', │ │
│ │ │ "==> At Hook(id='black')\n", │ │
│ │ │ '==> At key: stages\n', │ │
│ │ │ '==> At index 0\n', │ │
│ │ │ '=====> Expected one of commit, commit-msg, manual, merge-commit, │ │
│ │ post-checkout, '+86, │ │
│ │ │ 'Check the log at /Users/robot/.cache/pre-commit/pre-commit.log\n' │ │
│ │ ]
答:
4赞
anthony sottile
11/18/2023
#1
您使用的是过时版本的预提交。您至少需要使用引入了重命名阶段的 3.2.0 版本
免责声明:我写了预提交
0赞
jadelord
11/29/2023
#2
作为一种解决方法(因为您像我一样被旧的预提交和 Python 版本所困扰),可以使用将该字段替换为repo
https://github.com/psf/black-pre-commit-mirror
它还没有使用舞台。pre-commit
0赞
Iván Sánchez
12/5/2023
#3
删除缓存对我有用~/.cache/pre-commit/
评论