swellaby / rusty-hook

git hook manager, geared toward Rust projects
MIT License
205 stars 11 forks source link

Invalid rusty-hook config file #181

Closed sudhirdhumal289 closed 2 years ago

sudhirdhumal289 commented 2 years ago

Environment Details

Description

Somehow git hooks were not registered after removing .git/hooks, crate dependency. So removed cargo cache, removed project and pulled it back now its working but getting error that config file is not valid

I'm using workspace feature, which contains one binary crate and binary crate itself depends on rusty-hook and rust-hook.toml file is present in workspace root directory.

.rusty-hook.toml file contents:

[hooks]
pre-commit = "cargo check"
pre-push = [
    "rustup component add rustfmt",
    "rustup component add clippy",
    "cargo fmt -- --check",
    "cargo clippy -- -D warnings",
    "rustup component add llvm-tools-preview",
    "export RUSTC_BOOTSTRAP=1",
    "export RUSTFLAGS=\"-Zinstrument-coverage\"",
    "export LLVM_PROFILE_FILE=\"planned-tasks-%p-%m.profraw\"",
    "cargo build --verbose",
    "cargo test --verbose",
    "rm *.profraw",
    "grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/"
]

[logging]
verbose = true

Tried removing environment variables as well but getting same error. Error:

Invalid rusty-hook config file
Configured hook command failed
pre-push hook rejected
error: failed to push some refs to 'gitlab.com:
calebcartwright commented 2 years ago

Thanks for reaching out, but this is correct.

You are using the latest released (and usable) version published on crates.io, v0.11.2, however, you are trying to use a the hook-as-array feature that does not exist in your version; the array support was added in the unusable, unreleased v0.12.0 (https://github.com/swellaby/rusty-hook/blob/master/CHANGELOG.md#added, refs #171)