Skip to content

Commit 41a5468

Browse files
committed
style: fix Credo warnings for code quality
- Fix alias alphabetical ordering in subscription_test.exs - Replace length/1 with Enum.empty?/1 as recommended - Fix variable naming from camelCase to snake_case - Add credo:disable comment for necessary apply/3 usage
1 parent 4dcbf89 commit 41a5468

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

lib/phoenix/session_process/redux/live_view.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ defmodule Phoenix.SessionProcess.Redux.LiveView do
233233
Phoenix.LiveView.Socket.t()
234234
def handle_assign_update(socket, assign_key, value) do
235235
if Code.ensure_loaded?(Phoenix.Component) do
236+
# credo:disable-for-next-line Credo.Check.Refactor.Apply
236237
apply(Phoenix.Component, :assign, [socket, assign_key, value])
237238
else
238239
# Fallback if Phoenix.Component is not available

test/phoenix/session_process/redux/subscription_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ defmodule Phoenix.SessionProcess.Redux.SubscriptionTest do
22
use ExUnit.Case, async: true
33

44
alias Phoenix.SessionProcess.Redux
5-
alias Phoenix.SessionProcess.Redux.Subscription
65
alias Phoenix.SessionProcess.Redux.Selector
6+
alias Phoenix.SessionProcess.Redux.Subscription
77

88
setup do
99
redux =
@@ -302,7 +302,7 @@ defmodule Phoenix.SessionProcess.Redux.SubscriptionTest do
302302

303303
# Unsubscribe
304304
redux = Subscription.unsubscribe_from_struct(redux, sub_id)
305-
assert length(redux.subscriptions) == 0
305+
assert Enum.empty?(redux.subscriptions)
306306

307307
# Update state - should NOT notify
308308
redux = %{redux | current_state: %{redux.current_state | count: 2}}

test/phoenix/session_process/redux_integration_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ defmodule Phoenix.SessionProcess.ReduxIntegrationTest do
190190
category_filtered,
191191
fn state -> state.showOnlyInStock end
192192
],
193-
fn filtered, onlyInStock ->
194-
if onlyInStock do
193+
fn filtered, only_in_stock ->
194+
if only_in_stock do
195195
Enum.filter(filtered, & &1.inStock)
196196
else
197197
filtered

0 commit comments

Comments
 (0)