From 2e0ee9e5b99998feaa4dcedfc8f8a5e13211898c Mon Sep 17 00:00:00 2001 From: hyrodium Date: Tue, 31 Oct 2023 23:12:09 +0900 Subject: [PATCH 1/4] rename `test_picacy` to `test_piracies` --- docs/src/index.md | 2 +- src/Aqua.jl | 10 +++++----- src/piracy.jl | 17 ++++++++--------- test/test_smoke.jl | 2 +- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index 32181aaf..b0c592bf 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -83,7 +83,7 @@ using Aqua project_extras=true, stale_deps=(ignore=[:SomePackage],), deps_compat=(ignore=[:SomeOtherPackage],), - piracy=false, + piracies=false, ) end ``` diff --git a/src/Aqua.jl b/src/Aqua.jl index 3bd373db..08b39689 100644 --- a/src/Aqua.jl +++ b/src/Aqua.jl @@ -33,7 +33,7 @@ Run following tests in isolated testset: * [`test_project_extras(testtarget)`](@ref test_project_extras) * [`test_stale_deps(testtarget)`](@ref test_stale_deps) * [`test_deps_compat(testtarget)`](@ref test_deps_compat) -* [`test_piracy(testtarget)`](@ref test_piracy) +* [`test_piracies(testtarget)`](@ref test_piracies) * [`test_persistent_tasks(testtarget)`](@ref test_persistent_tasks) The keyword argument `\$x` (e.g., `ambiguities`) can be used to @@ -48,7 +48,7 @@ passed to `\$x` to specify the keyword arguments for `test_\$x`. - `project_extras = true` - `stale_deps = true` - `deps_compat = true` -- `piracy = true` +- `piracies = true` - `persistent_tasks = true` """ function test_all( @@ -59,7 +59,7 @@ function test_all( project_extras = true, stale_deps = true, deps_compat = true, - piracy = true, + piracies = true, persistent_tasks = true, ) @testset "Method ambiguity" begin @@ -93,8 +93,8 @@ function test_all( end end @testset "Piracy" begin - if piracy !== false - test_piracy(testtarget; askwargs(piracy)...) + if piracies !== false + test_piracies(testtarget; askwargs(piracies)...) end end @testset "Persistent tasks" begin diff --git a/src/piracy.jl b/src/piracy.jl index 9d76d6e2..3b7f0f19 100644 --- a/src/piracy.jl +++ b/src/piracy.jl @@ -89,7 +89,7 @@ is_foreign(@nospecialize(x), pkg::Base.PkgId; treat_as_own) = # # as a type piracy even if this is actually the intended use-case (which is not # a crazy API). The symbol name may also come from `gensym`. Since the aim of -# `Aqua.test_piracy` is to detect only "obvious" piracy, let us play on the +# `Aqua.test_piracies` is to detect only "obvious" piracies, let us play on the # safe side. is_foreign(x::Symbol, pkg::Base.PkgId; treat_as_own) = false @@ -111,8 +111,8 @@ function is_foreign(@nospecialize(T::DataType), pkg::Base.PkgId; treat_as_own) end function is_foreign(@nospecialize(U::UnionAll), pkg::Base.PkgId; treat_as_own) - # We do not consider extending Set{T} to be piracy, if T is not foreign. - # Extending it goes against Julia style, but it's not piracy IIUC. + # We do not consider extending Set{T} to be piracies, if T is not foreign. + # Extending it goes against Julia style, but it's not piracies IIUC. is_foreign(U.body, pkg; treat_as_own = treat_as_own) && is_foreign(U.var, pkg; treat_as_own = treat_as_own) end @@ -127,8 +127,7 @@ is_foreign(@nospecialize(T::TypeVar), pkg::Base.PkgId; treat_as_own) = end function is_foreign(@nospecialize(U::Union), pkg::Base.PkgId; treat_as_own) - # Even if Foo is local, overloading f(::Union{Foo, Int}) with foreign f - # is piracy. + # Even if Foo is local, overloading f(::Union{Foo, Int}) with foreign f is piracy. any(T -> is_foreign(T, pkg; treat_as_own = treat_as_own), Base.uniontypes(U)) end @@ -199,9 +198,9 @@ end end # module """ - test_piracy(m::Module) + test_piracies(m::Module) -Test that `m` does not commit type piracy. +Test that `m` does not commit type piracies. See [Julia documentation](https://docs.julialang.org/en/v1/manual/style-guide/#Avoid-type-piracy) for more information about type piracy. # Keyword Arguments @@ -210,11 +209,11 @@ See [Julia documentation](https://docs.julialang.org/en/v1/manual/style-guide/#A - `skip_deprecated::Bool = true`: If true, it does not check deprecated methods. - `treat_as_own = Union{Function, Type}[]`: The types in this container are considered to be "owned" by the module `m`. This is useful for - testing packages that deliberately commit some type piracy, e.g. modules + testing packages that deliberately commit some type piracies, e.g. modules adding higher-level functionality to a lightweight C-wrapper, or packages that are extending `StatsAPI.jl`. """ -function test_piracy(m::Module; broken::Bool = false, kwargs...) +function test_piracies(m::Module; broken::Bool = false, kwargs...) v = Piracy.hunt(m; kwargs...) if !isempty(v) printstyled( diff --git a/test/test_smoke.jl b/test/test_smoke.jl index ef13523f..481cfe7e 100644 --- a/test/test_smoke.jl +++ b/test/test_smoke.jl @@ -14,7 +14,7 @@ Aqua.test_all( project_extras = false, stale_deps = false, deps_compat = false, - piracy = false, + piracies = false, persistent_tasks = false, ) From 289d58fb05cd55443e4f37fb936eaf7c6c48829f Mon Sep 17 00:00:00 2001 From: hyrodium Date: Tue, 31 Oct 2023 23:12:43 +0900 Subject: [PATCH 2/4] rename src/piracy.jl -> src/piracies.jl --- src/Aqua.jl | 2 +- src/{piracy.jl => piracies.jl} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename src/{piracy.jl => piracies.jl} (100%) diff --git a/src/Aqua.jl b/src/Aqua.jl index 08b39689..0c0dd6c8 100644 --- a/src/Aqua.jl +++ b/src/Aqua.jl @@ -19,7 +19,7 @@ include("exports.jl") include("project_extras.jl") include("stale_deps.jl") include("deps_compat.jl") -include("piracy.jl") +include("piracies.jl") include("persistent_tasks.jl") """ diff --git a/src/piracy.jl b/src/piracies.jl similarity index 100% rename from src/piracy.jl rename to src/piracies.jl From d67763a0b6696d496e17563d8194833fc136aa8f Mon Sep 17 00:00:00 2001 From: hyrodium Date: Tue, 31 Oct 2023 23:14:53 +0900 Subject: [PATCH 3/4] update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0af567e0..12fa75e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `test_ambiguities` now excludes the keyword sorter of all `exclude`d functions with keyword arguments as well. ([#203](https://github.com/JuliaTesting/Aqua.jl/pull/204)) - In `test_deps_compat`, the two subtests `check_extras` and `check_weakdeps` are now run by default. ([#202](https://github.com/JuliaTesting/Aqua.jl/pull/202)) [BREAKING] - `test_deps_compat` now reqiures compat entries for all dependencies. Stdlibs no longer get ignored. This change is motivated by similar changes in the General registry. ([#215](https://github.com/JuliaTesting/Aqua.jl/pull/215)) [BREAKING] +- `test_piracy` is renamed to `test_piracies` ([#230](https://github.com/JuliaTesting/Aqua.jl/pull/230)) [BREAKING] ### Removed From 42b13298211646f97c6769243480c18deb597207 Mon Sep 17 00:00:00 2001 From: Yuto Horikawa Date: Tue, 31 Oct 2023 23:18:48 +0900 Subject: [PATCH 4/4] fix typo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Lars Göttgens --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 12fa75e6..4b5857e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `test_ambiguities` now excludes the keyword sorter of all `exclude`d functions with keyword arguments as well. ([#203](https://github.com/JuliaTesting/Aqua.jl/pull/204)) - In `test_deps_compat`, the two subtests `check_extras` and `check_weakdeps` are now run by default. ([#202](https://github.com/JuliaTesting/Aqua.jl/pull/202)) [BREAKING] - `test_deps_compat` now reqiures compat entries for all dependencies. Stdlibs no longer get ignored. This change is motivated by similar changes in the General registry. ([#215](https://github.com/JuliaTesting/Aqua.jl/pull/215)) [BREAKING] -- `test_piracy` is renamed to `test_piracies` ([#230](https://github.com/JuliaTesting/Aqua.jl/pull/230)) [BREAKING] +- `test_piracy` is renamed to `test_piracies`. ([#230](https://github.com/JuliaTesting/Aqua.jl/pull/230)) [BREAKING] ### Removed