Skip to content

Commit 85ab21b

Browse files
committed
Formatting: add white space after comma
Standardizes the use of comma leaving a white space after it whenever applicable. Note: It does not enforce this in quantifiers in regular expressions such as in: `x{1,3}`
1 parent de3f5df commit 85ab21b

File tree

18 files changed

+170
-170
lines changed

18 files changed

+170
-170
lines changed

lib/eex/test/eex_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ defmodule EExTest do
9999
end
100100

101101
test "evaluates with parentheses after end in end token" do
102-
assert_eval " 101 102 103 ", "<%= Enum.map([1,2,3], (fn x -> %> <%= 100 + x %> <% end) ) %>"
102+
assert_eval " 101 102 103 ", "<%= Enum.map([1, 2, 3], (fn x -> %> <%= 100 + x %> <% end) ) %>"
103103
end
104104

105105
test "evaluates with defined variable" do

lib/elixir/lib/code.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ defmodule Code do
311311
312312
## Examples
313313
314-
Code.load_file("eex_test.exs","../eex/test") |> List.first
314+
Code.load_file("eex_test.exs", "../eex/test") |> List.first
315315
#=> {EExTest.Compiled, <<70, 79, 82, 49, ...>>}
316316
317317
"""
@@ -343,11 +343,11 @@ defmodule Code do
343343
344344
If the code is already loaded, it returns `nil`:
345345
346-
Code.require_file("eex_test.exs","../eex/test") #=> nil
346+
Code.require_file("eex_test.exs", "../eex/test") #=> nil
347347
348348
If the code is not loaded yet, it returns the same as `load_file/2`:
349349
350-
Code.require_file("eex_test.exs","../eex/test") |> List.first
350+
Code.require_file("eex_test.exs", "../eex/test") |> List.first
351351
#=> {EExTest.Compiled, <<70, 79, 82, 49, ...>>}
352352
353353
"""

lib/elixir/lib/kernel/special_forms.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ defmodule Kernel.SpecialForms do
10741074
defmodule Hygiene do
10751075
defmacrop get_length do
10761076
quote do
1077-
length([1,2,3])
1077+
length([1, 2, 3])
10781078
end
10791079
end
10801080
@@ -1617,7 +1617,7 @@ defmodule Kernel.SpecialForms do
16171617
evaluates to a truthy value.
16181618
16191619
cond do
1620-
hd([1,2,3]) ->
1620+
hd([1, 2, 3]) ->
16211621
"1 is considered as true"
16221622
end
16231623
#=> "1 is considered as true"

lib/elixir/src/elixir_errors.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ parse_error(Line, File, <<"syntax error before: ">>, <<"{sigil,", _Rest/binary>>
6666
true -> Content;
6767
false -> <<>>
6868
end,
69-
Message = <<"syntax error before: sigil ~", Sigil," starting with content '", Content2/binary, "'">>,
69+
Message = <<"syntax error before: sigil ~", Sigil, " starting with content '", Content2/binary, "'">>,
7070
do_raise(Line, File, 'Elixir.SyntaxError', Message);
7171

7272
%% Aliases are wrapped in ['']

lib/elixir/src/elixir_interpolation.erl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,27 +111,27 @@ unescape_hex(<<A, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
111111
io:format(standard_error, "warning: \\xH inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
112112
append_codepoint(Rest, Map, [A], Acc, 16);
113113

114-
unescape_hex(<<${,A,$}, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
114+
unescape_hex(<<${, A, $}, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
115115
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
116116
append_codepoint(Rest, Map, [A], Acc, 16);
117117

118-
unescape_hex(<<${,A,B,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
118+
unescape_hex(<<${, A, B, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
119119
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
120120
append_codepoint(Rest, Map, [A, B], Acc, 16);
121121

122-
unescape_hex(<<${,A,B,C,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C) ->
122+
unescape_hex(<<${, A, B, C, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C) ->
123123
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
124124
append_codepoint(Rest, Map, [A, B, C], Acc, 16);
125125

126-
unescape_hex(<<${,A,B,C,D,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
126+
unescape_hex(<<${, A, B, C, D, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
127127
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
128128
append_codepoint(Rest, Map, [A, B, C, D], Acc, 16);
129129

130-
unescape_hex(<<${,A,B,C,D,E,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E) ->
130+
unescape_hex(<<${, A, B, C, D, E, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E) ->
131131
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
132132
append_codepoint(Rest, Map, [A, B, C, D, E], Acc, 16);
133133

134-
unescape_hex(<<${,A,B,C,D,E,F,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E), ?is_hex(F) ->
134+
unescape_hex(<<${, A, B, C, D, E, F, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E), ?is_hex(F) ->
135135
io:format(standard_error, "warning: \\x{H*} inside strings/sigils/chars is deprecated, please use \\xHH (byte) or \\uHHHH (codepoint) instead~n", []),
136136
append_codepoint(Rest, Map, [A, B, C, D, E, F], Acc, 16);
137137

@@ -141,25 +141,25 @@ unescape_hex(<<_/binary>>, _Map, _Acc) ->
141141

142142
%% Finish deprecated sequences
143143

144-
unescape_unicode(<<A,B,C,D, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
144+
unescape_unicode(<<A, B, C, D, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
145145
append_codepoint(Rest, Map, [A, B, C, D], Acc, 16);
146146

147-
unescape_unicode(<<${,A,$}, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
147+
unescape_unicode(<<${, A, $}, Rest/binary>>, Map, Acc) when ?is_hex(A) ->
148148
append_codepoint(Rest, Map, [A], Acc, 16);
149149

150-
unescape_unicode(<<${,A,B,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
150+
unescape_unicode(<<${, A, B, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B) ->
151151
append_codepoint(Rest, Map, [A, B], Acc, 16);
152152

153-
unescape_unicode(<<${,A,B,C,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C) ->
153+
unescape_unicode(<<${, A, B, C, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C) ->
154154
append_codepoint(Rest, Map, [A, B, C], Acc, 16);
155155

156-
unescape_unicode(<<${,A,B,C,D,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
156+
unescape_unicode(<<${, A, B, C, D, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D) ->
157157
append_codepoint(Rest, Map, [A, B, C, D], Acc, 16);
158158

159-
unescape_unicode(<<${,A,B,C,D,E,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E) ->
159+
unescape_unicode(<<${, A, B, C, D, E, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E) ->
160160
append_codepoint(Rest, Map, [A, B, C, D, E], Acc, 16);
161161

162-
unescape_unicode(<<${,A,B,C,D,E,F,$}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E), ?is_hex(F) ->
162+
unescape_unicode(<<${, A, B, C, D, E, F, $}, Rest/binary>>, Map, Acc) when ?is_hex(A), ?is_hex(B), ?is_hex(C), ?is_hex(D), ?is_hex(E), ?is_hex(F) ->
163163
append_codepoint(Rest, Map, [A, B, C, D, E, F], Acc, 16);
164164

165165
unescape_unicode(<<_/binary>>, _Map, _Acc) ->

lib/elixir/src/elixir_tokenizer.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ tokenize([T|Rest], Line, Column, Scope, Tokens) when ?pipe_op(T) ->
401401

402402
% Others
403403

404-
tokenize([$%,${|T], Line, Column, Scope, Tokens) ->
404+
tokenize([$%, ${|T], Line, Column, Scope, Tokens) ->
405405
tokenize([${|T], Line, Column + 1, Scope, [{'%{}', {Line, Column, Column + 1}}|Tokens]);
406406

407407
tokenize([$%|T], Line, Column, Scope, Tokens) ->

lib/elixir/src/elixir_utils.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ get_line(Opts) when is_list(Opts) ->
3030
get_ann(Opts) when is_list(Opts) ->
3131
get_ann(Opts, [], 0).
3232

33-
get_ann([{generated,Gen}|T], Acc, Line) -> get_ann(T, [{generated,Gen}|Acc], Line);
34-
get_ann([{line,Line}|T], Acc, _) -> get_ann(T, Acc, Line);
33+
get_ann([{generated, Gen}|T], Acc, Line) -> get_ann(T, [{generated, Gen}|Acc], Line);
34+
get_ann([{line, Line}|T], Acc, _) -> get_ann(T, Acc, Line);
3535
get_ann([_|T], Acc, Line) -> get_ann(T, Acc, Line);
3636
get_ann([], [], Line) -> Line;
37-
get_ann([], Acc, Line) -> [{location,Line}|Acc].
37+
get_ann([], Acc, Line) -> [{location, Line}|Acc].
3838

3939
split_last([]) -> {[], []};
4040
split_last(List) -> split_last(List, []).

lib/elixir/test/elixir/enum_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ defmodule EnumTest do
211211
assert Enum.into(%{a: 1, b: 2}, []) == [a: 1, b: 2]
212212
assert Enum.into([1, 2, 3], "numbers: ", &to_string/1) == "numbers: 123"
213213
assert Enum.into(1..3, []) == [1, 2, 3]
214-
assert Enum.into(["H","i"], "") == "Hi"
214+
assert Enum.into(["H", "i"], "") == "Hi"
215215
assert_raise FunctionClauseError, fn ->
216216
Enum.into([2, 3], %{}, &(&1))
217217
end

lib/elixir/test/elixir/file_test.exs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ defmodule FileTest do
2525
#
2626
# Renaming files
2727
# :ok -> rename file to existing file default behaviour
28-
# {:error,:eisdir} -> rename file to existing empty dir
29-
# {:error,:eisdir} -> rename file to existing non empty dir
28+
# {:error, :eisdir} -> rename file to existing empty dir
29+
# {:error, :eisdir} -> rename file to existing non empty dir
3030
# :ok -> rename file to non existing location
31-
# {:error,:eexist} -> rename file to existing file
31+
# {:error, :eexist} -> rename file to existing file
3232
# :ok -> rename file to itself
3333

3434
# Renaming dirs
35-
# {:error,:enotdir} -> rename dir to existing file
36-
# :ok -> rename dir to non existing leaf location
37-
# {:error,??} -> rename dir to non existing parent location
38-
# :ok -> rename dir to itself
39-
# :ok -> rename dir to existing empty dir default behaviour
40-
# {:error,:eexist} -> rename dir to existing empty dir
41-
# {:error, :einval} -> rename parent dir to existing sub dir
42-
# {:error, :einval} -> rename parent dir to non existing sub dir
43-
# {:error,:eexist} -> rename dir to existing non empty dir
35+
# {:error, :enotdir} -> rename dir to existing file
36+
# :ok -> rename dir to non existing leaf location
37+
# {:error, ??} -> rename dir to non existing parent location
38+
# :ok -> rename dir to itself
39+
# :ok -> rename dir to existing empty dir default behaviour
40+
# {:error, :eexist} -> rename dir to existing empty dir
41+
# {:error, :einval} -> rename parent dir to existing sub dir
42+
# {:error, :einval} -> rename parent dir to non existing sub dir
43+
# {:error, :eexist} -> rename dir to existing non empty dir
4444

4545
# other tests
4646
# {:error, :enoent} -> rename unknown source
@@ -70,7 +70,7 @@ defmodule FileTest do
7070

7171
try do
7272
File.mkdir(dest)
73-
assert File.rename(src, dest) == {:error,:eisdir}
73+
assert File.rename(src, dest) == {:error, :eisdir}
7474
assert File.exists?(src)
7575
refute File.exists?(tmp_path("tmp/file.txt"))
7676
after
@@ -84,8 +84,8 @@ defmodule FileTest do
8484
dest = tmp_path("tmp")
8585

8686
try do
87-
File.mkdir_p(Path.join(dest,"a"))
88-
assert File.rename(src, dest) == {:error,:eisdir}
87+
File.mkdir_p(Path.join(dest, "a"))
88+
assert File.rename(src, dest) == {:error, :eisdir}
8989
assert File.exists?(src)
9090
refute File.exists?(Path.join(dest, "file.txt"))
9191
after
@@ -293,7 +293,7 @@ defmodule FileTest do
293293
assert File.exists?(src)
294294
refute File.exists?(tmp_path("tmp/a"))
295295

296-
assert File.rename(src, dest) == {:error,:eexist}
296+
assert File.rename(src, dest) == {:error, :eexist}
297297

298298
assert File.exists?(tmp_path("tmp/x"))
299299
assert File.exists?(src)
@@ -333,7 +333,7 @@ defmodule FileTest do
333333
def tmp_fixture_path(extra) do
334334
src = fixture_path(extra)
335335
dest = tmp_path(extra)
336-
File.cp_r(src,dest)
336+
File.cp_r(src, dest)
337337
dest
338338
end
339339
end

lib/elixir/test/erlang/string_test.erl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,51 +28,51 @@ extract_interpolations_with_escaped_interpolation_test() ->
2828

2929
extract_interpolations_with_interpolation_test() ->
3030
[<<"f">>,
31-
{{1,2,7}, [{atom, {1,4,6}, o}]},
31+
{{1, 2, 7}, [{atom, {1, 4, 6}, o}]},
3232
<<"o">>] = extract_interpolations("f#{:o}o").
3333

3434
extract_interpolations_with_two_interpolations_test() ->
3535
[<<"f">>,
36-
{{1,2,7}, [{atom, {1,4,6}, o}]}, {{1,7,12}, [{atom, {1,9,11}, o}]},
36+
{{1, 2, 7}, [{atom, {1, 4, 6}, o}]}, {{1, 7, 12}, [{atom, {1, 9, 11}, o}]},
3737
<<"o">>] = extract_interpolations("f#{:o}#{:o}o").
3838

3939
extract_interpolations_with_only_two_interpolations_test() ->
40-
[{{1,1,6}, [{atom, {1,3,5}, o}]},
41-
{{1,6,11}, [{atom, {1,8,10}, o}]}] = extract_interpolations("#{:o}#{:o}").
40+
[{{1, 1, 6}, [{atom, {1, 3, 5}, o}]},
41+
{{1, 6, 11}, [{atom, {1, 8, 10}, o}]}] = extract_interpolations("#{:o}#{:o}").
4242

4343
extract_interpolations_with_tuple_inside_interpolation_test() ->
4444
[<<"f">>,
45-
{{1,2,8}, [{'{', {1,4,5}}, {number, {1,5,6}, 1}, {'}', {1,6,7}}]},
45+
{{1, 2, 8}, [{'{', {1, 4, 5}}, {number, {1, 5, 6}, 1}, {'}', {1, 6, 7}}]},
4646
<<"o">>] = extract_interpolations("f#{{1}}o").
4747

4848
extract_interpolations_with_many_expressions_inside_interpolation_test() ->
4949
[<<"f">>,
50-
{{1,2,3}, [{number, {1,4,5}, 1}, {eol, {1,5,6}}, {number, {2,1,2}, 2}]},
50+
{{1, 2, 3}, [{number, {1, 4, 5}, 1}, {eol, {1, 5, 6}}, {number, {2, 1, 2}, 2}]},
5151
<<"o">>] = extract_interpolations("f#{1\n2}o").
5252

5353
extract_interpolations_with_right_curly_inside_string_inside_interpolation_test() ->
5454
[<<"f">>,
55-
{{1,2,10}, [{bin_string, {1,4,9}, [<<"f}o">>]}]},
55+
{{1, 2, 10}, [{bin_string, {1, 4, 9}, [<<"f}o">>]}]},
5656
<<"o">>] = extract_interpolations("f#{\"f}o\"}o").
5757

5858
extract_interpolations_with_left_curly_inside_string_inside_interpolation_test() ->
5959
[<<"f">>,
60-
{{1,2,10}, [{bin_string, {1,4,9}, [<<"f{o">>]}]},
60+
{{1, 2, 10}, [{bin_string, {1, 4, 9}, [<<"f{o">>]}]},
6161
<<"o">>] = extract_interpolations("f#{\"f{o\"}o").
6262

6363
extract_interpolations_with_escaped_quote_inside_string_inside_interpolation_test() ->
6464
[<<"f">>,
65-
{{1,2,11}, [{bin_string, {1,4,10}, [<<"f\"o">>]}]},
65+
{{1, 2, 11}, [{bin_string, {1, 4, 10}, [<<"f\"o">>]}]},
6666
<<"o">>] = extract_interpolations("f#{\"f\\\"o\"}o").
6767

6868
extract_interpolations_with_less_than_operation_inside_interpolation_test() ->
6969
[<<"f">>,
70-
{{1,2,8}, [{number, {1,4,5}, 1}, {rel_op, {1,5,6}, '<'}, {number, {1,6,7}, 2}]},
70+
{{1, 2, 8}, [{number, {1, 4, 5}, 1}, {rel_op, {1, 5, 6}, '<'}, {number, {1, 6, 7}, 2}]},
7171
<<"o">>] = extract_interpolations("f#{1<2}o").
7272

7373
extract_interpolations_with_an_escaped_character_test() ->
7474
[<<"f">>,
75-
{{1,2,17}, [{char, {1,4,7}, 7}, {rel_op, {1,8,9}, '>'}, {char, {1,10,13}, 7}]}
75+
{{1, 2, 17}, [{char, {1, 4, 7}, 7}, {rel_op, {1, 8, 9}, '>'}, {char, {1, 10, 13}, 7}]}
7676
] = extract_interpolations("f#{?\\a > ?\\a }").
7777

7878
extract_interpolations_with_invalid_expression_inside_interpolation_test() ->

0 commit comments

Comments
 (0)