-
Notifications
You must be signed in to change notification settings - Fork 11
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
When using Phoenix config setting, deps
and _build
directories should be ignored in a monorepo setup
#2
Comments
So, unused splits this apart into two discrete chunks:
In cloning Constable, which ignores Can you take a look at your tags file to see if the tokens are present? |
@milmazz in thinking through this further, I'd like to continue to lean on the settings from |
I just checked the current configuration in one of my monorepos, and we have the following:
According to the Git documentation we have:
So, my case is the second one, those paths ( Tomorrow I will try to "play" a bit with the patterns in my |
@milmazz For some additional context, I'm shelling out to In poking around locally, I was able to verify that adding a sub-directory with its own .gitignore did in fact honor the limitations as expected. I can also say that the old version of unused did not do the right thing; specifically, it only looked at the top-level .gitignore as it didn't shell out to Finally, if you were to set up your machine for Rust development and build the whole project, one of the binaries it generates is |
@milmazz another thought – if you had a monorepo with a top-level |
@joshuaclayton getting back to this, sorry for the delay. I'll try to set up the development environment and build the latest version, and then I'll try again. I'll keep you posted. |
This is the result with the latest commit 8b4f822 $ ~/Dev/rust/unused_rs/target/debug/unused-rs doctor
Unused Doctor
[OK] Check: Is the tags file not present in the list of files searched?
The tags file loaded ("tmp/tags") is not present in the list of files searched
[OK] Check: Are tokens found in the application?
267 token(s) found
[OK] Check: Are files found in the application?
118 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: Phoenix, Rails
Outcome: 4 OK, 1 warnings, 0 errors The output from this project under a monorepo structure seems fine: $ ~/Dev/rust/unused_rs/target/debug/unused-rs -l high --format compact
__using__ lib/dialer_metrics_web.ex Only one occurrence exists
pop lib/dialer_metrics/interactors/ready_engine/agent_state.ex Only one occurrence exists
slugize lib/dialer_metrics/aggregators/agent_event.ex Only one occurrence exists
template_not_found lib/dialer_metrics_web/views/error_view.ex Only one occurrence exists
update_all lib/dialer_metrics/airtable/campaign_controller_config.ex Only one occurrence exists Except that But running the same command for a sibling project under the monorepo structure I keep getting results for $ ~/Dev/rust/unused_rs/target/debug/unused-rs -l high --format compact
Accounts deps/yellow_pages/lib/yellow_pages/accounts.ex Only one occurrence exists
App deps/mongodb/lib/mongo/app.ex Only one occurrence exists
chan _build/dev/lib/phoenix_live_reload/priv/static/phoenix_live_reload.js Only one occurrence exists
error_tag web/views/error_helpers.ex Only one occurrence exists
where deps/ecto_sql/lib/ecto/adapters/postgres/connection.ex Only one occurrence exists and the And here is the difference between $ git ls-files > git-ls-files.out
$ ~/Dev/rust/unused_rs/target/debug/tracked-files-rs > tracked-files-rs.out
$ diff git-ls-files.out tracked-files-rs.out
316a317
> git-ls-files.out
752a754
> tracked-files-rs.out Meaning that both files are almost equal, except that Let me know if you need more information or if you prefer to jump in a call, that way I guess we can find the solution together. |
I think that's not the case here. What I have is the following: $ cat .gitignore
# Static artifacts
node_modules
$ cat agent_desktop/.gitignore
# App artifacts
/_build
/db
/deps
/*.ez
# Generated on crash by the VM
erl_crash.dump
# Since we are building assets from web/static,
# we ignore priv/static. You may want to comment
# this depending on your deployment strategy.
/priv/static/
# The config/prod.secret.exs file by default contains sensitive
# data and you should not commit it into version control.
#
# Alternatively, you may comment the line below and commit the
# secrets file as long as you replace its contents by environment
# variables.
/config/prod.secret.exs
.elixir_ls
.cache
.env
.staging-env
$ cat dialer_metrics/.gitignore
# App artifacts
/_build
/db
/deps
/*.ez
# Generated on crash by the VM
erl_crash.dump
# Files matching config/*.secret.exs pattern contain sensitive
# data and you should not commit them into version control.
#
# Alternatively, you may comment the line below and commit the
# secrets files as long as you replace their contents by environment
# variables.
/config/*.secret.exs
.env
/priv/static
/.cache/ In the previous comment, the output for |
@milmazz Re: Finally, you mention
Does the tags file include that token? I'm wondering if that's an issue where the tags file is out-of-date, in which case, there's a bug there where we can run into cases where a tags file can have a token that's not found anywhere, and it'll still show up as a single use. |
In a monorepo setup, the current behavior from
unused
is the one I expect, which is similar to the following:But doing the same with
unused-rs
I get the following:This is using the
Phoenix
configuration setting, and I expect thatunused-rs
ignores thedeps
and_build
directories.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.
The text was updated successfully, but these errors were encountered: