【发布时间】:2022-11-11 00:43:17
【问题描述】:
我正在使用与git-filter-repo 关联的lint-history 工具清理一个存储库,将 Prettier 应用于所有提交:
python lint-history --relevant 'filename.endswith(b".ts")' prettier -w
它设法处理了几百个提交,然后崩溃:
[error] ../../../../../var/abc123/somefile.ts: Expected valid tag name
[error] 30 |
[error] 31 | <div>
[error] > 32 | <<<<<<< HEAD
[error] 33 |
Traceback (most recent call last):
File "xyz/lint-history", line 174, in <module>
filter.run()
...
File "xyz/lint-history", line 132, in lint_with_real_filenames
subprocess.check_call(lint_args.command + [filename.decode('utf-8')])
File "/usr/local/Cellar/python@3.9/3.9.4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['prettier', '-w', '/var/abc13/somefile.ts']' returned non-zero exit status 2.
fatal: stream ends early
fast-import: dumping crash report to .git/fast_import_crash_5034
看起来有问题的提交有一些当时没有解决的合并符号(<<<<<<< HEAD 等等)。我怎样才能让 Prettier 单独留下文件而不是退出并显示错误代码?或者,尽管来自 Prettier 的错误,我可以让lint-history 继续吗?
【问题讨论】: