Skip to content

Commit

Permalink
Remove found_module?/2
Browse files Browse the repository at this point in the history
  • Loading branch information
NJichev committed May 2, 2024
1 parent 636cd9d commit cdee25f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/credo/check/warning/forbidden_module.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ defmodule Credo.Check.Warning.ForbiddenModule do
defp traverse({:__aliases__, meta, modules} = ast, issues, forbidden_modules, issue_meta) do
module = Name.full(modules)

if found_module?(module, forbidden_modules) do
if forbidden_modules[module] do
{ast, [issue_for(issue_meta, meta, module, forbidden_modules[module]) | issues]}
else
{ast, issues}
Expand All @@ -63,7 +63,7 @@ defmodule Credo.Check.Warning.ForbiddenModule do
Enum.reduce(aliases, issues, fn {:__aliases__, meta, module}, issues ->
full_name = Name.full([base_alias, module])

if found_module?(full_name, forbidden_modules) do
if forbidden_modules[full_name] do
message = forbidden_modules[full_name]
trigger = Name.full(module)
[issue_for(issue_meta, meta, trigger, message) | issues]
Expand All @@ -77,11 +77,6 @@ defmodule Credo.Check.Warning.ForbiddenModule do

defp traverse(ast, issues, _, _), do: {ast, issues}

defp found_module?(module, forbidden_modules) when is_map_key(forbidden_modules, module),
do: true

defp found_module?(_, _), do: false

defp issue_for(issue_meta, meta, trigger, message) do
format_issue(
issue_meta,
Expand Down

0 comments on commit cdee25f

Please sign in to comment.