-
-
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 a way to test whether exported symbols are documented #51174
Comments
A docstring is the place for showing the interface of a function, regardless of whether the caller is inside or outside of the same module. It is useful both for writing callers and for modifying the function itself. Therefore I prefer to check that all functions have docstrings, not just public ones. |
Sure, for people that want this, that could be a keyword to The main thing is to export a |
This possibly should be an issue for https://github.com/JuliaTesting/Aqua.jl, which seems to be the goto place for better quality tests over what is in Test. |
Documenter also has some checks along these lines that can be part of CI when |
There is no way to tell programmatically if a function is API without testing whether it has documentation, and that will remain true after |
Regardless of where the tests belong (Test, Aqua, etcetera), I think (There is also the principle that anything that is needed for |
It seems like the |
Yes, someone should go ahead and make a PR with the (That's why I marked it as "good first issue". You can start with the code above as-is.) |
Not quite done - that PR adds function check_documented(mod::Module)
nodocs = filter!(sym -> !hasdoc(mod, sym), names(mod))
isempty(nodocs) || error("missing docstrings in $mod: $nodocs")
end in |
Why should |
Fixes #51174 --------- Co-authored-by: Steven G. Johnson <stevenj@alum.mit.edu> Co-authored-by: Steven G. Johnson <stevenj@mit.edu>
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. when ~~#52727~~ #52743 is merged.)~~ Has been updated. --------- Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>
As discussed on discourse, it would be nice to have a (documented) way to test whether all exported symbols in a module have docstrings. Currently, this seems to require undocumented internals?
Something like:
For example, this catches some missing docstrings in
Base
and several standard libraries:The text was updated successfully, but these errors were encountered: