Files
elixir-koans/lib/display/notification.ex
Ahmed Ismail edf50fdf80 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
2023-11-10 00:57:21 +05:00

24 lines
568 B
Elixir

defmodule Display.Notifications do
@moduledoc false
alias Display.Paint
def congratulate do
Paint.green("\nYou have learned much. You must find your own path now.")
end
def invalid_koan(koan, modules) do
koans_names = module_names(modules)
"Did not find koan #{name(koan)} in " <> koans_names
end
defp module_names(modules) do
modules
|> Enum.map(&Atom.to_string/1)
|> Enum.map_join(", ", &name/1)
|> Paint.red()
end
defp name("Elixir." <> module), do: module
defp name(module), do: name(Atom.to_string(module))
end