我正在使用 pre-commit 2.8.2 并试图让新的 coursier 语言正常工作。
我能够从 CLI 成功运行 coursier 命令。
❯ cs launch io.gitlab.arturbosch.detekt:detekt-cli:1.14.2 -M io.gitlab.arturbosch.detekt.cli.Main -r https://kotlin.bintray.com/kotlinx -- --help
Usage: detekt [options]
Options:
--auto-correct, -ac
Allow rules to auto correct code if they support it. The default rule
sets do NOT support auto correcting and won't change any line in the
users code base. However custom rules can be written to support auto
correcting. The additional 'formatting' rule set, added with
'--plugins', does support it and needs this flag.
Default: false
但是,我不清楚如何根据文档为 coursier 声明一个钩子。有没有使用 coursier 审查的例子?这就是我在 .pre-commit-hooks.yaml 中的内容。
---
- id: detekt
name: detekt
description: "Runs the Detekt static code analyzer."
language: coursier
entry: launch io.gitlab.arturbosch.detekt:detekt-cli:1.14.2 -M io.gitlab.arturbosch.detekt.cli.Main -r https://kotlin.bintray.com/kotlinx
files: \.kt$
require_serial: true
当我尝试使用钩子时,出现此错误:
❯ pre-commit try-repo /Users/dustin/workspaces/pre-commit/pre-commit-jvm detekt --verbose --all-files
[WARNING] Creating temporary repo with uncommitted changes...
===============================================================================
Using config:
===============================================================================
repos:
- repo: /var/folders/x7/18ntjgfd2j5gy1g1xlzby15w0000gq/T/tmpl5i4qu5r/shadow-repo
rev: 233b290c180e6f6639f14689505ce5098c1c27ad
hooks:
- id: detekt
===============================================================================
[INFO] Initializing environment for /var/folders/x7/18ntjgfd2j5gy1g1xlzby15w0000gq/T/tmpl5i4qu5r/shadow-repo.
[INFO] Installing environment for /var/folders/x7/18ntjgfd2j5gy1g1xlzby15w0000gq/T/tmpl5i4qu5r/shadow-repo.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/x7/18ntjgfd2j5gy1g1xlzby15w0000gq/T/tmpl5i4qu5r/repo3f0zmsce/.pre-commit-channel'
Check the log at /Users/dustin/.cache/pre-commit/pre-commit.log