-
-
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 Docs.undocumented_names #52413
Add Docs.undocumented_names #52413
Conversation
@stevengj ready for review. |
I suspect we don’t want a function that throws an error here. We probably just want a function that returns a sorted list of undocumented symbols. Then people can just add tests like @test Docs.undocumented_names(MyMod) == [:known1, :known2]
@test_broken Docs.undocumented_names(MyMod2) == [] |
Co-authored-by: Steven G. Johnson <stevenj@mit.edu>
What should happen here? @stevengj |
For now, if you want to check the |
Co-authored-by: Steven G. Johnson <stevenj@mit.edu>
idk what that failure is. |
This is ready for merge. |
Sorry I'm a little late here; I'm not sure implementing this function in Base.Docs is a good idea. It seems like the kind of functionality that is used in development and testing but not in ordinary usage. Consequently, I think it belongs in Test or Aqua where it can be implemented in terms of Base's existing public API (thanks to @jariji's #52139) My opinion here is pretty weak, and I'd be open to possibly keeping it here, but I do think this should be discussed before we commit to adding this public API to Base.Docs Regardless of the above, we should fix the docstring which currently misrepresents the behavior on undocumetned public but unexported symbols. (IIUC docstring: they are not returned by default; reality: they are returned by default) |
Clarification: IMO having this functionality is definitely a good idea, the question is where to have it. |
If it goes anywhere else, it should be in Test (not Aqua) so that it can be used to test Base modules and stdlibs. (That was my initial suggestion from #51174.) I don't remember why we didn't discuss it here, sorry. |
I think the argument to put it in
(Though since the If we put it in |
You're right, having Still, the thought was that |
""" | ||
function undocumented_names(mod::Module; all::Bool=false) | ||
filter!(names(mod; all)) do sym | ||
!hasdoc(mod, sym) && Base.isidentifier(sym) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that this filters out macro symbols @foo
, which we don't want to exclude. Probably should be
str = string(sym)
!hasdoc(mod, sym) && (Base.isidentifier(sym) || (startswith(str, "@") && Base.isidentifier(str[2:end])))
Similar to the argument that I make in #52724, I think that we should rename I've opened #52726, which proposes renaming it to |
From the dregs of triage (Lilith, Jeff, Jar) after most folks left: Base.Docs is a fine place for this functionality to go. It's nontrivial to get right, so worth implementing, and it's needed by Base, so worth putting in Base/Docs/Test. It can be used even in the absence of testing, so shouldn't be in Test. undocumented_names is a reasonable name. The only thing that "documented" could mean, from Base.Docs's perspective, is "has a docstring" because Base.Docs doesn't know about the manual or any Documenter.jl stuff. _is_hidden_name(s::Symbol) = !isempty(string(x)) && string(x)[1] == '#' And use this semantic for Following the pattern of |
Expands the semantics of `Docs.undocumented_names` to include all public symbols, as described in #52413 (comment) cc @jariji, @LilithHafner --------- Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>
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>
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 JuliaLang/julia#52413 (comment) is fixed, i.e. when ~~#52727~~ #52743 is merged.)~~ Has been updated. --------- Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>
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 JuliaLang/julia#52413 (comment) is fixed, i.e. when ~~#52727~~ #52743 is merged.)~~ Has been updated. --------- Co-authored-by: Lilith Orion Hafner <lilithhafner@gmail.com>
Fixes #51174
Cross-ref: #52139