From 2143bd92f0f8841bf546b9fdb7eb664ca26f9e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20F=C3=B6hring?= Date: Thu, 28 Nov 2024 19:46:57 +0100 Subject: [PATCH] Show required Elixir version for skipped checks --- lib/credo/cli/output.ex | 49 ++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/lib/credo/cli/output.ex b/lib/credo/cli/output.ex index c40974a67..cfd16f7be 100644 --- a/lib/credo/cli/output.ex +++ b/lib/credo/cli/output.ex @@ -207,23 +207,39 @@ defmodule Credo.CLI.Output do :reset, :faint, "your version of Elixir (#{System.version()}).\n\n", - "You can deactivate these checks by adding this to the `checks` list in your config:\n" + "You can deactivate these checks by adding them to the `:checks`/`:disabled` list in your config:\n" ] UI.puts("") UI.puts(msg) - skipped_checks - |> Enum.map(&check_name/1) - |> print_disabled_check_config - end + UI.puts([ + :faint, + """ + checks: %{ + disabled: [ + """ + |> String.trim_trailing() + ]) - defp check_name({check, _check_info}), do: check_name({check}) + skipped_checks + |> Enum.flat_map(fn {check, params} -> + [ + :reset, + :cyan, + " {#{Credo.Code.Module.name(check)}, #{inspect(params)}},\t# requires Elixir #{check.elixir_version()}\n" + ] + end) + |> UI.puts() - defp check_name({check}) do - check - |> to_string - |> String.replace(~r/^Elixir\./, "") + UI.puts([ + :faint, + """ + # ... + ] + } + """ + ]) end defp print_numbered_list(list) do @@ -239,17 +255,4 @@ defmodule Credo.CLI.Output do end) |> UI.warn() end - - defp print_disabled_check_config(list) do - list - |> Enum.flat_map(fn string -> - [ - :reset, - String.pad_leading(" ", 4), - :faint, - "{#{string}, false},\n" - ] - end) - |> UI.puts() - end end