Skip to content

Commit

Permalink
Log @error for any DocCheck which triggers a failure. (#1349)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne authored Jul 20, 2020
1 parent 451aed1 commit 4fc0a06
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

* ![Enhancement][badge-enhancement] The generated HTML site now displays a footer by default that mentions Julia and Documenter. This can be customized or disabled by passing the `footer` keyword to `Documeter.HTML`. ([#1184][github-1184], [#1365][github-1365])

* ![Enhancement][badge-enhancement] Warnings that cause `makedocs` to error when `strict=true` are now printed as errors when `strict` is set to `true`. ([#1088][github-1088], [#1349][github-1349])

## Version `v0.25.0`

* ![Enhancement][badge-enhancement] When deploying with `deploydocs`, any SSH username can now be used (not just `git`), by prepending `username@` to the repository URL in the `repo` argument. ([#1285][github-1285])
Expand Down Expand Up @@ -543,6 +545,7 @@
[github-1077]: https://github.com/JuliaDocs/Documenter.jl/pull/1077
[github-1081]: https://github.com/JuliaDocs/Documenter.jl/issues/1081
[github-1082]: https://github.com/JuliaDocs/Documenter.jl/pull/1082
[github-1088]: https://github.com/JuliaDocs/Documenter.jl/issues/1088
[github-1089]: https://github.com/JuliaDocs/Documenter.jl/pull/1089
[github-1094]: https://github.com/JuliaDocs/Documenter.jl/pull/1094
[github-1097]: https://github.com/JuliaDocs/Documenter.jl/pull/1097
Expand Down Expand Up @@ -598,6 +601,7 @@
[github-1339]: https://github.com/JuliaDocs/Documenter.jl/pull/1339
[github-1344]: https://github.com/JuliaDocs/Documenter.jl/issues/1344
[github-1345]: https://github.com/JuliaDocs/Documenter.jl/pull/1345
[github-1349]: https://github.com/JuliaDocs/Documenter.jl/pull/1349
[github-1355]: https://github.com/JuliaDocs/Documenter.jl/pull/1355
[github-1357]: https://github.com/JuliaDocs/Documenter.jl/pull/1357
[github-1360]: https://github.com/JuliaDocs/Documenter.jl/pull/1360
Expand Down
19 changes: 11 additions & 8 deletions src/DocChecks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import ..Documenter:
using DocStringExtensions
import Markdown

using Logging
loglevel(doc) = doc.user.strict ? Logging.Error : Logging.Warn

# Missing docstrings.
# -------------------

Expand Down Expand Up @@ -60,7 +63,7 @@ function missingdocs(doc::Documents.Document)
end
end
push!(doc.internal.errors, :missing_docs)
@warn String(take!(b))
@logmsg loglevel(doc) String(take!(b))
end
end

Expand Down Expand Up @@ -123,17 +126,17 @@ function footnotes(doc::Documents.Document)
# Multiple footnote bodies.
if bodies > 1
push!(doc.internal.errors, :footnote)
@warn "footnote '$id' has $bodies bodies in $(Utilities.locrepr(page.source))."
@logmsg loglevel(doc) "footnote '$id' has $bodies bodies in $(Utilities.locrepr(page.source))."
end
# No footnote references for an id.
if ids === 0
push!(doc.internal.errors, :footnote)
@warn "unused footnote named '$id' in $(Utilities.locrepr(page.source))."
@logmsg loglevel(doc) "unused footnote named '$id' in $(Utilities.locrepr(page.source))."
end
# No footnote bodies for an id.
if bodies === 0
push!(doc.internal.errors, :footnote)
@warn "no footnotes found for '$id' in $(Utilities.locrepr(page.source))."
@logmsg loglevel(doc) "no footnotes found for '$id' in $(Utilities.locrepr(page.source))."
end
end
end
Expand Down Expand Up @@ -176,7 +179,7 @@ function linkcheck(doc::Documents.Document)
end
else
push!(doc.internal.errors, :linkcheck)
@warn "linkcheck requires `curl`."
@logmsg loglevel(doc) "linkcheck requires `curl`."
end
end
return nothing
Expand All @@ -203,7 +206,7 @@ function linkcheck(link::Markdown.Link, doc::Documents.Document; method::Symbol=
result = read(cmd, String)
catch err
push!(doc.internal.errors, :linkcheck)
@warn "$cmd failed:" exception = err
@logmsg loglevel(doc) "$cmd failed:" exception = err
return false
end
STATUS_REGEX = r"^(\d+) (\w+)://(?:\S+) (\S+)?$"m
Expand Down Expand Up @@ -234,11 +237,11 @@ function linkcheck(link::Markdown.Link, doc::Documents.Document; method::Symbol=
return linkcheck(link, doc; method=:GET)
else
push!(doc.internal.errors, :linkcheck)
@error "linkcheck '$(link.url)' status: $(status)."
@logmsg loglevel(doc) "linkcheck '$(link.url)' status: $(status)."
end
else
push!(doc.internal.errors, :linkcheck)
@warn "invalid result returned by $cmd:" result
@logmsg loglevel(doc) "invalid result returned by $cmd:" result
end
end
return false
Expand Down

0 comments on commit 4fc0a06

Please sign in to comment.