From c34c541819e28feb84e34339ae6864deacb01a66 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Mon, 6 May 2019 22:36:58 +1200 Subject: [PATCH 1/2] Fix spurious Package.Package missing warnings It seems that going from Julia 0.6 to 0.7 the way module bindings are stored in the docs metadata changed from Binding(Mod, :SubMod) to Binding(Mod.SubMod, :SubMod). Documenter, however, still constructs the former Binding objects for modules that are listed just as SubMod in an at-docs block. This fixes the spurious errors that causes when checking for missing docs by explicitly normalizing the module bindings that Documenter creates before it crosschecks them against the bindings in docs metadata. --- src/DocChecks.jl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/DocChecks.jl b/src/DocChecks.jl index 40ece0b5e7..f5574e4f67 100644 --- a/src/DocChecks.jl +++ b/src/DocChecks.jl @@ -28,10 +28,18 @@ function missingdocs(doc::Documents.Document) @debug "checking for missing docstrings." bindings = allbindings(doc.user.checkdocs, doc.user.modules) for object in keys(doc.internal.objects) - if haskey(bindings, object.binding) - signatures = bindings[object.binding] + # The module references in docs blocks can yield a binding like + # Docs.Binding(Mod, :SubMod) for a module SubMod, a submodule of Mod. However, the + # module bindings that come from Docs.meta() always appear to be of the form + # Docs.Binding(Mod.SubMod, :SubMod) (since Julia 0.7). We therefore "normalize" + # module bindings before we search in the list returned by allbindings(). + binding = let b = object.binding, m = Docs.resolve(b) + isa(m, Module) && nameof(b.mod) != b.var ? Docs.Binding(m, nameof(m)) : b + end + if haskey(bindings, binding) + signatures = bindings[binding] if object.signature ≡ Union{} || length(signatures) ≡ 1 - delete!(bindings, object.binding) + delete!(bindings, binding) elseif object.signature in signatures delete!(signatures, object.signature) end From 81b8a858fe47208f4614c4cda1d9af9c8169f228 Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Tue, 7 May 2019 20:51:08 +1200 Subject: [PATCH 2/2] Fix errors, CHANGELOG --- CHANGELOG.md | 3 +++ src/DocChecks.jl | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 198e45832d..9e722ad251 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ * ![Bugfix][badge-bugfix] URLs for files in the repository are now generated correctly when the repository is used as a Git submodule in another repository. ([#1000][github-1000], [#1004][github-1004]) +* ![Bugfix][badge-bugfix] When checking for omitted docstrings, Documenter no longer gives "`Package.Package` missing" type false positives. ([#1009][github-1009]) + ## Version `v0.22.3` * ![Bugfix][badge-bugfix] Fixed filepaths for images included in the .tex file for PDF output on Windows. ([#999][github-999]) @@ -308,6 +310,7 @@ [github-1000]: https://github.com/JuliaDocs/Documenter.jl/issues/1000 [github-1002]: https://github.com/JuliaDocs/Documenter.jl/pull/1002 [github-1004]: https://github.com/JuliaDocs/Documenter.jl/pull/1004 +[github-1009]: https://github.com/JuliaDocs/Documenter.jl/pull/1009 [documenterlatex]: https://github.com/JuliaDocs/DocumenterLaTeX.jl [documentermarkdown]: https://github.com/JuliaDocs/DocumenterMarkdown.jl diff --git a/src/DocChecks.jl b/src/DocChecks.jl index f5574e4f67..13c1d29df9 100644 --- a/src/DocChecks.jl +++ b/src/DocChecks.jl @@ -33,8 +33,12 @@ function missingdocs(doc::Documents.Document) # module bindings that come from Docs.meta() always appear to be of the form # Docs.Binding(Mod.SubMod, :SubMod) (since Julia 0.7). We therefore "normalize" # module bindings before we search in the list returned by allbindings(). - binding = let b = object.binding, m = Docs.resolve(b) - isa(m, Module) && nameof(b.mod) != b.var ? Docs.Binding(m, nameof(m)) : b + binding = if Documenter.DocSystem.defined(object.binding) && !Documenter.DocSystem.iskeyword(object.binding) + m = Documenter.DocSystem.resolve(object.binding) + isa(m, Module) && nameof(object.binding.mod) != object.binding.var ? + Docs.Binding(m, nameof(m)) : object.binding + else + object.binding end if haskey(bindings, binding) signatures = bindings[binding]