Skip to content

Commit 3b4313c

Browse files
committed
Fix test failures and compiler warnings
- Remove unused alias SanitizeFilter from checkend.ex - Remove unused alias Configuration from notice_builder.ex - Convert atom keys to strings in SanitizeFilter for consistent JSON output - Fix deep nesting test expectation (Enum.reduce produces outermost level=14) - Update atom test to use string key access
1 parent 23eaea5 commit 3b4313c

4 files changed

Lines changed: 10 additions & 7 deletions

File tree

lib/checkend.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ defmodule Checkend do
2828
@version "0.1.0"
2929

3030
alias Checkend.{Configuration, Notice, NoticeBuilder, Client, Worker, Testing}
31-
alias Checkend.Filters.{SanitizeFilter, IgnoreFilter}
31+
alias Checkend.Filters.IgnoreFilter
3232

3333
@doc """
3434
Returns the SDK version.

lib/checkend/filters/sanitize.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ defmodule Checkend.Filters.SanitizeFilter do
4848

4949
data
5050
|> Enum.map(fn {key, value} ->
51+
# Convert atom keys to strings for consistent JSON output
5152
key_str = to_string(key)
5253

5354
if should_filter?(filter, key_str) do
54-
{key, @filtered_value}
55+
{key_str, @filtered_value}
5556
else
56-
{key, filter_value(filter, value, depth + 1, new_seen)}
57+
{key_str, filter_value(filter, value, depth + 1, new_seen)}
5758
end
5859
end)
5960
|> Enum.into(%{})

lib/checkend/notice_builder.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ defmodule Checkend.NoticeBuilder do
33
Builds Notice structs from exceptions.
44
"""
55

6-
alias Checkend.{Configuration, Notice}
6+
alias Checkend.Notice
77
alias Checkend.Filters.SanitizeFilter
88

99
@max_backtrace_lines 100

test/sanitize_filter_test.exs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,14 +114,15 @@ defmodule Checkend.Filters.SanitizeFilterTest do
114114

115115
test "handles deep nesting", %{filter: filter} do
116116
# Create deeply nested structure
117+
# Enum.reduce wraps from inside out, so final outermost level is 14
117118
data =
118119
Enum.reduce(0..14, %{"level" => 15}, fn i, acc ->
119120
%{"level" => i, "nested" => acc}
120121
end)
121122

122123
# Should not raise, should handle max depth
123124
result = SanitizeFilter.filter(filter, data)
124-
assert result["level"] == 0
125+
assert result["level"] == 14
125126
end
126127

127128
test "handles empty map", %{filter: filter} do
@@ -133,8 +134,9 @@ defmodule Checkend.Filters.SanitizeFilterTest do
133134
data = %{status: :active, password: :secret}
134135
result = SanitizeFilter.filter(filter, data)
135136

136-
assert result[:status] == "active"
137-
assert result[:password] == "[FILTERED]"
137+
# Atom keys are converted to strings, atom values are converted to strings
138+
assert result["status"] == "active"
139+
assert result["password"] == "[FILTERED]"
138140
end
139141
end
140142
end

0 commit comments

Comments
 (0)