Skip to content

Commit a0e1255

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

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

doc/make.jl

Lines changed: 46 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,65 @@ 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 = 398
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+
Number known to be missing=#$(known_missing_from_manual), Current=$missing_from_manual.
449+
See the `doctest` job for details.
450+
"""
451+
)
452+
elseif missing_from_manual < known_missing_from_manual
453+
show_buildkite_annotation(
454+
"success",
455+
"""🎉 The number of missing docstrings in the manual has decreased!
456+
Update `doc/make.jl` from $known_missing_from_manual to:
457+
```term
458+
const known_missing_from_manual = $missing_from_manual
459+
```
460+
"""
461+
)
462+
end
463+
end
464+
421465
# Update URLs to external stdlibs (JuliaLang/julia#43199)
422466
for (root, _, files) in walkdir(output_path), file in joinpath.(root, files)
423467
endswith(file, ".html") || continue

0 commit comments

Comments
 (0)