diff --git a/CHANGELOG.md b/CHANGELOG.md index a9d083e4..7c60422b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - The minimum supported julia version is increased to 1.6. ([#328]) +- Test for undocumented names is now activated by default ([#368]) ## Version [v0.8.14] - 2025-08-04 diff --git a/src/Aqua.jl b/src/Aqua.jl index acc33a39..b630197e 100644 --- a/src/Aqua.jl +++ b/src/Aqua.jl @@ -46,7 +46,7 @@ passed to `\$x` to specify the keyword arguments for `test_\$x`. - `deps_compat = true` - `piracies = true` - `persistent_tasks = true` -- `undocumented_names = false` +- `undocumented_names = true` """ function test_all( testtarget::Module; @@ -58,7 +58,7 @@ function test_all( deps_compat = true, piracies = true, persistent_tasks = true, - undocumented_names = false, + undocumented_names = true, ) if ambiguities !== false @testset "Method ambiguity" begin diff --git a/src/exports.jl b/src/exports.jl index 80c7bebf..61b8cbcd 100644 --- a/src/exports.jl +++ b/src/exports.jl @@ -7,15 +7,15 @@ function isbindingresolved(m::Module, s::Symbol) end end -function walkmodules(f, x::Module) +function walkmodules(f, x::Module; all::Bool = true) f(x) - for n in names(x; all = true) + for n in names(x; all) # `isdefined` and `getproperty` can trigger deprecation warnings if isbindingresolved(x, n) && !Base.isdeprecated(x, n) isdefined(x, n) || continue y = getproperty(x, n) if y isa Module && y !== x && parentmodule(y) === x - walkmodules(f, y) + walkmodules(f, y; all) end end end diff --git a/src/undocumented_names.jl b/src/undocumented_names.jl index 40e749da..e4eb1a0e 100644 --- a/src/undocumented_names.jl +++ b/src/undocumented_names.jl @@ -22,7 +22,7 @@ function test_undocumented_names(m::Module; broken::Bool = false) @static if VERSION >= v"1.11" # exclude the module name itself because it has the README as auto-generated docstring (https://github.com/JuliaLang/julia/pull/39093) undocumented_names = Symbol[] - walkmodules(m) do x + walkmodules(m; all=false) do x # we don't care about undocumented names in private submodules append!(undocumented_names, Docs.undocumented_names(x)) end undocumented_names = filter(n -> n != nameof(m), undocumented_names) diff --git a/test/pkgs/PkgWithUndocumentedNamesInSubmodule.jl b/test/pkgs/PkgWithUndocumentedNamesInSubmodule.jl index deddc03b..c00fe1c7 100644 --- a/test/pkgs/PkgWithUndocumentedNamesInSubmodule.jl +++ b/test/pkgs/PkgWithUndocumentedNamesInSubmodule.jl @@ -11,4 +11,6 @@ struct UndocumentedStruct end end +export SubModule + end # module