Skip to content

Commit edf50fd

Browse files
committed
Add credo to the project and:
- Run mix credo --all to identify possible code optimizations - Resolve most of the errors generated by credo such as: - Numbers larger than 9999 should be written with underscores: 58_127 - Modules should have a @moduledoc tag - Comparison will always return true
1 parent 2ca2eee commit edf50fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+107
-45
lines changed

lib/blanks.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule Blanks do
2+
@moduledoc false
23
def replace(ast, replacements) do
34
replacements = List.wrap(replacements)
45

lib/display.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule Display do
2+
@moduledoc false
23
use GenServer
34

45
alias IO.ANSI
@@ -20,7 +21,7 @@ defmodule Display do
2021
{:noreply, %{state | clear_screen: false}}
2122
end
2223

23-
def handle_cast(:clear_screen, state = %{clear_screen: true}) do
24+
def handle_cast(:clear_screen, %{clear_screen: true} = state) do
2425
IO.puts(ANSI.clear())
2526
IO.puts(ANSI.home())
2627

lib/display/colours.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule Display.Paint do
2+
@moduledoc false
23
def red(str), do: painter().red(str)
34
def cyan(str), do: painter().cyan(str)
45
def green(str), do: painter().green(str)
@@ -13,6 +14,7 @@ defmodule Display.Paint do
1314
end
1415

1516
defmodule Display.Colours do
17+
@moduledoc false
1618
alias IO.ANSI
1719

1820
def red(str), do: colourize(ANSI.red(), str)
@@ -26,6 +28,7 @@ defmodule Display.Colours do
2628
end
2729

2830
defmodule Display.Uncoloured do
31+
@moduledoc false
2932
def red(str), do: str
3033
def cyan(str), do: str
3134
def green(str), do: str

lib/display/failure.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule Display.Failure do
2+
@moduledoc false
23
alias Display.Paint
34

45
@no_value :ex_unit_no_meaningful_value

lib/display/intro.ex

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
defmodule Display.Intro do
2+
@moduledoc false
23
alias Display.Paint
34

45
def intro(module, modules) do
5-
if not (module in modules) do
6-
show_intro(module.intro)
7-
else
6+
if module in modules do
87
""
8+
else
9+
show_intro(module.intro)
910
end
1011
end
1112

lib/display/notification.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule Display.Notifications do
2+
@moduledoc false
23
alias Display.Paint
34

45
def congratulate do
@@ -13,8 +14,7 @@ defmodule Display.Notifications do
1314
defp module_names(modules) do
1415
modules
1516
|> Enum.map(&Atom.to_string/1)
16-
|> Enum.map(&name/1)
17-
|> Enum.join(", ")
17+
|> Enum.map_join(", ", &name/1)
1818
|> Paint.red()
1919
end
2020

lib/display/progress_bar.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule Display.ProgressBar do
2+
@moduledoc false
23
@progress_bar_length 30
34

45
def progress_bar(%{current: current, total: total}) do

lib/elixir_koans.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule ElixirKoans do
2+
@moduledoc false
23
use Application
34

45
def start(_type, _args) do

lib/execute.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule Execute do
2+
@moduledoc false
23
def run_module(module, callback \\ fn _result, _module, _koan -> nil end) do
34
Enum.reduce_while(module.all_koans, :passed, fn koan, _ ->
45
module

lib/koans.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
defmodule Koans do
2+
@moduledoc false
23
defp valid_name(name) do
34
Regex.match?(~r/([A-Z]|\.\.\.).+/, name)
45
end

0 commit comments

Comments
 (0)