Skip to content
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

Do not link to undocumented types #110

Closed
ericmj opened this issue Dec 27, 2013 · 3 comments
Closed

Do not link to undocumented types #110

ericmj opened this issue Dec 27, 2013 · 3 comments
Labels

Comments

@ericmj
Copy link
Member

ericmj commented Dec 27, 2013

Here: http://elixir-lang.org/docs/master/Version.html we link to the types Version.Schema.t and Version.Requirement.t. The types are not documented which is creating 404 links.

We should make sure we are not creating 404 links and we could warn that we are referencing a type that is not documented.

@pminten
Copy link

pminten commented Dec 28, 2013

It looks like this is a problem with the autolinker, while it does check whether modules and functions exist in the current project it doesn't do so for types.

@jwarwick
Copy link
Contributor

I spent a little bit of time looking at this and here's what I found. Suspect you guys already knew most of it, but I'm going to say it out loud for my understanding.

For the Version.Schema.t example, Version.Schema is a defrecord inside Version which does not have any documentation. ExDoc.Retriever.verify_module/2 removes these records from the list of modules to build documentation pages for. There is a comment calling out this fact in the code. Something about waiting for maps...

When ExDoc.HTMLFormatter.Autolink.typespec/3 runs, it calls ExDoc.HTMLFormatter.Autolink.get_source/2 which doesn't find Version.Schema in the local aliases list, but does find the beam file in the elixir lib path. At that point it constructs a link to where the doc page would be (had it not been stripped by the Retriever). You need this elixir lib path check in general to catch other generic types (like String).

Based on this, I don't see an easy way to catch this case. One option would be to allow doc pages to be created for these records. Or find some way to check __info__ and figure out it's not something we should be linking to.

@josevalim
Copy link
Member

Closing in favor of #192.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

5 participants