Skip to content

Commit

Permalink
Clarify :trigger for issues
Browse files Browse the repository at this point in the history
  • Loading branch information
rrrene committed Dec 14, 2023
1 parent 14aaf35 commit 0f4393f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/credo/check.ex
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ defmodule Credo.Check do
options to `format_issue/2`:
- `:priority` Sets the issue's priority.
- `:trigger` Sets the issue's trigger.
- `:trigger` Sets the issue's trigger, i.e. the text causing the issue (see `Credo.Check.Warning.IoInspect`).
- `:line_no` Sets the issue's line number. Tries to find `column` if `:trigger` is supplied.
- `:column` Sets the issue's column.
- `:exit_status` Sets the issue's exit_status.
Expand Down
4 changes: 3 additions & 1 deletion lib/credo/check/refactor/negated_is_nil.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ defmodule Credo.Check.Refactor.NegatedIsNil do

defp traverse({:when, meta, [_, {negation, _, [{:is_nil, _, _}]}]} = ast, issues, issue_meta)
when negation in [:!, :not] do
trigger = to_string(negation)

issue =
format_issue(
issue_meta,
message: "Negated is_nil in guard clause found",
trigger: "when !/not is_nil",
trigger: trigger,
line_no: meta[:line]
)

Expand Down

0 comments on commit 0f4393f

Please sign in to comment.