Skip to content

Commit 94ff87c

Browse files
committed
Rename test_stale_deps to test_unused_deps
1 parent dc6e5e5 commit 94ff87c

9 files changed

Lines changed: 51 additions & 51 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Aqua.jl provides functions to run a few automatable checks for Julia packages:
1111
* There are no method ambiguities.
1212
* There are no undefined `export`s.
1313
* There are no unbound type parameters.
14-
* There are no stale dependencies listed in `Project.toml`.
14+
* There are no unused dependencies listed in `Project.toml`.
1515
* Check that test target of the root project `Project.toml` and test project (`test/Project.toml`) are consistent.
1616
* Check that all external packages listed in `deps` have corresponding `compat` entries.
1717
* There are no "obvious" type piracies.

docs/make.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ makedocs(;
1010
"unbound_args.md",
1111
"exports.md",
1212
"project_extras.md",
13-
"stale_deps.md",
13+
"unused_deps.md",
1414
"deps_compat.md",
1515
"piracies.md",
1616
"persistent_tasks.md",

docs/src/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Aqua.jl provides functions to run a few automatable checks for Julia packages:
55
* There are no method ambiguities.
66
* There are no undefined `export`s.
77
* There are no unbound type parameters.
8-
* There are no stale dependencies listed in `Project.toml`.
8+
* There are no unused dependencies listed in `Project.toml`.
99
* Check that test target of the root project `Project.toml` and test project (`test/Project.toml`) are consistent.
1010
* Check that all external packages listed in `deps` have corresponding `compat` entries.
1111
* There are no "obvious" type piracies.
@@ -75,7 +75,7 @@ using Aqua
7575
Aqua.test_all(
7676
YourPackage;
7777
ambiguities=(exclude=[SomePackage.some_function], broken=true),
78-
stale_deps=(ignore=[:SomePackage],),
78+
unused_deps=(ignore=[:SomePackage],),
7979
deps_compat=(ignore=[:SomeOtherPackage],),
8080
piracies=false,
8181
)

docs/src/stale_deps.md

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/src/unused_deps.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Unused dependencies
2+
3+
## [Test function](@id test_unused_deps)
4+
5+
```@docs
6+
Aqua.test_unused_deps
7+
```

src/Aqua.jl

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ include("ambiguities.jl")
1919
include("unbound_args.jl")
2020
include("exports.jl")
2121
include("project_extras.jl")
22-
include("stale_deps.jl")
22+
include("unused_deps.jl")
2323
include("deps_compat.jl")
2424
include("piracies.jl")
2525
include("persistent_tasks.jl")
@@ -33,7 +33,7 @@ Run the following tests:
3333
* [`test_unbound_args(testtarget)`](@ref test_unbound_args)
3434
* [`test_undefined_exports(testtarget)`](@ref test_undefined_exports)
3535
* [`test_project_extras(testtarget)`](@ref test_project_extras)
36-
* [`test_stale_deps(testtarget)`](@ref test_stale_deps)
36+
* [`test_unused_deps(testtarget)`](@ref test_unused_deps)
3737
* [`test_deps_compat(testtarget)`](@ref test_deps_compat)
3838
* [`test_piracies(testtarget)`](@ref test_piracies)
3939
* [`test_persistent_tasks(testtarget)`](@ref test_persistent_tasks)
@@ -48,7 +48,7 @@ passed to `\$x` to specify the keyword arguments for `test_\$x`.
4848
- `unbound_args = true`
4949
- `undefined_exports = true`
5050
- `project_extras = true`
51-
- `stale_deps = true`
51+
- `unused_deps = true`
5252
- `deps_compat = true`
5353
- `piracies = true`
5454
- `persistent_tasks = true`
@@ -59,7 +59,7 @@ function test_all(
5959
unbound_args = true,
6060
undefined_exports = true,
6161
project_extras = true,
62-
stale_deps = true,
62+
unused_deps = true,
6363
deps_compat = true,
6464
piracies = true,
6565
persistent_tasks = true,
@@ -85,9 +85,9 @@ function test_all(
8585
test_project_extras(testtarget)
8686
end
8787
end
88-
@testset "Stale dependencies" begin
89-
if stale_deps !== false
90-
test_stale_deps(testtarget; askwargs(stale_deps)...)
88+
@testset "Unused dependencies" begin
89+
if unused_deps !== false
90+
test_unused_deps(testtarget; askwargs(unused_deps)...)
9191
end
9292
end
9393
@testset "Compat bounds" begin
Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Aqua.test_stale_deps(package; [ignore])
2+
Aqua.test_unused_deps(package; [ignore])
33
44
Test that `package` loads all dependencies listed in `Project.toml`.
55
Note 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)
3232
end
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...)
3636
end
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
4343
end
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
)
7575
end
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
9393
end

test/test_smoke.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ using Aqua
55
# test defaults
66
Aqua.test_all(
77
Aqua;
8-
stale_deps = (; ignore = [:Compat]), # conditionally loaded
8+
unused_deps = (; ignore = [:Compat]), # conditionally loaded
99
)
1010

1111
# test everything else
@@ -15,7 +15,7 @@ Aqua.test_all(
1515
unbound_args = false,
1616
undefined_exports = false,
1717
project_extras = false,
18-
stale_deps = false,
18+
unused_deps = false,
1919
deps_compat = false,
2020
piracies = false,
2121
persistent_tasks = false,
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
1-
module TestStaleDeps
1+
module TestUnusedDeps
22

33
include("preamble.jl")
44
using Base: PkgId, UUID
5-
using Aqua: find_stale_deps_2
5+
using Aqua: find_unused_deps_2
66

7-
@testset "find_stale_deps_2" begin
7+
@testset "find_unused_deps_2" begin
88
pkg = PkgId(UUID(42), "TargetPkg")
99

1010
dep1 = PkgId(UUID(1), "Dep1")
1111
dep2 = PkgId(UUID(2), "Dep2")
1212
dep3 = PkgId(UUID(3), "Dep3")
1313

1414
@testset "pass" begin
15-
result = find_stale_deps_2(;
15+
result = find_unused_deps_2(;
1616
deps = PkgId[],
1717
weakdeps = PkgId[],
1818
loaded_uuids = UUID[],
1919
ignore = Symbol[],
2020
)
2121
@test isempty(result)
2222

23-
result = find_stale_deps_2(;
23+
result = find_unused_deps_2(;
2424
deps = PkgId[dep1],
2525
weakdeps = PkgId[],
2626
loaded_uuids = UUID[dep1.uuid, dep2.uuid, dep3.uuid],
2727
ignore = Symbol[],
2828
)
2929
@test isempty(result)
3030

31-
result = find_stale_deps_2(;
31+
result = find_unused_deps_2(;
3232
deps = PkgId[dep1],
3333
weakdeps = PkgId[],
3434
loaded_uuids = UUID[dep2.uuid, dep3.uuid],
3535
ignore = Symbol[:Dep1],
3636
)
3737
@test isempty(result)
3838

39-
result = find_stale_deps_2(;
39+
result = find_unused_deps_2(;
4040
deps = PkgId[dep1],
4141
weakdeps = PkgId[dep2],
4242
loaded_uuids = UUID[dep1.uuid],
4343
ignore = Symbol[],
4444
)
4545
@test isempty(result)
4646

47-
result = find_stale_deps_2(;
47+
result = find_unused_deps_2(;
4848
deps = PkgId[dep1, dep2],
4949
weakdeps = PkgId[dep2],
5050
loaded_uuids = UUID[dep1.uuid],
5151
ignore = Symbol[],
5252
)
5353
@test isempty(result)
5454

55-
result = find_stale_deps_2(;
55+
result = find_unused_deps_2(;
5656
deps = PkgId[dep1, dep2],
5757
weakdeps = PkgId[dep2],
5858
loaded_uuids = UUID[],
@@ -61,7 +61,7 @@ using Aqua: find_stale_deps_2
6161
@test isempty(result)
6262
end
6363
@testset "failure" begin
64-
result = find_stale_deps_2(;
64+
result = find_unused_deps_2(;
6565
deps = PkgId[dep1],
6666
weakdeps = PkgId[],
6767
loaded_uuids = UUID[],
@@ -70,7 +70,7 @@ using Aqua: find_stale_deps_2
7070
@test length(result) == 1
7171
@test dep1 in result
7272

73-
result = find_stale_deps_2(;
73+
result = find_unused_deps_2(;
7474
deps = PkgId[dep1],
7575
weakdeps = PkgId[],
7676
loaded_uuids = UUID[dep2.uuid, dep3.uuid],
@@ -79,7 +79,7 @@ using Aqua: find_stale_deps_2
7979
@test length(result) == 1
8080
@test dep1 in result
8181

82-
result = find_stale_deps_2(;
82+
result = find_unused_deps_2(;
8383
deps = PkgId[dep1, dep2],
8484
weakdeps = PkgId[],
8585
loaded_uuids = UUID[dep3.uuid],
@@ -93,7 +93,7 @@ end
9393
with_sample_pkgs() do
9494
@testset "Package without `deps`" begin
9595
pkg = AquaTesting.SAMPLE_PKG_BY_NAME["PkgWithoutDeps"]
96-
results = Aqua.find_stale_deps(pkg)
96+
results = Aqua.find_unused_deps(pkg)
9797
@test isempty(results)
9898
end
9999
end

0 commit comments

Comments
 (0)