Skip to content

Commit

Permalink
Run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 30, 2020
1 parent 0ee78fa commit fa25e91
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 21 deletions.
33 changes: 16 additions & 17 deletions lib/ex_doc/retriever.ex
Original file line number Diff line number Diff line change
Expand Up @@ -134,23 +134,22 @@ defmodule ExDoc.Retriever do
{title, id} = module_title_and_id(module_data)
{nested_title, nested_context} = nesting_info(title, config.nest_modules_by_prefix)

node =
%ExDoc.ModuleNode{
id: id,
title: title,
nested_title: nested_title,
nested_context: nested_context,
module: module,
type: module_data.type,
deprecated: metadata[:deprecated],
function_groups: function_groups,
docs: Enum.sort_by(docs, &{&1.name, &1.arity}),
doc: moduledoc,
doc_line: doc_line,
typespecs: Enum.sort_by(types, &{&1.name, &1.arity}),
source_path: source_path,
source_url: source_link(source, line)
}
node = %ExDoc.ModuleNode{
id: id,
title: title,
nested_title: nested_title,
nested_context: nested_context,
module: module,
type: module_data.type,
deprecated: metadata[:deprecated],
function_groups: function_groups,
docs: Enum.sort_by(docs, &{&1.name, &1.arity}),
doc: moduledoc,
doc_line: doc_line,
typespecs: Enum.sort_by(types, &{&1.name, &1.arity}),
source_path: source_path,
source_url: source_link(source, line)
}

put_in(node.group, GroupMatcher.match_module(config.groups_for_modules, node))
end
Expand Down
18 changes: 14 additions & 4 deletions test/ex_doc/group_matcher_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ defmodule ExDoc.GroupMatcherTest do

assert match_module(patterns, %{module: MyApp.SomeModule, id: "MyApp.SomeModule"}) == :Group
assert match_module(patterns, %{module: :lists, id: ":lists"}) == :Group
assert match_module(patterns, %{module: MyApp.SomeOtherModule, id: "MyApp.SomeOtherModule"}) == nil

assert match_module(patterns, %{module: MyApp.SomeOtherModule, id: "MyApp.SomeOtherModule"}) ==
nil
end

test "it can match modules by their string names" do
Expand All @@ -20,7 +22,9 @@ defmodule ExDoc.GroupMatcherTest do

assert match_module(patterns, %{module: MyApp.SomeModule, id: "MyApp.SomeModule"}) == :Group
assert match_module(patterns, %{module: :lists, id: ":lists"}) == :Group
assert match_module(patterns, %{module: MyApp.SomeOtherModule, id: "MyApp.SomeOtherModule"}) == nil

assert match_module(patterns, %{module: MyApp.SomeOtherModule, id: "MyApp.SomeOtherModule"}) ==
nil
end

test "it can match modules by regular expressions" do
Expand All @@ -29,8 +33,14 @@ defmodule ExDoc.GroupMatcherTest do
]

assert match_module(patterns, %{module: MyApp.SomeModule, id: "MyApp.SomeModule"}) == :Group
assert match_module(patterns, %{module: MyApp.SomeOtherModule, id: "MyApp.SomeOtherModule"}) == :Group
assert match_module(patterns, %{module: MyAppWeb.SomeOtherModule, id: "MyAppWeb.SomeOtherModule"}) == nil

assert match_module(patterns, %{module: MyApp.SomeOtherModule, id: "MyApp.SomeOtherModule"}) ==
:Group

assert match_module(patterns, %{
module: MyAppWeb.SomeOtherModule,
id: "MyAppWeb.SomeOtherModule"
}) == nil
end
end

Expand Down

0 comments on commit fa25e91

Please sign in to comment.