Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unused_rs should filter results based on current directory #14

Open
3 tasks
milmazz opened this issue May 27, 2020 · 0 comments
Open
3 tasks

unused_rs should filter results based on current directory #14

milmazz opened this issue May 27, 2020 · 0 comments

Comments

@milmazz
Copy link
Collaborator

milmazz commented May 27, 2020

I just tried to emulate a monorepo structure with two Phoenix applications and I was expecting the following behaviors:

  • When running unused_rs from the root directory, I was expecting to see the results for app1 and app2
  • When running unused_rs inside of the app1 directory, I was expecting to see the results for app1, and unused_rs should have ignored the results from other sibling apps.
  • When running unused_rs inside of the app2 directory, I was expecting to see the results only for app2, unused_rs should have ignored the results from other sibling apps.

Here is the way I did it in case you want to replicate the issue:

$ mkdir /tmp/demo 
$ cd /tmp/demo/
$ mix phx.new app1 --no-ecto
$ cd app1
$ mix phx.server # just to check that the app works
$ cd ..
$ mix phx.new app2 --no-html --no-webpack
$ cd app2
$ mix ecto.create
$ mix phx.server # just to check that the app works
$ cd ..
$ git init
$ git add .
$ git commit -m "initial structure"
$ git ctags
$ ls .git/tags
.git/tags

Then, here are the results:

$ pwd
/tmp/demo
$ ~/Dev/rust/unused_rs/target/debug/unused-rs -l high --format compact
LayoutView            app1/lib/app1_web/views/layout_view.ex                     Only one occurrence exists
LayoutViewTest        app1/test/app1_web/views/layout_view_test.exs              Only one occurrence exists
PageControllerTest    app1/test/app1_web/controllers/page_controller_test.exs    Only one occurrence exists
PageView              app1/lib/app1_web/views/page_view.ex                       Only one occurrence exists
PageViewTest          app1/test/app1_web/views/page_view_test.exs                Only one occurrence exists
error_tag             app1/lib/app1_web/views/error_helpers.ex                   Only one occurrence exists

In the previous command, I just see the results for app1, it should have included the results for app2 too.

$ cd app1/
$ ~/Dev/rust/unused_rs/target/debug/unused-rs -l high --format compact
ErrorViewTest         app2/test/app2_web/views/error_view_test.exs               Only one occurrence exists
LayoutView            app1/lib/app1_web/views/layout_view.ex                     Only one occurrence exists
LayoutViewTest        app1/test/app1_web/views/layout_view_test.exs              Only one occurrence exists
MixProject            app2/mix.exs                                               Only one occurrence exists
PageControllerTest    app1/test/app1_web/controllers/page_controller_test.exs    Only one occurrence exists
PageView              app1/lib/app1_web/views/page_view.ex                       Only one occurrence exists
PageViewTest          app1/test/app1_web/views/page_view_test.exs                Only one occurrence exists
Repo                  app2/lib/app2/repo.ex                                      Only one occurrence exists
__using__             app1/lib/app1_web.ex                                       Only one occurrence exists
error_tag             app1/lib/app1_web/views/error_helpers.ex                   Only one occurrence exists
template_not_found    app2/lib/app2_web/views/error_view.ex                      Only one occurrence exists

In the previous output, I was expecting only results for the app1, but, as you can see, results for app2 are included.

$ cd ../app2/
$ ~/Dev/rust/unused_rs/target/debug/unused-rs -l high --format compact
ErrorViewTest         app2/test/app2_web/views/error_view_test.exs    Only one occurrence exists
MixProject            app1/mix.exs                                    Only one occurrence exists
__using__             app1/lib/app1_web.ex                            Only one occurrence exists
template_not_found    app1/lib/app1_web/views/error_view.ex           Only one occurrence exists
translate_error       app2/lib/app2_web/views/error_helpers.ex        Only one occurrence exists

In the previous output, I was expecting only results for the app2, but, as you can see, results for app1 are included.

The unused_rs that I'm using was built using cargo build and using the commit 8b4f822

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant