Skip to content

Commit

Permalink
Sort ambiguities and type piracies by function name (#233)
Browse files Browse the repository at this point in the history
* Sort ambiguities and type piracies by function name

* Add changelog
  • Loading branch information
lgoettgens authored Nov 4, 2023
1 parent de25cfa commit 0979329
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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_ambiguities` and `test_piracies` now return issues in a defined order. This order may change in a patch release of Aqua.jl. ([#233](https://github.com/JuliaTesting/Aqua.jl/pull/233))

### Removed

Expand Down
2 changes: 2 additions & 0 deletions src/ambiguities.jl
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,8 @@ function test_ambiguities_impl(
end
end

sort!(ambiguities, by = (ms -> (ms[1].name, ms[2].name)))

if !isempty(ambiguities)
printstyled("$(length(ambiguities)) ambiguities found", color = :red)
println()
Expand Down
4 changes: 3 additions & 1 deletion src/piracies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,11 @@ function is_pirate(meth::Method; treat_as_own = Union{Function,Type}[])
end

function hunt(mod::Module; skip_deprecated::Bool = true, kwargs...)
filter(all_methods(mod; skip_deprecated = skip_deprecated)) do method
piracies = filter(all_methods(mod; skip_deprecated = skip_deprecated)) do method
method.module === mod && is_pirate(method; kwargs...)
end
sort!(piracies, by = (m -> m.name))
return piracies
end

end # module
Expand Down

0 comments on commit 0979329

Please sign in to comment.