mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Remove most Elixir warnings
This commit is contained in:
parent
b8d4da9792
commit
749fa95011
@ -23,7 +23,7 @@ defmodule Ejabberd.Config do
|
|||||||
# Could be also possible to interrupt the compilation&execution by throwing
|
# Could be also possible to interrupt the compilation&execution by throwing
|
||||||
# an exception if necessary.
|
# an exception if necessary.
|
||||||
def __before_compile__(_env) do
|
def __before_compile__(_env) do
|
||||||
get_modules_parsed_in_order
|
get_modules_parsed_in_order()
|
||||||
|> EjabberdModule.validate
|
|> EjabberdModule.validate
|
||||||
|> EjabberdLogger.log_errors
|
|> EjabberdLogger.log_errors
|
||||||
end
|
end
|
||||||
@ -48,7 +48,7 @@ defmodule Ejabberd.Config do
|
|||||||
Returns a list with all the opts, formatted for ejabberd.
|
Returns a list with all the opts, formatted for ejabberd.
|
||||||
"""
|
"""
|
||||||
def get_ejabberd_opts do
|
def get_ejabberd_opts do
|
||||||
get_general_opts
|
get_general_opts()
|
||||||
|> Dict.put(:modules, get_modules_parsed_in_order())
|
|> Dict.put(:modules, get_modules_parsed_in_order())
|
||||||
|> Dict.put(:listeners, get_listeners_parsed_in_order())
|
|> Dict.put(:listeners, get_listeners_parsed_in_order())
|
||||||
|> Ejabberd.Config.OptsFormatter.format_opts_for_ejabberd
|
|> Ejabberd.Config.OptsFormatter.format_opts_for_ejabberd
|
||||||
|
@ -12,7 +12,6 @@ defmodule Ejabberd.Config.EjabberdModule do
|
|||||||
defstruct [:module, :attrs]
|
defstruct [:module, :attrs]
|
||||||
|
|
||||||
alias Ejabberd.Config.EjabberdModule
|
alias Ejabberd.Config.EjabberdModule
|
||||||
alias Ejabberd.Config.Attr
|
|
||||||
alias Ejabberd.Config.Validation
|
alias Ejabberd.Config.Validation
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
|
@ -21,7 +21,7 @@ defmodule Ejabberd.Config.EjabberdLogger do
|
|||||||
defp do_log_errors({:attribute, errors}), do: Enum.each errors, &log_attribute_error/1
|
defp do_log_errors({:attribute, errors}), do: Enum.each errors, &log_attribute_error/1
|
||||||
defp do_log_errors({:dependency, errors}), do: Enum.each errors, &log_dependency_error/1
|
defp do_log_errors({:dependency, errors}), do: Enum.each errors, &log_dependency_error/1
|
||||||
|
|
||||||
defp log_attribute_error({{attr_name, val}, :attr_not_supported}), do:
|
defp log_attribute_error({{attr_name, _val}, :attr_not_supported}), do:
|
||||||
IO.puts "[ WARN ] Annotation @#{attr_name} is not supported."
|
IO.puts "[ WARN ] Annotation @#{attr_name} is not supported."
|
||||||
|
|
||||||
defp log_attribute_error({{attr_name, val}, :type_not_supported}), do:
|
defp log_attribute_error({{attr_name, val}, :type_not_supported}), do:
|
||||||
|
@ -7,9 +7,7 @@ defmodule Ejabberd.Config.Validation do
|
|||||||
@type mod_validation_result :: {:ok, EjabberdModule.t} | {:error, EjabberdModule.t, map}
|
@type mod_validation_result :: {:ok, EjabberdModule.t} | {:error, EjabberdModule.t, map}
|
||||||
|
|
||||||
alias Ejabberd.Config.EjabberdModule
|
alias Ejabberd.Config.EjabberdModule
|
||||||
alias Ejabberd.Config.Attr
|
|
||||||
alias Ejabberd.Config.Validator
|
alias Ejabberd.Config.Validator
|
||||||
alias Ejabberd.Config.ValidatorUtility
|
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Given a module or a list of modules it runs validators on them
|
Given a module or a list of modules it runs validators on them
|
||||||
|
@ -18,7 +18,7 @@ defmodule Ejabberd.Config.Validator.Attrs do
|
|||||||
def validate({modules, mod, errors}) do
|
def validate({modules, mod, errors}) do
|
||||||
errors = Enum.reduce mod.attrs, errors, fn(attr, err) ->
|
errors = Enum.reduce mod.attrs, errors, fn(attr, err) ->
|
||||||
case Attr.validate(attr) do
|
case Attr.validate(attr) do
|
||||||
{:ok, attr} -> err
|
{:ok, _attr} -> err
|
||||||
{:error, attr, cause} -> put_error(err, :attribute, {attr, cause})
|
{:error, attr, cause} -> put_error(err, :attribute, {attr, cause})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,7 @@ defmodule Mix.Tasks.Ejabberd.Deps.Tree do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
defp build_dependency_tree(mods, mod, []), do: %{module: mod, dependency: []}
|
defp build_dependency_tree(_mods, mod, []), do: %{module: mod, dependency: []}
|
||||||
defp build_dependency_tree(mods, mod, deps) when is_list(deps) do
|
defp build_dependency_tree(mods, mod, deps) when is_list(deps) do
|
||||||
dependencies = Enum.map deps, fn dep ->
|
dependencies = Enum.map deps, fn dep ->
|
||||||
dep_deps = get_dependencies_of_mod(mods, dep)
|
dep_deps = get_dependencies_of_mod(mods, dep)
|
||||||
@ -65,7 +65,7 @@ defmodule Mix.Tasks.Ejabberd.Deps.Tree do
|
|||||||
|
|
||||||
defp keep_only_mods_not_used_as_dep(mods, mods_used_as_dep) do
|
defp keep_only_mods_not_used_as_dep(mods, mods_used_as_dep) do
|
||||||
Enum.filter mods, fn %{module: mod} ->
|
Enum.filter mods, fn %{module: mod} ->
|
||||||
not mod in mods_used_as_dep
|
mod not in mods_used_as_dep
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,4 +17,13 @@ defmodule ModPresenceDemo do
|
|||||||
info('Receive presence for #{user}')
|
info('Receive presence for #{user}')
|
||||||
:none
|
:none
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def depends(_host, _opts) do
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
|
def mod_options(_host) do
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user