Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kazoo 3689: fix some noisy dialyzer warnings #1050

Merged
merged 17 commits into from May 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions applications/acdc/src/acdc_agent_listener.erl
Expand Up @@ -411,9 +411,8 @@ handle_cast({'refresh_config', Qs}, #state{agent_queues=Queues}=State) ->
{Add, Rm} = acdc_agent_util:changed(Queues, Qs),

Self = self(),
[gen_listener:cast(Self, {'queue_login', A}) || A <- Add],
[gen_listener:cast(Self, {'queue_logout', R}) || R <- Rm],

_ = [gen_listener:cast(Self, {'queue_login', A}) || A <- Add],
_ = [gen_listener:cast(Self, {'queue_logout', R}) || R <- Rm],
{'noreply', State};
handle_cast({'stop_agent', Req}, #state{supervisor=Supervisor}=State) ->
lager:debug("stop agent requested by ~p", [Req]),
Expand Down Expand Up @@ -557,7 +556,7 @@ handle_cast({'member_connect_retry', CallId}, #state{my_id=MyId
lager:debug("need to retry member connect, agent isn't able to take it"),
send_member_connect_retry(Server, CallId, MyId, AgentId),

[acdc_util:unbind_from_call_events(ACallId) || ACallId <- ACallIds],
_ = [acdc_util:unbind_from_call_events(ACallId) || ACallId <- ACallIds],
acdc_util:unbind_from_call_events(CallId),

put('callid', AgentId),
Expand Down
4 changes: 2 additions & 2 deletions applications/acdc/src/acdc_agent_maintenance.erl
Expand Up @@ -26,7 +26,7 @@ acct_status(AcctId) ->
[] -> lager:info("no agents with account id ~s available", [AcctId]);
As ->
lager:info("Agent Statuses in ~s", [AcctId]),
[acdc_agent_sup:status(Sup) || Sup <- As],
_ = [acdc_agent_sup:status(Sup) || Sup <- As],
'ok'
end.

Expand All @@ -45,7 +45,7 @@ acct_restart(AcctId) ->
[] -> lager:info("no agents with account id ~s available", [AcctId]);
As ->
lager:debug("Terminating existing agent processes in ~s", [AcctId]),
[exit(Sup, 'kill') || Sup <- As],
_ = [exit(Sup, 'kill') || Sup <- As],
lager:info("Restarting agents in ~s", [AcctId]),
acdc_init:init_acct_agents(AcctId),
'ok'
Expand Down
6 changes: 3 additions & 3 deletions applications/acdc/src/acdc_agent_stats.erl
Expand Up @@ -381,9 +381,9 @@ maybe_archive_status_data(Srv, Match) ->
Stats ->
couch_mgr:suppress_change_notice(),
ToSave = lists:foldl(fun archive_status_fold/2, dict:new(), Stats),
[couch_mgr:save_docs(acdc_stats_util:db_name(Acct), Docs)
|| {Acct, Docs} <- dict:to_list(ToSave)
],
_ = [couch_mgr:save_docs(acdc_stats_util:db_name(Acct), Docs)
|| {Acct, Docs} <- dict:to_list(ToSave)
],
[gen_listener:cast(Srv, {'update_status', Id, [{#status_stat.is_archived, 'true'}]})
|| #status_stat{id=Id} <- Stats
]
Expand Down
68 changes: 32 additions & 36 deletions applications/acdc/src/acdc_maintenance.erl
Expand Up @@ -38,7 +38,7 @@ logout_agents(AccountId) ->
io:format("Sending notices to logout agents for ~s~n", [AccountId]),
AccountDb = wh_util:format_account_id(AccountId, 'encoded'),
{'ok', AgentView} = couch_mgr:get_all_results(AccountDb, <<"agents/crossbar_listing">>),
[logout_agent(AccountId, wh_json:get_value(<<"id">>, Agent)) || Agent <- AgentView],
_ = [logout_agent(AccountId, wh_json:get_value(<<"id">>, Agent)) || Agent <- AgentView],
'ok'.

-spec logout_agent(ne_binary(), ne_binary()) -> 'ok'.
Expand Down Expand Up @@ -87,7 +87,7 @@ current_queues(AccountId) ->

log_current_queues(Agents) ->
io:format(" ~35s | ~s~n", [<<"Agent ID">>, <<"Queue IDs">>]),
[log_current_queue(Agent) || Agent <- Agents],
_ = [log_current_queue(Agent) || Agent <- Agents],
'ok'.
log_current_queue(AgentSup) ->
AgentL = acdc_agent_sup:listener(AgentSup),
Expand All @@ -104,7 +104,7 @@ current_agents(AccountId) ->
end.
log_current_agents(Queues) ->
io:format(" ~35s | ~s~n", [<<"Queue ID">>, <<"Agent IDs">>]),
[log_current_agent(Queue) || Queue <- Queues],
_ = [log_current_agent(Queue) || Queue <- Queues],
'ok'.
log_current_agent(QueueSup) ->
QueueM = acdc_queue_sup:manager(QueueSup),
Expand Down Expand Up @@ -132,7 +132,7 @@ current_calls(AccountId, Props) ->
get_and_show(AccountId, <<"custom">>, Req).

get_and_show(AccountId, QueueId, Req) ->
put('callid', <<"acdc_maint.", AccountId/binary, ".", QueueId/binary>>),
wh_util:put_callid(<<"acdc_maint.", AccountId/binary, ".", QueueId/binary>>),
case whapps_util:amqp_pool_collect(Req
,fun wapi_acdc_stats:publish_current_calls_req/1
,'acdc'
Expand All @@ -152,7 +152,7 @@ get_and_show(AccountId, QueueId, Req) ->

show_call_stats([], _) -> 'ok';
show_call_stats([Resp|Resps], Ks) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
show_call_stat_cat(Ks, Resp),
show_call_stats(Resps, Ks).

Expand Down Expand Up @@ -180,7 +180,7 @@ refresh() ->
{'ok', []} ->
lager:debug("no accounts configured for acdc");
{'ok', Accounts} ->
[refresh_account(wh_json:get_value(<<"key">>, Acct)) || Acct <- Accounts],
_ = [refresh_account(wh_json:get_value(<<"key">>, Acct)) || Acct <- Accounts],
lager:debug("refreshed accounts");
{'error', 'not_found'} ->
lager:debug("acdc db not found"),
Expand All @@ -207,11 +207,9 @@ migrate() ->
migrate_to_acdc_db().
migrate_to_acdc_db() ->
{'ok', Accounts} = couch_mgr:all_docs(?KZ_ACDC_DB),
[maybe_remove_acdc_account(wh_json:get_value(<<"id">>, Account)) || Account <- Accounts],
_ = [maybe_remove_acdc_account(wh_json:get_value(<<"id">>, Account)) || Account <- Accounts],
io:format("removed any missing accounts from ~s~n", [?KZ_ACDC_DB]),

[migrate_to_acdc_db(Acct) || Acct <- whapps_util:get_all_accounts('raw')],

_ = [migrate_to_acdc_db(Acct) || Acct <- whapps_util:get_all_accounts('raw')],
io:format("migration complete~n").

-spec maybe_remove_acdc_account(ne_binary()) -> 'ok'.
Expand Down Expand Up @@ -296,18 +294,18 @@ flush_call_stat(CallId) ->
-spec queues_summary(ne_binary()) -> 'ok'.
-spec queue_summary(ne_binary(), ne_binary()) -> 'ok'.
queues_summary() ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
show_queues_summary(acdc_queues_sup:queues_running()).

queues_summary(AcctId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
show_queues_summary(
[Q || {_, {QAcctId, _}} = Q <- acdc_queues_sup:queues_running(),
QAcctId =:= AcctId
]).

queue_summary(AcctId, QueueId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
show_queues_summary(
[Q || {_, {QAcctId, QQueueId}} = Q <- acdc_queues_sup:queues_running(),
QAcctId =:= AcctId,
Expand All @@ -321,31 +319,29 @@ show_queues_summary([{P, {AcctId, QueueId}}|Qs]) ->
show_queues_summary(Qs).

queues_detail() ->
put('callid', ?MODULE),
acdc_queues_sup:status().
queues_detail(AcctId) ->
put('callid', ?MODULE),
[acdc_queue_sup:status(S)
|| S <- acdc_queues_sup:find_acct_supervisors(AcctId)
],
wh_util:put_callid(?MODULE),
_ = [acdc_queue_sup:status(S)
|| S <- acdc_queues_sup:find_acct_supervisors(AcctId)
],
'ok'.
queue_detail(AcctId, QueueId) ->
put('callid', ?MODULE),
case acdc_queues_sup:find_queue_supervisor(AcctId, QueueId) of
'undefined' -> lager:info("no queue ~s in account ~s", [QueueId, AcctId]);
Pid -> acdc_queue_sup:status(Pid)
end.

queues_restart(AcctId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
case acdc_queues_sup:find_acct_supervisors(AcctId) of
[] ->
lager:info("there are no running queues in ~s", [AcctId]);
Pids ->
[maybe_stop_then_start_queue(AcctId, Pid) || Pid <- Pids]
end.
queue_restart(AcctId, QueueId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
case acdc_queues_sup:find_queue_supervisor(AcctId, QueueId) of
'undefined' ->
lager:info("queue ~s in account ~s not running", [QueueId, AcctId]);
Expand Down Expand Up @@ -385,18 +381,18 @@ maybe_start_queue(AcctId, QueueId) ->
end.

agents_summary() ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
show_agents_summary(acdc_agents_sup:agents_running()).

agents_summary(AcctId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
show_agents_summary(
[A || {_, {AAcctId, _, _}} = A <- acdc_agents_sup:agents_running(),
AAcctId =:= AcctId
]).

agent_summary(AcctId, AgentId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
show_agents_summary(
[Q || {_, {AAcctId, AAgentId, _}} = Q <- acdc_agents_sup:agents_running(),
AAcctId =:= AcctId,
Expand All @@ -410,23 +406,23 @@ show_agents_summary([{P, {AcctId, QueueId, _AMQPQueue}}|Qs]) ->
show_queues_summary(Qs).

agents_detail() ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
acdc_agents_sup:status().
agents_detail(AcctId) ->
put('callid', ?MODULE),
[acdc_agent_sup:status(S)
|| S <- acdc_agents_sup:find_acct_supervisors(AcctId)
],
wh_util:put_callid(?MODULE),
_ = [acdc_agent_sup:status(S)
|| S <- acdc_agents_sup:find_acct_supervisors(AcctId)
],
'ok'.
agent_detail(AcctId, AgentId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
case acdc_agents_sup:find_agent_supervisor(AcctId, AgentId) of
'undefined' -> lager:info("no agent ~s in account ~s", [AgentId, AcctId]);
Pid -> acdc_agent_sup:status(Pid)
end.

agent_login(AcctId, AgentId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
Update = props:filter_undefined(
[{<<"Account-ID">>, AcctId}
,{<<"Agent-ID">>, AgentId}
Expand All @@ -436,7 +432,7 @@ agent_login(AcctId, AgentId) ->
lager:info("published login update for agent").

agent_logout(AcctId, AgentId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
Update = props:filter_undefined(
[{<<"Account-ID">>, AcctId}
,{<<"Agent-ID">>, AgentId}
Expand All @@ -450,7 +446,7 @@ agent_pause(AcctId, AgentId) ->
,whapps_config:get(<<"acdc">>, <<"default_agent_pause_timeout">>, 600)
).
agent_pause(AcctId, AgentId, Timeout) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
Update = props:filter_undefined(
[{<<"Account-ID">>, AcctId}
,{<<"Agent-ID">>, AgentId}
Expand All @@ -461,7 +457,7 @@ agent_pause(AcctId, AgentId, Timeout) ->
lager:info("published pause for agent").

agent_resume(AcctId, AgentId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
Update = props:filter_undefined(
[{<<"Account-ID">>, AcctId}
,{<<"Agent-ID">>, AgentId}
Expand All @@ -472,7 +468,7 @@ agent_resume(AcctId, AgentId) ->


agent_queue_login(AcctId, AgentId, QueueId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
Update = props:filter_undefined(
[{<<"Account-ID">>, AcctId}
,{<<"Agent-ID">>, AgentId}
Expand All @@ -483,7 +479,7 @@ agent_queue_login(AcctId, AgentId, QueueId) ->
lager:info("published login update for agent").

agent_queue_logout(AcctId, AgentId, QueueId) ->
put('callid', ?MODULE),
wh_util:put_callid(?MODULE),
Update = props:filter_undefined(
[{<<"Account-ID">>, AcctId}
,{<<"Agent-ID">>, AgentId}
Expand Down
6 changes: 3 additions & 3 deletions applications/acdc/src/acdc_queue_handler.erl
Expand Up @@ -92,9 +92,9 @@ handle_queue_change(AccountDb, AccountId, QueueId, <<"doc_edited">>) ->
QueueSup when is_pid(QueueSup) ->
{'ok', JObj} = couch_mgr:open_doc(AccountDb, QueueId),
WorkersSup = acdc_queue_sup:workers_sup(QueueSup),
[acdc_queue_fsm:refresh(acdc_queue_worker_sup:fsm(WorkerSup), JObj)
|| WorkerSup <- acdc_queue_workers_sup:workers(WorkersSup)
],
_ = [acdc_queue_fsm:refresh(acdc_queue_worker_sup:fsm(WorkerSup), JObj)
|| WorkerSup <- acdc_queue_workers_sup:workers(WorkersSup)
],
Mgr = acdc_queue_sup:manager(QueueSup),
acdc_queue_manager:refresh(Mgr, JObj)
end;
Expand Down
6 changes: 3 additions & 3 deletions applications/acdc/src/acdc_stats.erl
Expand Up @@ -624,9 +624,9 @@ maybe_archive_call_data(Srv, Match) ->
Stats ->
couch_mgr:suppress_change_notice(),
ToSave = lists:foldl(fun archive_call_fold/2, dict:new(), Stats),
[couch_mgr:save_docs(acdc_stats_util:db_name(Account), Docs)
|| {Account, Docs} <- dict:to_list(ToSave)
],
_ = [couch_mgr:save_docs(acdc_stats_util:db_name(Account), Docs)
|| {Account, Docs} <- dict:to_list(ToSave)
],
[gen_listener:cast(Srv, {'update_call', Id, [{#call_stat.is_archived, 'true'}]})
|| #call_stat{id=Id} <- Stats
]
Expand Down
2 changes: 1 addition & 1 deletion applications/blackhole/src/blackhole_bindings.erl
Expand Up @@ -151,7 +151,7 @@ unbind(Bindings, Module, Fun) ->

-spec unbind(ne_binary() | ne_binaries(), atom(), atom(), term()) -> 'ok'.
unbind([_|_]=Bindings, Module, Fun, Payload) ->
[unbind(Binding, Module, Fun, Payload) || Binding <- Bindings],
_ = [unbind(Binding, Module, Fun, Payload) || Binding <- Bindings],
'ok';
unbind(Binding, Module, Fun, Payload) when is_binary(Binding) ->
kazoo_bindings:unbind(Binding, Module, Fun, Payload).
Expand Down
4 changes: 2 additions & 2 deletions applications/blackhole/src/blackhole_listener.erl
Expand Up @@ -147,8 +147,8 @@ handle_cast(_Msg, State) ->
%% {stop, Reason, State}
%% @end
%%--------------------------------------------------------------------
-spec handle_info(?HOOK_EVT(ne_binary(), ne_binary(), wh_json:object()), state()) -> {'noreply', state()};
(_, state()) -> {'noreply', state()}.
-spec handle_info(?HOOK_EVT(ne_binary(), ne_binary(), wh_json:object()) | _, state()) ->
{'noreply', state()}.
handle_info(?HOOK_EVT(_AccountId, EventType, JObj), State) ->
spawn(?MODULE, 'handle_amqp_event', [JObj, [], call_routing(EventType, JObj)]),
{'noreply', State};
Expand Down
2 changes: 1 addition & 1 deletion applications/callflow/src/cf_util.erl
Expand Up @@ -757,7 +757,7 @@ encryption_method_map(JObj, Endpoint) ->
-spec maybe_start_metaflows(whapps_call:call(), wh_json:objects()) -> 'ok'.
-spec maybe_start_metaflow(whapps_call:call(), wh_json:object()) -> 'ok'.
maybe_start_metaflows(Call, Endpoints) ->
[maybe_start_metaflow(Call, Endpoint) || Endpoint <- Endpoints],
_ = [maybe_start_metaflow(Call, Endpoint) || Endpoint <- Endpoints],
'ok'.

maybe_start_metaflow(Call, Endpoint) ->
Expand Down
2 changes: 1 addition & 1 deletion applications/callflow/src/module/cf_park.erl
Expand Up @@ -503,7 +503,7 @@ fetch_parked_calls(AccountDb, AccountId) ->
%%--------------------------------------------------------------------
-spec cleanup_slot(ne_binary(), ne_binary(), ne_binary()) ->
{'ok', wh_json:object()} |
{'error', term()}.
{'error', _}.
cleanup_slot(SlotNumber, ParkedCallId, AccountDb) ->
case couch_mgr:open_doc(AccountDb, ?DB_DOC_NAME) of
{'ok', JObj} ->
Expand Down
2 changes: 1 addition & 1 deletion applications/callflow/src/module/cf_voicemail.erl
Expand Up @@ -1930,7 +1930,7 @@ set_folder(Folder, Message, Box, Call) ->
%%--------------------------------------------------------------------
-spec update_folder(ne_binary(), ne_binary(), mailbox(), whapps_call:call()) ->
{'ok', wh_json:object()} |
{'error', term()}.
{'error', _}.
update_folder(_, 'undefined', _, _) ->
{'error', 'attachment_undefined'};
update_folder(Folder, MediaId, #mailbox{mailbox_id=Id}=Mailbox, Call) ->
Expand Down
10 changes: 4 additions & 6 deletions applications/cdr/src/cdr_maintenance.erl
Expand Up @@ -49,31 +49,29 @@ start_v3_migrator() ->
get_v3_migrator_status() ->
cdr_sup:get_v3_migrate_status().

-spec create_test_migrate_accounts() -> 'ok' | wh_std_return().
-spec create_test_migrate_accounts() -> 'ok'.
create_test_migrate_accounts() ->
create_test_migrate_accounts(?DFLT_NUM_TEST_ACCOUNTS
,?DFLT_NUM_MONTHS_LGCY_DATA
,?DFLT_NUM_CDR_PER_DAY
).

-spec create_test_migrate_accounts(input_term()) -> 'ok' | wh_std_return().
-spec create_test_migrate_accounts(input_term()) -> 'ok'.
create_test_migrate_accounts(NumTestAccounts) ->
create_test_migrate_accounts(NumTestAccounts
,?DFLT_NUM_MONTHS_LGCY_DATA
,?DFLT_NUM_CDR_PER_DAY
).

-spec create_test_migrate_accounts(input_term(), input_term()) ->
'ok' | wh_std_return().
-spec create_test_migrate_accounts(input_term(), input_term()) -> 'ok'.
create_test_migrate_accounts(NumTestAccounts
,NumMonthsLgcyData) ->
create_test_migrate_accounts(NumTestAccounts
,NumMonthsLgcyData
,?DFLT_NUM_CDR_PER_DAY
).

-spec create_test_migrate_accounts(input_term(), input_term(), input_term()) ->
'ok' | wh_std_return().
-spec create_test_migrate_accounts(input_term(), input_term(), input_term()) -> 'ok'.
create_test_migrate_accounts(NumTestAccounts
,NumMonthsLgcyData
,NumCdrsPerDay) ->
Expand Down