cargo-count icon indicating copy to clipboard operation
cargo-count copied to clipboard

cargo-count doesn't find any code

Open ghost opened this issue 7 years ago • 6 comments

I cannot get cargo-count to find any code. I have tried it in both Rust and C++ repositories, and it always outputs "No source files were found matching the specified criteria". Example:

bram@falafel% mkdir testrepo
bram@falafel% cd testrepo
bram@falafel% cargo init --bin
     Created binary (application) project
bram@falafel% cat src/main.rs
fn main() {
    println!("Hello, world!");
}
bram@falafel% cargo count
Gathering information...

	No source files were found matching the specified criteria

Edit: additional info:

bram@falafel% cargo count -v
Gathering information...
Excluding: ["/home/bram/tmp/testrepo/.git"]
Displaying the results:

	No source files were found matching the specified criteria
bram@falafel% cargo count -V
cargo-count v0.2.2

I installed cargo-count from crates.io.

ghost avatar Jun 23 '17 22:06 ghost

This is fixed for me by #37, which I find a bit strange, since I have no idea why the version mismatch between Cargo.toml and Cargo.lock would result in this behavior.

This is my first ever PR so I hope I did it right! (Even though this is pretty much the smallest PR possible...)

ghost avatar Jul 05 '17 11:07 ghost

I have the same issue - but I can workaround it, because if I run cargo count -a --exclude=$(cat .gitignore) everything works as expected. Which suggests it's the gitignore handling that's broken...?

mthebridge avatar Nov 07 '17 11:11 mthebridge

Same problem here, on both Mac and Windows with my repo. cargo count -a --exclude=$(cat .gitignore) worked around it

repi avatar Jan 09 '18 14:01 repi

Until the author makes a new version on crates.io, you can fix this by cloning the repo and building and installing it yourself.

Here is a quick script to do that: git clone https://github.com/kbknapp/cargo-count && cd cargo-count && cargo install --path . --force

Aeledfyr avatar May 24 '19 20:05 Aeledfyr

Can confirm that installing the latest git version solved the issue I was running into

repi avatar May 24 '19 22:05 repi

Installing the latest git version with @Aeledfyr 's suggested command did install the new version but did not fix the issue for me in the root of my project workspace. However, it does now work for each individual crate, which it did not before.

lucidBrot avatar Jan 03 '20 21:01 lucidBrot