Skip to content

Commit

Permalink
Update lib/hex/mix.ex
Browse files Browse the repository at this point in the history
Co-authored-by: Todd Resudek <toddresudek@gmail.com>
  • Loading branch information
ericmj and supersimple authored Mar 26, 2024
1 parent a38651f commit 5395ec2
Showing 1 changed file with 28 additions and 20 deletions.
48 changes: 28 additions & 20 deletions lib/hex/mix.ex
Original file line number Diff line number Diff line change
Expand Up @@ -60,32 +60,40 @@ defmodule Hex.Mix do

defp non_hex_deps_to_requests(deps, all_deps, all_apps, overridden) do
Enum.flat_map(deps, fn dep ->
if dep.scm != Hex.SCM and dep.deps != [] and dep.app in all_apps do
sub_apps = Enum.map(dep.deps, & &1.app)
sub_deps = Enum.filter(dep.deps, &(&1.app in sub_apps))

dependencies = deps_to_requests(sub_deps, all_deps, all_apps, overridden)

if dependencies != [] do
[
%{
repo: nil,
name: Atom.to_string(dep.app),
requirement: nil,
app: Atom.to_string(dep.app),
from: Path.relative_to_cwd(dep.from),
dependencies: dependencies
}
]
else
[]
end
if has_non_hex_deps?(dep, all_apps) do
collect_non_hex_deps(deps, all_deps, all_apps, overridden)
else
[]
end
end)
end

defp has_non_hex_deps?(dep, all_apps) do
dep.scm != Hex.SCM and dep.deps != [] and dep.app in all_apps
end

defp collect_non_hex_deps(deps, all_deps, all_apps, overridden) do

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "deps" is unused

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "deps" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "deps" is unused

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "deps" is unused

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "deps" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "deps" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "deps" is unused

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "deps" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "deps" is unused (if the variable is not meant to be used, prefix it with an underscore)

Check warning on line 75 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "deps" is unused (if the variable is not meant to be used, prefix it with an underscore)
sub_apps = Enum.map(dep.deps, & &1.app)

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (25.3, 1.14.5)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0 (expected Hex.Mix to define such a function or for it to be imported, but none are available)

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (25.3, 1.13.4)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0 (expected Hex.Mix to define such a function or for it to be imported, but none are available)

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (24.3, 1.12.3)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (24.3, 1.12.3)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.11.3)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (25.3, 1.13.4)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0 (expected Hex.Mix to define such a function or for it to be imported, but none are available)

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.11.3)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (25.3, 1.14.5)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0 (expected Hex.Mix to define such a function or for it to be imported, but none are available)

Check warning on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check failure on line 76 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

** (CompileError) lib/hex/mix.ex:76: undefined function dep/0
sub_deps = Enum.filter(dep.deps, &(&1.app in sub_apps))

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 77 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

dependencies = deps_to_requests(sub_deps, all_deps, all_apps, overridden)

if dependencies != [] do
[
%{
repo: nil,
name: Atom.to_string(dep.app),

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 85 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name
requirement: nil,
app: Atom.to_string(dep.app),

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 87 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name
from: Path.relative_to_cwd(dep.from),

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.7.2)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.8.1)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (21.3, 1.6.6)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (22.3, 1.9.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name

Check warning on line 88 in lib/hex/mix.ex

View workflow job for this annotation

GitHub Actions / Test (23.3, 1.10.4)

variable "dep" does not exist and is being expanded to "dep()", please use parentheses to remove the ambiguity or change the variable name
dependencies: dependencies
}
]
else
[]
end
end

@doc """
Returns all top level dependencies.
"""
Expand Down

0 comments on commit 5395ec2

Please sign in to comment.