Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

Commit

Permalink
Fix non-code affecting Dialyzer warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
fhunleth committed Sep 27, 2019
1 parent 5216e5d commit 84e194a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
15 changes: 9 additions & 6 deletions lib/webengine_kiosk.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -236,30 +236,33 @@ 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))
{:noreply, state}
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

Expand Down
2 changes: 1 addition & 1 deletion lib/webengine_kiosk/input_event.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 8 additions & 8 deletions lib/webengine_kiosk/message.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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>>
Expand Down

0 comments on commit 84e194a

Please sign in to comment.