From 84e194ad46e623c822153cd8463ade088de799fc Mon Sep 17 00:00:00 2001 From: Frank Hunleth Date: Fri, 27 Sep 2019 15:05:56 -0400 Subject: [PATCH] Fix non-code affecting Dialyzer warnings --- lib/webengine_kiosk.ex | 15 +++++++++------ lib/webengine_kiosk/input_event.ex | 2 +- lib/webengine_kiosk/message.ex | 16 ++++++++-------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/lib/webengine_kiosk.ex b/lib/webengine_kiosk.ex index 58e259c..bf3fa82 100644 --- a/lib/webengine_kiosk.ex +++ b/lib/webengine_kiosk.ex @@ -158,7 +158,7 @@ defmodule WebengineKiosk do cmd = Path.join(priv_dir, "kiosk") if !File.exists?(cmd) do - Logger.error("Kiosk port application is missing. It should be at #{cmd}.") + _ = Logger.error("Kiosk port application is missing. It should be at #{cmd}.") raise "Kiosk port missing" end @@ -236,17 +236,20 @@ defmodule WebengineKiosk do end def handle_info({port, {:exit_status, 0}}, %{port: port} = state) do - Logger.info("webengine_kiosk: normal exit from port") + _ = Logger.info("webengine_kiosk: normal exit from port") {:stop, :normal, state} end def handle_info({port, {:exit_status, status}}, %{port: port} = state) do - Logger.error("webengine_kiosk: unexpected exit from port: #{status}") + _ = Logger.error("webengine_kiosk: unexpected exit from port: #{status}") {:stop, :unexpected_exit, state} end defp handle_browser_message({:browser_crashed, reason, _exit_status}, state) do - Logger.error("webengine_kiosk: browser crashed: #{inspect(reason)}. Going home and hoping...") + _ = + Logger.error( + "webengine_kiosk: browser crashed: #{inspect(reason)}. Going home and hoping..." + ) # Try to recover by going back home send_port(state, Message.go_to_url(state.homepage)) @@ -254,12 +257,12 @@ defmodule WebengineKiosk do end defp handle_browser_message({:console_log, log}, state) do - Logger.warn("webengine_kiosk(stderr): #{log}") + _ = Logger.warn("webengine_kiosk(stderr): #{log}") {:noreply, state} end defp handle_browser_message(message, state) do - Logger.debug("webengine_kiosk: received #{inspect(message)}") + _ = Logger.debug("webengine_kiosk: received #{inspect(message)}") {:noreply, state} end diff --git a/lib/webengine_kiosk/input_event.ex b/lib/webengine_kiosk/input_event.ex index 6a4b960..bbc862c 100644 --- a/lib/webengine_kiosk/input_event.ex +++ b/lib/webengine_kiosk/input_event.ex @@ -58,7 +58,7 @@ if Code.ensure_loaded?(SystemRegistry) do defp chgrp(devname, gid) do path = Path.join(@dev, devname) - Logger.info("webengine_kiosk: chgrp #{path}") + _ = Logger.info("webengine_kiosk: chgrp #{path}") File.chgrp(path, gid) end diff --git a/lib/webengine_kiosk/message.ex b/lib/webengine_kiosk/message.ex index 1310114..e4729cb 100644 --- a/lib/webengine_kiosk/message.ex +++ b/lib/webengine_kiosk/message.ex @@ -18,29 +18,29 @@ defmodule WebengineKiosk.Message do @moduledoc false - @spec go_to_url(String.t()) :: binary() + @spec go_to_url(String.t()) :: <<_::8, _::_*8>> def go_to_url(url), do: <<@msg_go_to_url, url::binary>> - @spec run_javascript(String.t()) :: binary() + @spec run_javascript(String.t()) :: <<_::8, _::_*8>> def run_javascript(code), do: <<@msg_run_javascript, code::binary>> - @spec blank(boolean()) :: binary() + @spec blank(boolean()) :: <<_::16>> def blank(true), do: <<@msg_blank, 1>> def blank(false), do: <<@msg_blank, 0>> - @spec reload() :: binary() + @spec reload() :: <<_::8>> def reload(), do: <<@msg_reload>> - @spec go_back() :: binary() + @spec go_back() :: <<_::8>> def go_back(), do: <<@msg_go_back>> - @spec go_forward() :: binary() + @spec go_forward() :: <<_::8>> def go_forward(), do: <<@msg_go_forward>> - @spec stop_loading() :: binary() + @spec stop_loading() :: <<_::8>> def stop_loading(), do: <<@msg_stop_loading>> - @spec set_zoom(number()) :: binary() + @spec set_zoom(number()) :: <<_::8, _::_*8>> def set_zoom(factor) when is_number(factor) do str = to_string(factor) <<@msg_set_zoom, str::binary>>