Skip to content

Commit d09aac0

Browse files
authored
Skip Erlang modules that have empty docs (#1383)
1 parent ed109f0 commit d09aac0

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

lib/ex_doc/language/erlang.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ defmodule ExDoc.Language.Erlang do
66
alias ExDoc.{Autolink, Refs}
77

88
@impl true
9+
def module_data(_module, {:docs_v1, _, _, _, doc, _, _}, _config) when not is_map(doc) do
10+
:skip
11+
end
12+
913
def module_data(module, docs_chunk, _config) do
1014
":" <> id = inspect(module)
1115
abst_code = get_abstract_code(module)

test/ex_doc/retriever/erlang_test.exs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,20 @@ defmodule ExDoc.Retriever.ErlangTest do
7575
assert function2.specs == []
7676
end
7777

78+
@tag :otp23
79+
@tag :otp24
80+
test "module with no docs is skipped", c do
81+
erlc(c, :mod, ~S"""
82+
-module(mod).
83+
""")
84+
85+
[] = Retriever.docs_from_modules([:mod], %ExDoc.Config{})
86+
end
87+
7888
@tag :otp24
7989
test "callbacks", c do
8090
erlc(c, :mod, ~S"""
91+
%% @doc Docs.
8192
-module(mod).
8293
8394
-callback callback1() -> atom().
@@ -91,15 +102,14 @@ defmodule ExDoc.Retriever.ErlangTest do
91102
assert callback1.id == "c:callback1/0"
92103
assert callback1.type == :callback
93104
assert DocAST.to_string(callback1.doc) == "callback1/0 docs."
94-
assert Path.basename(callback1.source_url) == "mod.erl:3"
95-
# this is an edoc bug, it should be 4
96-
assert callback1.doc_line == 3
105+
assert Path.basename(callback1.source_url) == "mod.erl:4"
97106
assert Erlang.autolink_spec(hd(callback1.specs), []) == "callback1() -> atom()."
98107
end
99108

100109
@tag :otp24
101110
test "types", c do
102111
erlc(c, :mod, ~S"""
112+
%% @doc Docs.
103113
-module(mod).
104114
-export_type([type1/0, opaque1/0]).
105115

0 commit comments

Comments
 (0)