pre-commit-rust icon indicating copy to clipboard operation
pre-commit-rust copied to clipboard

Providing location to Cargo.toml

Open dzieciou opened this issue 4 years ago • 4 comments

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?

dzieciou avatar Jun 19 '20 13:06 dzieciou

Hello. Thanks for your activity. Please create Pull request if you know solution to fix this issue

ghost avatar Jun 20 '20 00:06 ghost

@fdhadzh There's PR from Daniel with a fix for the issue.

Would you be able to review and merge it?

dzieciou avatar Jun 23 '20 08:06 dzieciou

I think we also need to fix cargo clippy to accept --manifest-path. Right now the hook already has the -- -D warnings appended to the entry command i.e. cargo clippy so it doesn't accept --manifest-path after those arguments.

Shouldn't it only use cargo clippy as entry point and let the user enter the arguments they like?

thatdevsherry avatar Jul 24 '20 09:07 thatdevsherry