Skip to content

Commit 2143bd9

Browse files
committed
Show required Elixir version for skipped checks
1 parent 74dd296 commit 2143bd9

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

lib/credo/cli/output.ex

+26-23
Original file line numberDiff line numberDiff line change
@@ -207,23 +207,39 @@ defmodule Credo.CLI.Output do
207207
:reset,
208208
:faint,
209209
"your version of Elixir (#{System.version()}).\n\n",
210-
"You can deactivate these checks by adding this to the `checks` list in your config:\n"
210+
"You can deactivate these checks by adding them to the `:checks`/`:disabled` list in your config:\n"
211211
]
212212

213213
UI.puts("")
214214
UI.puts(msg)
215215

216-
skipped_checks
217-
|> Enum.map(&check_name/1)
218-
|> print_disabled_check_config
219-
end
216+
UI.puts([
217+
:faint,
218+
"""
219+
checks: %{
220+
disabled: [
221+
"""
222+
|> String.trim_trailing()
223+
])
220224

221-
defp check_name({check, _check_info}), do: check_name({check})
225+
skipped_checks
226+
|> Enum.flat_map(fn {check, params} ->
227+
[
228+
:reset,
229+
:cyan,
230+
" {#{Credo.Code.Module.name(check)}, #{inspect(params)}},\t# requires Elixir #{check.elixir_version()}\n"
231+
]
232+
end)
233+
|> UI.puts()
222234

223-
defp check_name({check}) do
224-
check
225-
|> to_string
226-
|> String.replace(~r/^Elixir\./, "")
235+
UI.puts([
236+
:faint,
237+
"""
238+
# ...
239+
]
240+
}
241+
"""
242+
])
227243
end
228244

229245
defp print_numbered_list(list) do
@@ -239,17 +255,4 @@ defmodule Credo.CLI.Output do
239255
end)
240256
|> UI.warn()
241257
end
242-
243-
defp print_disabled_check_config(list) do
244-
list
245-
|> Enum.flat_map(fn string ->
246-
[
247-
:reset,
248-
String.pad_leading(" ", 4),
249-
:faint,
250-
"{#{string}, false},\n"
251-
]
252-
end)
253-
|> UI.puts()
254-
end
255258
end

0 commit comments

Comments
 (0)