diff --git a/lib/credo/check.ex b/lib/credo/check.ex index 3272ad6e1..ef534904b 100644 --- a/lib/credo/check.ex +++ b/lib/credo/check.ex @@ -687,14 +687,13 @@ defmodule Credo.Check do - `:column` Sets the issue's column. - `:exit_status` Sets the issue's exit_status. - `:severity` Sets the issue's severity. + - `:category` Sets the issue's category. """ def format_issue(issue_meta, opts, check) do source_file = IssueMeta.source_file(issue_meta) params = IssueMeta.params(issue_meta) - issue_category = Params.category(params, check) - issue_base_priority = Params.priority(params, check) - - priority = Priority.to_integer(issue_base_priority) + issue_category = opts[:category] || Params.category(params, check) + priority = params |> Params.priority(check) |> Priority.to_integer() exit_status_or_category = opts[:exit_status] || Params.exit_status(params, check) || issue_category diff --git a/test/credo/check_test.exs b/test/credo/check_test.exs index b92f4de10..b1ee92971 100644 --- a/test/credo/check_test.exs +++ b/test/credo/check_test.exs @@ -68,7 +68,8 @@ defmodule Credo.CheckTest do line_no: 3, column: 15, exit_status: 23, - severity: 11 + severity: 11, + category: :custom_category ) ] end @@ -91,6 +92,7 @@ defmodule Credo.CheckTest do assert issue.column == 15 assert issue.exit_status == 23 assert issue.severity == 11 + assert issue.category == :custom_category end) end