diff --git a/Project.toml b/Project.toml index 6d8d48303..2bcf8d9d0 100644 --- a/Project.toml +++ b/Project.toml @@ -26,6 +26,7 @@ StatsAPI = "1.2" julia = "1" [extras] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" @@ -34,4 +35,4 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["BenchmarkTools", "Dates", "DelimitedFiles", "OffsetArrays", "StableRNGs", "Test"] +test = ["Aqua", "BenchmarkTools", "Dates", "DelimitedFiles", "OffsetArrays", "StableRNGs", "Test"] diff --git a/docs/Project.toml b/docs/Project.toml index 525749756..7fe605752 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,7 +1,7 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" -StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" StatsAPI = "82ae8749-77ed-4fe6-ae5f-f523153014b0" +StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" [compat] Documenter = "0.27" diff --git a/test/ambiguous.jl b/test/ambiguous.jl deleted file mode 100644 index 59014ca0f..000000000 --- a/test/ambiguous.jl +++ /dev/null @@ -1,8 +0,0 @@ -using StatsBase -using Test -using Statistics - -@testset "Ambiguities" begin - # Ambiguities with Base, Core, and stdlib Statistics introduced by this package - @test_broken isempty(detect_ambiguities(StatsBase, Base, Core, Statistics)) -end diff --git a/test/aqua.jl b/test/aqua.jl new file mode 100644 index 000000000..ab6fce512 --- /dev/null +++ b/test/aqua.jl @@ -0,0 +1,36 @@ +using Test +using StatsBase +using Aqua + +@testset "Aqua tests (performance)" begin + # This tests that we don't accidentally run into + # https://github.com/JuliaLang/julia/issues/29393 + # Aqua.test_unbound_args(StatsBase) + ua = Aqua.detect_unbound_args_recursively(StatsBase) + @test length(ua) == 0 + + # See: https://github.com/SciML/OrdinaryDiffEq.jl/issues/1750 + # Test that we're not introducing method ambiguities across deps + ambs = Aqua.detect_ambiguities(StatsBase; recursive = true) + # Uncomment for debugging: + # for method_ambiguity in ambs + # @show method_ambiguity + # end + @test length(ambs) ≤ 5 + potentially_pirated_methods = Aqua.Piracy.hunt(StatsBase) + # Uncomment for debugging: + # for pirate in potentially_pirated_methods + # @show pirate + # end + @test length(potentially_pirated_methods) ≤ 27 +end + +@testset "Aqua tests (additional)" begin + Aqua.test_undefined_exports(StatsBase) + Aqua.test_stale_deps(StatsBase) + Aqua.test_deps_compat(StatsBase) + Aqua.test_project_extras(StatsBase) + Aqua.test_project_toml_formatting(StatsBase) +end + +nothing diff --git a/test/runtests.jl b/test/runtests.jl index 94986d240..eab7e8e76 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,7 +3,7 @@ using Dates using LinearAlgebra using Random -tests = ["ambiguous", +tests = ["aqua", "weights", "moments", "scalarstats",