1

I have repository that has both Python and Rust code inside.

In the root of the repository I have .pre-commit-config.yaml with:

  -   repo: https://github.com/doublify/pre-commit-rust
      rev: master
      hooks:
        -   id: fmt
            args: ['--manifest-path', 'rust_code/Cargo.toml']

In the rust_code/ folder I have rust code together with Cargo.toml.

However, it looks like the hook expects Cargo.toml to be in the root of the repository and is ignoring arguments.

Error during execution of `cargo metadata`: error: could not find `Cargo.toml` in `D:\projects\project-repo` or any parent directory

What options do I have?

Shepmaster
  • 388,571
  • 95
  • 1,107
  • 1,366
dzieciou
  • 4,049
  • 8
  • 41
  • 85
  • 1
    Looks like this would end-up as [`cargo fmt -- --manifest-path rust_code/Cargo.toml`](https://github.com/doublify/pre-commit-rust/blob/c9d5fe3776c92519e0b7eb9175fb56400f2a518f/hooks.yaml#L4) with an extra `--`. I would open an issue on that repository. – mcarton Jun 19 '20 at 13:36
  • 1
    looks like [there's a PR to fix this as well](https://github.com/doublify/pre-commit-rust/pull/9/files) – anthony sottile Jun 21 '20 at 04:25
  • @AnthonySottile Yep, it was provided right after my [issue report](https://github.com/doublify/pre-commit-rust/issues/8). – dzieciou Jun 21 '20 at 07:50

0 Answers0