Skip to content

Commit 8410fd4

Browse files
committed
Remove some credo warnings
1 parent c1c6652 commit 8410fd4

File tree

8 files changed

+18
-17
lines changed

8 files changed

+18
-17
lines changed

.credo.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@
9898
{Credo.Check.Refactor.NegatedConditionsInUnless},
9999
{Credo.Check.Refactor.NegatedConditionsWithElse},
100100
{Credo.Check.Refactor.Nesting},
101-
{Credo.Check.Refactor.PipeChainStart},
101+
{Credo.Check.Refactor.PipeChainStart, false},
102102
{Credo.Check.Refactor.UnlessWithElse},
103-
{Credo.Check.Refactor.VariableRebinding},
103+
{Credo.Check.Refactor.VariableRebinding, false},
104104

105105
{Credo.Check.Warning.BoolOperationOnSameValues},
106106
{Credo.Check.Warning.IExPry},

lib/elixir_script/cli.ex

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ defmodule ElixirScript.CLI do
4545
4646
options:
4747
--js-module [<identifer>:<path>] A js module used in your code. ex: React:react
48-
Multiple can be defined
48+
Multiple can be defined
4949
-f --format [format] module format of output. options: es (default), common, umd
50-
-o --output [path] places output at the given path.
50+
-o --output [path] places output at the given path.
5151
Can be a directory or filename.
5252
-e --elixir read input as elixir code string
5353
--remove-unused Removes unused modules from output
@@ -121,8 +121,8 @@ defmodule ElixirScript.CLI do
121121

122122
defp build_js_modules(values) do
123123
values
124-
|> Enum.map(fn x ->
125-
[identifier, path] = String.split(x,":", trim: true)
124+
|> Enum.map(fn x ->
125+
[identifier, path] = String.split(x, ":", trim: true)
126126
{ format_identifier(identifier), format_path(path) }
127127
end)
128128
end
@@ -132,7 +132,7 @@ defmodule ElixirScript.CLI do
132132
|> String.split(".")
133133
|> Module.concat
134134
end
135-
135+
136136

137137
defp format_path(path) do
138138
path

lib/elixir_script/passes/java_script_ast.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ defmodule ElixirScript.Passes.JavaScriptAST do
88
State.set_module_data(compiler_data.state, compiler_data.data)
99
State.set_loaded_modules(compiler_data.state, Map.get(compiler_data, :loaded_modules, []))
1010

11-
data = compiler_data.state
11+
data = compiler_data.state
1212
|> State.get_module_data
13-
|> Enum.reject(fn {_,module_data} ->
13+
|> Enum.reject(fn {_, module_data} ->
1414
module_data.app == :elixir && opts.import_standard_libs == false
1515
end)
16-
|> Enum.map(fn({module_name, module_data}) ->
16+
|> Enum.map(fn({module_name, module_data}) ->
1717
module_data = compile(module_data, opts, compiler_data.state)
1818
{module_name, module_data}
1919
end)

lib/elixir_script/passes/java_script_code.ex

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
defmodule ElixirScript.Passes.JavaScriptCode do
22
@moduledoc false
3-
alias ESTree.Tools.{Builder, Generator}
3+
alias ESTree.Tools.Builder
4+
alias ESTree.Tools.Generator
45

56
def execute(compiler_data, _) do
67
parent = self

lib/elixir_script/translator/kernel/special_forms/bitstring.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ defmodule ElixirScript.Translator.Bitstring do
120120
end
121121

122122
def make_interpolated_string(elements, env) do
123-
translated_elements = Enum.map(elements, fn(x)->
123+
translated_elements = Enum.map(elements, fn(x) ->
124124
case x do
125125
elem when is_binary(elem) ->
126126
Translator.translate!(elem, env)

lib/elixir_script/translator/kernel/special_forms/fn.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ defmodule ElixirScript.Translator.Function do
3030

3131
({_, _, [{:when, _, [{_, _, params}, guards]}, body]}) ->
3232
body = convert_to_try(body)
33-
process_function_body(params, body, env, name, guards)
33+
process_function_body(params, body, env, name, guards)
3434

3535
({_, _, [{_, _, params}, body]}) ->
3636
body = convert_to_try(body)
@@ -212,7 +212,7 @@ defmodule ElixirScript.Translator.Function do
212212

213213
return_statement = case declaration do
214214
%ESTree.ArrayPattern{elements: elements} ->
215-
if(length(elements) == 1) do
215+
if length(elements) == 1 do
216216
JS.return_statement(hd(declaration.elements))
217217
else
218218
JS.return_statement(JS.array_expression(declaration.elements))
@@ -233,7 +233,7 @@ defmodule ElixirScript.Translator.Function do
233233
end
234234

235235

236-
list = Enum.take(list, length(list)-1)
236+
list = Enum.take(list, length(list) - 1)
237237
|> Enum.map(fn(x) ->
238238
case x do
239239
%ESTree.MemberExpression{} ->

lib/elixir_script/translator/kernel/special_forms/quote.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ defmodule ElixirScript.Translator.Quote do
1515
(_) -> false
1616
end)
1717

18-
if(has_unquote_splicing) do
18+
if has_unquote_splicing do
1919
expr = Enum.map(expr, fn
2020
({:unquote_splicing, _, [param]}) ->
2121
make_unquote_slicing(param, env)

lib/elixir_script/watcher.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ defmodule ElixirScript.Watcher do
2323

2424
try do
2525
if input_changed?(to_string(path), state) do
26-
Logger.debug "Event: #{inspect event} Path: #{path}"
26+
Logger.debug fn -> "Event: #{inspect event} Path: #{path}" end
2727
ElixirScript.compile_path(state[:input], state[:options])
2828
end
2929
rescue

0 commit comments

Comments
 (0)