Skip to content

Edoc still includes private functions so need to remove them #1968

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/ex_doc/language/erlang.ex
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ defmodule ExDoc.Language.Erlang do
def function_data(entry, module_data) do
{{kind, name, arity}, _anno, _signature, doc_content, metadata} = entry

if kind == :function and doc_content != :hidden do
# Edoc on Erlang/OTP24.1+ includes private functions in
# the chunk, so we manually yank them out.
if kind == :function and doc_content != :hidden and
function_exported?(module_data.module, name, arity) do
function_data(name, arity, doc_content, module_data, metadata)
else
:skip
Expand Down
9 changes: 8 additions & 1 deletion test/ex_doc/retriever/erlang_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ defmodule ExDoc.Retriever.ErlangTest do
%% @doc
%% mod docs.
-module(mod).
-export([function1/0, function2/0]).
-export([function1/0, function2/0, hidden_function/0]).

%% @doc
%% function1/0 docs.
Expand All @@ -386,6 +386,13 @@ defmodule ExDoc.Retriever.ErlangTest do
%% @doc
%% function2/0 docs.
function2() -> ok.

%% @doc hidden function docs.
%% @private
hidden_function() -> local_function().

%% @doc hidden function docs.
local_function() -> local_function().
""")

{[mod], []} = Retriever.docs_from_modules([:mod], %ExDoc.Config{})
Expand Down
Loading