Open tyilo opened 5 months ago
I will look into this. @tyilo
@tyilo I have tweaked the hook configs and added cargo.toml and cargo.lock to the cargo-check
hook. As of 'v1.1.1` therer should be no issue regarding this. Please check it out and post an update here if you had any problems.
Re clippy
I don't see the reason why it should be run when Cargo.toml
changes. If you could elaborate I will work on that too.
@tyilo I have tweaked the hook configs and added cargo.toml and cargo.lock to the
cargo-check
hook. As of 'v1.1.1` therer should be no issue regarding this. Please check it out and post an update here if you had any problems.
Doesn't seem to work:
$ cd /tmp
$ cargo new test-pre-commit
$ cd test-pre-commit
$ cat > .pre-commit-config.yaml
repos:
- repo: https://github.com/FeryET/pre-commit-rust
rev: v1.1.1
hooks:
- id: fmt
- id: cargo-check
^D
$ pre-commit install
$ git add .
$ git commit -m 'init'
fmt......................................................................Failed
- hook id: fmt
- exit code: 1
error: expected item, found `[`
--> /tmp/test-pre-commit/Cargo.toml:1:1
|
1 | [package]
| ^ expected item
|
= note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
cargo check..............................................................Passed
Re
clippy
I don't see the reason why it should be run whenCargo.toml
changes. If you could elaborate I will work on that too.
I only use the fmt
and clippy
hooks as clippy
also shows compiler warnings/errors, so adding cargo-check
to my list of hooks would be redundant.
Thus the clippy
hook should also run when Cargo.toml
/Cargo.lock
changes.
Also see https://github.com/doublify/pre-commit-rust/issues/33
Both the
cargo-check
andclippy
hooks should also be run if onlyCargo.toml
and/orCargo.lock
has been changed.The following shows the problem:
In the 3rd commit we have removed
libc
so that the code no longer compiles. However thecargo-check
step is skipped, so this is not caught :(Running
pre-commit run --all-files
manually results in: