-
Notifications
You must be signed in to change notification settings - Fork 186
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
Warn on unknown dependency options #1027
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,15 @@ defmodule Hex.SCM do | |
repo = opts[:repo] || "hexpm" | ||
path = cache_path(repo, name, lock.version) | ||
|
||
unknown_options = Keyword.keys(opts) -- ~w[hex dest repo lock env build optional]a | ||
|
||
if unknown_options != [] do | ||
Hex.Shell.warn( | ||
"#{name} dependency is using unknown options: " <> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a very minor detail, but I'm wondering if this chosen phrasing has a (small) chance of being misunderstood? As in, perhaps a phrase like "ex_doc dependency is using unknown options" could be understood to mean "a dependency of ex_doc is using unknown options", because the expression "ex_doc dependency" by itself could easily mean "a dependency of ex_doc". To make the phrasing here more unambiguous, perhaps this could be worded "The dependency #{name} is using unknown options", which leaves no room for interpretation 🙂 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call, updated! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I went ahead and change it one more time so it's consistent with another similar message and right now we have:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome! 👏 Looks great. Good call on refining the message further 🙂 |
||
Enum.map_join(unknown_options, ", ", &inspect/1) | ||
) | ||
end | ||
|
||
case Hex.Parallel.await(:hex_fetcher, {:tarball, repo, name, lock.version}, @fetch_timeout) do | ||
{:ok, :cached} -> | ||
Hex.Shell.debug(" Using locally cached package (#{path})") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the full list of options mix supports: https://hexdocs.pm/mix/Mix.Tasks.Deps.html#module-dependency-definition-options.