Skip to content

Commit

Permalink
Merge pull request #84 from inaka/euen.441.update_line_length_to_100
Browse files Browse the repository at this point in the history
WIP: [Close inaka/elvis#411] unpdate line length to 100
  • Loading branch information
Brujo Benavides authored Apr 25, 2017
2 parents 3ee2d6a + f755375 commit 74ed2c3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ also you like to use tabs instead of spaces, so you need to override `erl_files`
...
#{dirs => ["src"],
filter => "*.erl",
rules => [{elvis_style, line_length, #{limit => 90}}, %% change default line_length limit from 80 to 90
rules => [{elvis_style, line_length, #{limit => 90}}, %% change default line_length limit from 100 to 90
{elvis_style, no_tabs, disable}], %% disable no_tabs rule
ruleset => erl_files
},
Expand Down
4 changes: 0 additions & 4 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{"1.1.0",
[{<<"aleppo">>,{pkg,<<"inaka_aleppo">>,<<"1.0.0">>},1},
{<<"goldrush">>,{pkg,<<"goldrush">>,<<"0.1.9">>},1},
{<<"katana_code">>,{pkg,<<"katana_code">>,<<"0.1.0">>},0},
{<<"lager">>,{pkg,<<"lager">>,<<"3.0.2">>},0},
{<<"zipper">>,{pkg,<<"zipper">>,<<"1.0.1">>},0}]}.
[
{pkg_hash,[
{<<"aleppo">>, <<"8DB14CF16BB8C263C14FF4C3F69F64D7C849D40888944F4204D2CA74F1114CEB">>},
{<<"goldrush">>, <<"F06E5D5F1277DA5C413E84D5A2924174182FB108DABB39D5EC548B27424CD106">>},
{<<"katana_code">>, <<"C34F3926A258D6BEACD8D21F140F3D47D175501936431C460B144339D5271A0B">>},
{<<"lager">>, <<"25DC81BC3659B62F5AB9BD073E97DDD894FC4C242019FCCEF96F3889D7366C97">>},
{<<"zipper">>, <<"3CCB4F14B97C06B2749B93D8B6C204A1ECB6FAFC6050CACC3B93B9870C05952A">>}]}
].
2 changes: 1 addition & 1 deletion src/elvis_rulesets.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

-spec rules(Group::atom()) -> list().
rules(erl_files) ->
[ {elvis_style, line_length, #{limit => 80, skip_comments => false}}
[ {elvis_style, line_length, #{limit => 100, skip_comments => false}}
, {elvis_style, no_tabs}
, {elvis_style, no_trailing_whitespace}
, {elvis_style, macro_names}
Expand Down
14 changes: 7 additions & 7 deletions test/examples/fail_line_length.erl
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@
function_7/0
]).

% Single line comment over 80 characters!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
% Single line comment over 100 characters!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
function_1() ->
io:format("Hello").

function_2() ->
io:format("This line is 81 characters long and should be detected, yeah!!!").
io:format("This line is 101 characters long and should be detected, yeah!!!!!!!!!!!!!!!!!!!!!!").

function_3() ->
io:format("This line is 80 characters long and shouldn't be detected!!!!!").
io:format("This line is 100 characters long and shouldn't be detected!!!!!!!!!!!!!!!!!!!!!!!!").

function_4() ->
%% Single line comment with spaces in front that is over 80 characters. So many test cases!!!
io:format("This line is 90 characters long and should be detected!!!!!!!!!!!!!!!!!!").
%% Single line comment with spaces in front that is over 100 characters. So many test cases!!!!!!!!!!!!!!!!!!!!!!!
io:format("This line is 90 characters long and should be detected!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!").

function_5() ->
io:format("This line is 90 characters long and should be detected ~p!!!!!!!!!!!!!!!!!!", [yeah]),
io:format("This line is 90 characters long and should be detected ~p!!!!!!!!!!!!!!!!!!!!!!!!!!", [yeah]),
io:format("This line is 90 characters long and should be detected ~p and these two escaped ~p!!!!!!!!!!!!!!!!!!", [yeah, no]).

function_6(Config, AntPositions)->
gb_trees:from_orddict([{Pos, #{pos => Pos, state => model:random_ant_state(Config)}} || Pos <- lists:sort(AntPositions)]). % {Pozycja, CałyAgent} - ew. do zmiany, jest zbalansowany [DG]

function_7() ->
io:format("Going to put a comment after this..."), % This comment pushes the line past 80 characters...
io:format("Going to put a comment after this..."), % This comment pushes the line past 100 characters...
ok.
2 changes: 1 addition & 1 deletion test/examples/fail_line_length_latin1.erl
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ function_1() ->
io:format("Hellö").

function_2() ->
io:format("Hellö, This line is 81 characters long and should be detected, yeah!!!").
io:format("Hellö, This line is 101 characters long and should be detected, yeah!!!!!!!!!!!!!!!").

10 changes: 5 additions & 5 deletions test/style_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,19 @@ verify_line_length_rule(_Config) ->
File = "fail_line_length.erl",
{ok, Path} = elvis_test_utils:find_file(SrcDirs, File),

Result = elvis_style:line_length(ElvisConfig, Path, #{limit => 80}),
Result = elvis_style:line_length(ElvisConfig, Path, #{limit => 100}),
8 = length(Result),
#{info := Info, message := Msg} = lists:nth(7, Result),
<<"Line 34 is too long: gb_trees:from_orddict(", _/binary>> =
list_to_binary(io_lib:format(Msg, Info)),

WholeLineResult = elvis_style:line_length(ElvisConfig, Path,
#{limit => 80,
#{limit => 100,
skip_comments => whole_line}),
6 = length(WholeLineResult),

AnyResult = elvis_style:line_length(ElvisConfig, Path,
#{limit => 80,
#{limit => 100,
skip_comments => any}),
6 = length(AnyResult).

Expand All @@ -150,7 +150,7 @@ verify_line_length_rule_latin1(_Config) ->
File = "fail_line_length_latin1.erl",
{ok, Path} = elvis_test_utils:find_file(SrcDirs, File),

Result = elvis_style:line_length(ElvisConfig, Path, #{limit => 80}),
Result = elvis_style:line_length(ElvisConfig, Path, #{limit => 100}),
1 = length(Result),
#{info := Info, message := Msg} = lists:nth(1, Result),
<<"Line 13 is too long:", _/binary>> = list_to_binary(io_lib:format(Msg, Info)).
Expand All @@ -163,7 +163,7 @@ verify_unicode_line_length_rule(_Config) ->
Pass = "pass_unicode_comments.erl",
{ok, Path} = elvis_test_utils:find_file(SrcDirs, Pass),

Result = elvis_style:line_length(ElvisConfig, Path, #{limit => 80}),
Result = elvis_style:line_length(ElvisConfig, Path, #{limit => 100}),
0 = length(Result).

-spec verify_no_tabs_rule(config()) -> any().
Expand Down

0 comments on commit 74ed2c3

Please sign in to comment.