Closed shankardevy closed 3 years ago
Hi @shankardevy thanks for reaching out!
In the README, I have a section on troubleshooting and recommend running brew doctor
. Have you done this already? Were all the checks OK, or did you see any warnings or errors?
thanks @joshuaclayton for your quick reply. I believe you are referring to unused doctor
and not brew doctor
. Here is what I see when I run it.
> unused doctor
Unused Doctor
[OK] Check: Is the tags file not present in the list of files searched?
The tags file loaded (".git/tags") is not present in the list of files searched
[OK] Check: Are tokens found in the application?
731 token(s) found
[OK] Check: Are files found in the application?
545 file(s) found
[Warning] Check: Is the tags file generated with Universal Ctags?
Using tags program: Exuberant Ctags
[OK] Check: Does the loaded configuration have available project types?
Loaded the following project configurations: Rails, Phoenix
Outcome: 4 OK, 1 warnings, 0 errors
@shankardevy ah, my mistake! I did mean unused doctor
.
Hmm – so, it looks like it's finding tokens and files... I wonder if it's seeing repeat tokens somewhere.
If you run unused --only-filetypes ex -a
, is there anything surprising? Specifically, I'm wondering if there's a file that has all the functions somewhere (e.g. another tags
file floating around).
I'd also call out that it's not picking up the Phoenix configuration (the output you posted includes Configuration setting: Default
) and wanted to make sure that sounds correct to you. There are a couple of simple heuristics it checks to classify a repo as e.g. a Phoenix or Rails app, so it might not be meeting that criteria.
One last thing – are you using dialyzer, per chance? One thing I've not sorted out how to handle is repeated token usage that stems from function type signatures (similar challenges would pop up in Haskell and Elm, for example, but not Rust or TypeScript)
If you want to try out this project within Docker with a rails application inside a git repo and ctags you can do it this way:
cd my_rails_app
docker run -it --entrypoint "" -v "$(readlink -f ./)":/code alpine /bin/sh
apk add --no-cache git cmake make g++ linux-headers ctags rust cargo
cargo install --git https://github.com/unused-code/unused --branch main
export PATH="$PATH:${HOME}/.cargo/bin"
cd /code
git ls-files | ctags --tag-relative -L - -f"tags" --languages=ruby
unused
@shankardevy closing this due to inactivity. Please let me know if you run into issues in the future.
I have ctags installed as below
Generate ctags using
git ls-files | xargs ctags -f .git/tags
Then I use
unused
as below and I don't see any warning even though I know I have a lot of dead code in my project.