Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log @error for any DocCheck which triggers a failure. #1349

Merged
merged 3 commits into from
Jul 20, 2020
Merged
Changes from 1 commit
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
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