11"""
2- Aqua.test_stale_deps (package; [ignore])
2+ Aqua.test_unused_deps (package; [ignore])
33
44Test that `package` loads all dependencies listed in `Project.toml`.
55Note that this does not imply that `package` loads the dependencies
@@ -14,7 +14,7 @@ directly, this can be achieved via transitivity as well.
1414
1515!!! warning "Known bug"
1616
17- Currently, `Aqua.test_stale_deps ` does not detect stale
17+ Currently, `Aqua.test_unused_deps ` does not detect unused
1818 dependencies when they are stdlib. This is considered a bug and
1919 may be fixed in the future. Such a release is considered
2020 non-breaking.
@@ -26,23 +26,23 @@ directly, this can be achieved via transitivity as well.
2626# Keyword Arguments
2727- `ignore::Vector{Symbol}`: names of dependent packages to be ignored.
2828"""
29- function test_stale_deps (pkg:: PkgId ; kwargs... )
30- stale_deps = find_stale_deps (pkg; kwargs... )
31- @test isempty (stale_deps )
29+ function test_unused_deps (pkg:: PkgId ; kwargs... )
30+ unused_deps = find_unused_deps (pkg; kwargs... )
31+ @test isempty (unused_deps )
3232end
3333
34- function test_stale_deps (mod:: Module ; kwargs... )
35- test_stale_deps (aspkgid (mod); kwargs... )
34+ function test_unused_deps (mod:: Module ; kwargs... )
35+ test_unused_deps (aspkgid (mod); kwargs... )
3636end
3737
3838# Remove in next breaking release
39- function test_stale_deps (packages:: Vector{<:Union{Module,PkgId}} ; kwargs... )
39+ function test_unused_deps (packages:: Vector{<:Union{Module,PkgId}} ; kwargs... )
4040 @testset " $pkg " for pkg in packages
41- test_stale_deps (pkg; kwargs... )
41+ test_unused_deps (pkg; kwargs... )
4242 end
4343end
4444
45- function find_stale_deps (pkg:: PkgId ; ignore:: AbstractVector{Symbol} = Symbol[])
45+ function find_unused_deps (pkg:: PkgId ; ignore:: AbstractVector{Symbol} = Symbol[])
4646 root_project_path, found = root_project_toml (pkg)
4747 found || error (" Unable to locate Project.toml" )
4848
@@ -66,16 +66,16 @@ function find_stale_deps(pkg::PkgId; ignore::AbstractVector{Symbol} = Symbol[])
6666 output = output[pos. stop+ 1 : end ]
6767 loaded_uuids = map (UUID, eachline (IOBuffer (output)))
6868
69- return find_stale_deps_2 (;
69+ return find_unused_deps_2 (;
7070 deps = deps,
7171 weakdeps = weakdeps,
7272 loaded_uuids = loaded_uuids,
7373 ignore = ignore,
7474 )
7575end
7676
77- # Side-effect -free part of stale dependency analysis.
78- function find_stale_deps_2 (;
77+ # Side-effect -free part of unused dependency analysis.
78+ function find_unused_deps_2 (;
7979 deps:: AbstractVector{PkgId} ,
8080 weakdeps:: AbstractVector{PkgId} ,
8181 loaded_uuids:: AbstractVector{UUID} ,
@@ -84,10 +84,10 @@ function find_stale_deps_2(;
8484 deps_uuids = [p. uuid for p in deps]
8585 pkgid_from_uuid = Dict (p. uuid => p for p in deps)
8686
87- stale_uuids = setdiff (deps_uuids, loaded_uuids)
88- stale_pkgs = [pkgid_from_uuid[uuid] for uuid in stale_uuids ]
89- stale_pkgs = setdiff (stale_pkgs , weakdeps)
90- stale_pkgs = [p for p in stale_pkgs if ! (Symbol (p. name) in ignore)]
87+ unused_uuids = setdiff (deps_uuids, loaded_uuids)
88+ unused_pkgs = [pkgid_from_uuid[uuid] for uuid in unused_uuids ]
89+ unused_pkgs = setdiff (unused_pkgs , weakdeps)
90+ unused_pkgs = [p for p in unused_pkgs if ! (Symbol (p. name) in ignore)]
9191
92- return stale_pkgs
92+ return unused_pkgs
9393end
0 commit comments