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
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
defmodule Display.Paint do
|
||||
@moduledoc false
|
||||
def red(str), do: painter().red(str)
|
||||
def cyan(str), do: painter().cyan(str)
|
||||
def green(str), do: painter().green(str)
|
||||
@@ -13,6 +14,7 @@ defmodule Display.Paint do
|
||||
end
|
||||
|
||||
defmodule Display.Colours do
|
||||
@moduledoc false
|
||||
alias IO.ANSI
|
||||
|
||||
def red(str), do: colourize(ANSI.red(), str)
|
||||
@@ -26,6 +28,7 @@ defmodule Display.Colours do
|
||||
end
|
||||
|
||||
defmodule Display.Uncoloured do
|
||||
@moduledoc false
|
||||
def red(str), do: str
|
||||
def cyan(str), do: str
|
||||
def green(str), do: str
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
defmodule Display.Failure do
|
||||
@moduledoc false
|
||||
alias Display.Paint
|
||||
|
||||
@no_value :ex_unit_no_meaningful_value
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
defmodule Display.Intro do
|
||||
@moduledoc false
|
||||
alias Display.Paint
|
||||
|
||||
def intro(module, modules) do
|
||||
if not (module in modules) do
|
||||
show_intro(module.intro)
|
||||
else
|
||||
if module in modules do
|
||||
""
|
||||
else
|
||||
show_intro(module.intro)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
defmodule Display.Notifications do
|
||||
@moduledoc false
|
||||
alias Display.Paint
|
||||
|
||||
def congratulate do
|
||||
@@ -13,8 +14,7 @@ defmodule Display.Notifications do
|
||||
defp module_names(modules) do
|
||||
modules
|
||||
|> Enum.map(&Atom.to_string/1)
|
||||
|> Enum.map(&name/1)
|
||||
|> Enum.join(", ")
|
||||
|> Enum.map_join(", ", &name/1)
|
||||
|> Paint.red()
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
defmodule Display.ProgressBar do
|
||||
@moduledoc false
|
||||
@progress_bar_length 30
|
||||
|
||||
def progress_bar(%{current: current, total: total}) do
|
||||
|
||||
Reference in New Issue
Block a user