Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SciMLTesting"
uuid = "09d9d899-5365-40a9-917a-5f67fddea283"
authors = ["SciML"]
version = "2.4.0"
version = "2.4.1"

[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Expand Down
18 changes: 14 additions & 4 deletions src/SciMLTesting.jl
Original file line number Diff line number Diff line change
Expand Up @@ -967,13 +967,23 @@ function _has_docstring(pkg::Module, name::Symbol)
return !occursin("No documentation found", doc)
end

# A re-exported module inherits its defining package's module documentation.
# Re-exported functions and types still require an explicit local API entry.
# Only names owned by this package's module hierarchy require a local rendered API
# entry. External public reexports are audited separately by `public_reexports`.
function _requires_local_rendering(pkg::Module, name::Symbol)
isdefined(pkg, name) || return true
binding_owner = try
which(pkg, name)
catch
pkg
end
_is_within_module(binding_owner, pkg) || return false
value = getfield(pkg, name)
value isa Module || return true
return _is_within_module(value, pkg)
owner = try
value isa Module ? value : parentmodule(value)
catch
pkg
end
return _is_within_module(owner, pkg)
end

# The bare name referenced by one line inside a ```@docs``` fenced block. A `@docs`
Expand Down
9 changes: 5 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,8 @@ end
end
@test c[:fail] == 0 && c[:pass] == 1

# A re-exported module inherits its defining package's module documentation.
# External reexports are checked by public_reexports, not the local rendered
# API-doc requirement.
rroot = mktempdir()
rsrc = joinpath(rroot, "src"); mkpath(rsrc)
c = counts_of() do
Expand All @@ -1141,10 +1142,10 @@ end
c = counts_of() do
run_api_docs(FunctionReexportFixture; docstrings = false, docs_src = rsrc)
end
@test c[:fail] == 1 && c[:error] == 0 && c[:pass] == 0
@test c[:fail] == 0 && c[:error] == 0 && c[:pass] == 1
@test :run_qa in public_api_names(FunctionReexportFixture)
@test SciMLTesting._requires_local_rendering(FunctionReexportFixture, :run_qa)
@test SciMLTesting._requires_local_rendering(ComprehensiveReexportFixture, :OwnedType)
@test !SciMLTesting._requires_local_rendering(FunctionReexportFixture, :run_qa)
@test !SciMLTesting._requires_local_rendering(ComprehensiveReexportFixture, :OwnedType)
@test SciMLTesting._requires_local_rendering(NestedOwnerFixture, :NestedModule)

# A package-owned submodule remains part of this package's rendered manual.
Expand Down
Loading