pre-commit-ci / issues

public issues for https://pre-commit.ci
16 stars 3 forks source link

pre-commit.ci does not work with rust/cargo #216

Closed wawrzek closed 3 weeks ago

wawrzek commented 3 weeks ago

Documentation claims that pre-commit.ci works with rust. But we see the following error:

[...]
fmt......................................................................Failed
- hook id: fmt
- exit code: 1

Executable `cargo` not found

cargo check..............................................................Failed
- hook id: cargo-check
- exit code: 1

with following config:

repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.6.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: mixed-line-ending
        args: ['--fix=lf']
    -   id: check-yaml
    -   id: check-added-large-files
    -   id: check-merge-conflict
-   repo: https://github.com/doublify/pre-commit-rust
    rev: v1.0
    hooks:
    -   id: fmt
    -   id: cargo-check
asottile commented 3 weeks ago

rust tools are only available with language: rust

wawrzek commented 3 weeks ago

@asottile How do I suppose to pass the language to the hook which is not written in rust, but uses cargo?

For example:

asottile commented 3 weeks ago

for those you can't really

even if you could, cargo is going to attempt to access the network so those hooks aren't supported (they are using the framework-unsupported language: system / language: script escape hatches)