Skip to content

Commit 5262fb5

Browse files
check that all public objects are documented
1 parent c2f42a6 commit 5262fb5

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

doc/make.jl

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ end
3636

3737
using Documenter
3838
import LibGit2
39+
using Logging: with_logger, NullLogger
3940

4041
baremodule GenStdLib end
4142

@@ -402,22 +403,62 @@ else
402403
end
403404

404405
const output_path = joinpath(buildrootdoc, "_build", (render_pdf ? "pdf" : "html"), "en")
405-
makedocs(
406+
doc = makedocs(
406407
source = joinpath(buildrootdoc, "src"),
407408
build = output_path,
408409
modules = [Main, Base, Core, [Base.root_module(Base, stdlib.stdlib) for stdlib in STDLIB_DOCS]...],
409410
clean = true,
410411
doctest = ("doctest=fix" in ARGS) ? (:fix) : ("doctest=only" in ARGS) ? (:only) : ("doctest=true" in ARGS) ? true : false,
411412
linkcheck = "linkcheck=true" in ARGS,
412413
linkcheck_ignore = ["https://bugs.kde.org/show_bug.cgi?id=136779"], # fails to load from nanosoldier?
413-
checkdocs = :none,
414+
checkdocs = :public,
415+
warnonly = :missing_docs, # warn about missing docstrings, but don't fail
414416
format = format,
415417
sitename = "The Julia Language",
416418
authors = "The Julia Project",
417419
pages = PAGES,
418420
remotes = documenter_stdlib_remotes,
421+
debug = true, # makes makedocs return the Documenter object for use later
419422
)
420423

424+
# update this when the number of missing docstrings changes
425+
const known_missing_from_manual = 397
426+
427+
# Check that we're not regressing in missing docs, but only check on PRs so that master builds can still pass
428+
if in("deploy", ARGS) && haskey(ENV,"BUILDKITE_BRANCH") && ENV["BUILDKITE_BRANCH"] != "master"
429+
430+
function show_buildkite_annotation(type::String, msg::String)
431+
if type == "success"
432+
@info msg
433+
else
434+
@warn msg
435+
end
436+
run(`buildkite-agent annotate --style $type --context "missing-docs" "$msg"`)
437+
end
438+
439+
# ignore logging in the report because makedocs has already run this internally, we just want the number out
440+
missing_from_manual = with_logger(NullLogger()) do
441+
Documenter.missingdocs(doc)
442+
end
443+
if missing_from_manual > known_missing_from_manual
444+
show_buildkite_annotation(
445+
"warning",
446+
"""New docstrings have been added for exported functions that are missing from the manual.
447+
Please add these to the manual."""
448+
)
449+
elseif missing_from_manual < known_missing_from_manual
450+
show_buildkite_annotation(
451+
"success",
452+
"""🎉 The number of missing docstrings in the manual has decreased!
453+
Update `doc/make.jl` from $known_missing_from_manual to:
454+
```term
455+
const known_missing_from_manual = $missing_from_manual
456+
```
457+
"""
458+
)
459+
end
460+
end
461+
421462
# Update URLs to external stdlibs (JuliaLang/julia#43199)
422463
for (root, _, files) in walkdir(output_path), file in joinpath.(root, files)
423464
endswith(file, ".html") || continue

0 commit comments

Comments
 (0)