-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
add tests for undocumented symbols #52723
Conversation
May I suggest a more gradual approach: @test length(undocumented_names(M)) <= 10 which can be incrementally decremented as people add docstrings. That way we can still test modules that aren't fully documented yet. |
In the context of this PR, what does "undocumented symbol" mean? Does it mean:
|
The current PR does support such modules. The way it works is: undoc = Docs.undocumented_names(SomeModule)
@test_broken undoc == []
@test undoc = [:bar, :baz] where the second (And we prefer |
@DilumAluthge, an undocumented symbol is a |
Oops, you're right. |
Do we want a """
submodules(mod::Module; private::Bool=false) -> Vector{Module}
Return a sorted vector of public submodules of `mod`, including recursive submodules.
If `private` is `true`, also return non-public submodules.
"""
submodules(mod::Module; private::Bool=false) =
sort!(collect(_submodules!(Set((mod,)), mod, private)), by=string)
function _submodules!(mods, mod, private)
for sym in names(mod, all=true)
if (private || Base.ispublic(mod, sym)) && isdefined(mod, sym)
val = getproperty(mod, sym)
if val isa Module && val ∉ mods
push!(mods, val)
_submodules!(mods, val, private)
end
end
end
mods
end |
|
@LilithHafner, I ran your It wouldn't be as easy to run automatically because of the large number of missing docstrings, however. Once #52725 is closed we might reconsider. |
CI failure on
Should be okay to merge? |
I haven't seen that one before. Could you open an issue for it and add the |
Filed an issue. |
Good to merge? |
LGTM |
Merging base in before merging to catch semantic merge conflicts with folks adding docstrings to public symbols |
Unrelated CI error on
Should be good to merge. |
Following #52413 by @jariji and the discussion in #51174, this adds tests to ensure that there are no undocumented (= lacking docstrings) public symbols in any documented module.
Many of the tests are broken — we have a lot of undocumented exports. In such cases I added both a
@test_broken
and a@test
to ensure that there are no additional regressions added in the future.(This PR may have to be updated when #52413 (comment) is fixed, i.e. whenHas been updated.#52727#52743 is merged.)