Skip to content

Commit

Permalink
Fix spurious "Package.Package missing" warnings (#1009)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mortenpi authored May 8, 2019
1 parent 436c2e1 commit 004463c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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
Expand Down
18 changes: 15 additions & 3 deletions src/DocChecks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,22 @@ 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 = 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]
if object.signature Union{} || length(signatures) 1
delete!(bindings, object.binding)
delete!(bindings, binding)
elseif object.signature in signatures
delete!(signatures, object.signature)
end
Expand Down

0 comments on commit 004463c

Please sign in to comment.