In a monorepo setup, the current behavior from unused is the one I expect, which is similar to the following:
$ cd monorepo_folder/myapp
$ unused --search rg --likelihood high
Unused: analyzing 138 terms
Calculating cache fingerprint...
Unused: analyzing 138 terms
Working [============================================>] 99%
./lib
LayoutView ./lib/myapp_web/views/layout_view.ex occurs once
PageView ./lib/myapp_web/views/page_view.ex occurs once
Session ./lib/myapp_web/endpoint.ex occurs once
UserSocket ./lib/myapp_web/channels/user_socket.ex occurs once
error_tag ./lib/myapp_web/views/error_helpers.ex occurs once
get_service_by_script_slug ./lib/myapp/scripts.ex occurs once
secret ./lib/myapp_web/controllers/api_controller.ex occurs once
template_not_found ./lib/myapp_web/views/error_view.ex occurs once
./test
ChannelCase ./test/support/channel_case.ex occurs once
...
But doing the same with unused-rs I get the following:
$ unused-rs -l high --format compact
🧐 Analyzing... [########################################] 766/766 (0s)
Accounts deps/yellow_pages/lib/yellow_pages/accounts.ex Only one occurrence exists
App deps/swarm/lib/swarm/app.ex Only one occurrence exists
chan _build/dev/lib/phoenix_live_reload/priv/static/phoenix_live_reload.js Only one occurrence exists
...
This is using the Phoenix configuration setting, and I expect that unused-rs ignores the deps and _build directories.
Why do I think that the problem is only present in a monorepo setup? because I just did the following:
$ monorepo_folder
$ rsync -avz myapp /tmp/
$ cd /tmp/myapp
$ git init
$ git add .
$ git commit -m "initial structure"
$ git ls-files | xargs ctags -f .git/tags
$ unused-rs -l high --format compact
and the result is the expected one. Please let me know if you need more information.
In a monorepo setup, the current behavior from
unusedis the one I expect, which is similar to the following:But doing the same with
unused-rsI get the following:This is using the
Phoenixconfiguration setting, and I expect thatunused-rsignores thedepsand_builddirectories.Why do I think that the problem is only present in a monorepo setup? because I just did the following:
and the result is the expected one. Please let me know if you need more information.