fix: resolve all credo warnings and pre-existing dialyzer errors
- Move require Logger to module top level in SpatialPubSub - Replace weak is_list assertions with stronger checks - Remove redundant 'is a list' test in PromEx tests - Replace apply/3 with direct function call in packet_replay test - Fix unmatched_return in weather_cache.ex and callsign_view.ex
This commit is contained in:
parent
7bdf21fb53
commit
281aef095c
7 changed files with 18 additions and 20 deletions
|
|
@ -5,6 +5,8 @@ defmodule Aprsme.SpatialPubSub do
|
|||
"""
|
||||
use GenServer
|
||||
|
||||
require Logger
|
||||
|
||||
# Grid size in degrees for spatial indexing
|
||||
@grid_size 1.0
|
||||
# Maximum number of concurrent clients
|
||||
|
|
@ -252,7 +254,6 @@ defmodule Aprsme.SpatialPubSub do
|
|||
end
|
||||
|
||||
defp normalize_bounds(invalid) do
|
||||
require Logger
|
||||
Logger.warning("normalize_bounds called with invalid bounds map: #{inspect(invalid)}")
|
||||
%{north: 0.0, south: 0.0, east: 0.0, west: 0.0}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -14,15 +14,16 @@ defmodule Aprsme.WeatherCache do
|
|||
The table is typically created in application.ex alongside other ETS tables.
|
||||
"""
|
||||
def setup do
|
||||
if :ets.whereis(@cache_name) == :undefined do
|
||||
:ets.new(@cache_name, [
|
||||
:named_table,
|
||||
:public,
|
||||
:set,
|
||||
read_concurrency: true,
|
||||
write_concurrency: true
|
||||
])
|
||||
end
|
||||
_table =
|
||||
if :ets.whereis(@cache_name) == :undefined do
|
||||
:ets.new(@cache_name, [
|
||||
:named_table,
|
||||
:public,
|
||||
:set,
|
||||
read_concurrency: true,
|
||||
write_concurrency: true
|
||||
])
|
||||
end
|
||||
|
||||
:ok
|
||||
rescue
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@ defmodule AprsmeWeb.PacketsLive.CallsignView do
|
|||
end
|
||||
|
||||
defp subscribe_if_connected(socket, callsign) do
|
||||
if connected?(socket) do
|
||||
Phoenix.PubSub.subscribe(Aprsme.PubSub, "packets:#{callsign}")
|
||||
end
|
||||
_ =
|
||||
if connected?(socket) do
|
||||
Phoenix.PubSub.subscribe(Aprsme.PubSub, "packets:#{callsign}")
|
||||
end
|
||||
|
||||
socket
|
||||
end
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ defmodule Aprsme.DeviceIdentificationTest do
|
|||
describe "known_manufacturers/0" do
|
||||
test "returns list of known manufacturers" do
|
||||
manufacturers = DeviceIdentification.known_manufacturers()
|
||||
assert is_list(manufacturers)
|
||||
assert "Kenwood" in manufacturers
|
||||
assert "Yaesu" in manufacturers
|
||||
assert "Byonics" in manufacturers
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ defmodule Aprsme.PacketReplayTest do
|
|||
user_id = "test_user"
|
||||
|
||||
assert_raise FunctionClauseError, fn ->
|
||||
apply(PacketReplay, :update_filters, [user_id, %{callsign: "N0CALL"}])
|
||||
PacketReplay.update_filters(user_id, %{callsign: "N0CALL"})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -8,10 +8,6 @@ defmodule Aprsme.PromExTest do
|
|||
{:ok, plugins: Aprsme.PromEx.plugins()}
|
||||
end
|
||||
|
||||
test "is a list", %{plugins: plugins} do
|
||||
assert is_list(plugins)
|
||||
end
|
||||
|
||||
test "includes the built-in PromEx plugins", %{plugins: plugins} do
|
||||
modules = plugin_modules(plugins)
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ defmodule AprsmeWeb.TelemetryTest do
|
|||
describe "metrics/0" do
|
||||
test "returns a non-empty list of metric definitions" do
|
||||
metrics = Telemetry.metrics()
|
||||
assert is_list(metrics)
|
||||
refute Enum.empty?(metrics)
|
||||
end
|
||||
|
||||
test "includes Phoenix endpoint, router, and live_view metrics" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue