refactor: Replace length/1 with empty list comparison
Replace expensive length/1 calls with direct list comparison to fix Credo warnings about performance
This commit is contained in:
parent
32e0adb664
commit
0abcf540bb
2 changed files with 2 additions and 2 deletions
|
|
@ -403,7 +403,7 @@ defmodule MvWeb.MemberLive.Form do
|
||||||
# Checks if form has any errors
|
# Checks if form has any errors
|
||||||
defp has_form_errors?(form) do
|
defp has_form_errors?(form) do
|
||||||
case Map.get(form, :errors) do
|
case Map.get(form, :errors) do
|
||||||
errors when is_list(errors) and length(errors) > 0 -> true
|
errors when is_list(errors) and errors != [] -> true
|
||||||
_ -> false
|
_ -> false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,7 @@ defmodule Mv.Membership.Import.MemberCSVTest do
|
||||||
|
|
||||||
assert chunk_result.inserted == 0
|
assert chunk_result.inserted == 0
|
||||||
assert chunk_result.failed == 10
|
assert chunk_result.failed == 10
|
||||||
assert length(chunk_result.errors) == 0
|
assert chunk_result.errors == []
|
||||||
end
|
end
|
||||||
|
|
||||||
test "error capping with mixed success and failure" do
|
test "error capping with mixed success and failure" do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue