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

Apply Rebar3 format #54

Merged
merged 2 commits into from Feb 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 2 additions & 14 deletions elvis.config
Expand Up @@ -7,32 +7,20 @@
filter => "*.erl",
ruleset => erl_files,
rules => [
{elvis_style, line_length, #{limit => 100}},
{elvis_style, line_length, #{limit => 120}},
{elvis_style, nesting_level, #{level => 4}},
{elvis_style, god_modules, #{limit => 35}},
%% the default rule included {right, ","} and not {right, "=>"} or {left, "=>"}
{
elvis_style,
operator_spaces,
#{rules => [{right, "++"}, {left, "++"}, {right, "=>"}, {left, "=>"}]}
},
{elvis_style, dont_repeat_yourself, #{min_complexity => 30}}
]
},
#{dirs => ["test"],
filter => "*.erl",
ruleset => erl_files,
rules => [
{elvis_style, line_length, #{limit => 100}},
{elvis_style, line_length, #{limit => 120}},
{elvis_style, nesting_level, #{level => 4}},
%% Variables in eunit macros are called, for instance, __V
{elvis_style, variable_naming_convention, #{regex => "^_?_?([A-Z][0-9a-zA-Z]*)_?$"}},
%% the default rule included {right, ","} and not {right, "=>"} or {left, "=>"}
{
elvis_style,
operator_spaces,
#{rules => [{right, "++"}, {left, "++"}, {right, "=>"}, {left, "=>"}]}
},
%% we want to be able to ct:pal in tests
{elvis_style, no_debug_call, disable},
%% we can go lighter on this one here
Expand Down
42 changes: 17 additions & 25 deletions include/mero.hrl
Expand Up @@ -27,8 +27,8 @@
%% OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%%
-ifndef(MEMCACHERL_HRL).
-define(MEMCACHERL_HRL, true).

-define(MEMCACHERL_HRL, true).
-define(MEMCACHE_INCREMENT, 16#05).
-define(MEMCACHE_INCREMENTQ, 16#15).
-define(MEMCACHE_GET, 16#00).
Expand All @@ -42,36 +42,28 @@
-define(MEMCACHE_DELETE, 16#04).
-define(MEMCACHE_DELETEQ, 16#14).
-define(MEMCACHE_FLUSH_ALL, 16#08).

-define(NO_ERROR, 16#0000).
-define(NOT_FOUND, 16#0001).
-define(KEY_EXISTS, 16#0002).
-define(VALUE_TOO_LARGE, 16#0003).
-define(NO_ERROR, 16#0000).
-define(NOT_FOUND, 16#0001).
-define(KEY_EXISTS, 16#0002).
-define(VALUE_TOO_LARGE, 16#0003).
-define(INVALID_ARGUMENTS, 16#0004).
-define(NOT_STORED, 16#0005).
-define(NON_NUMERIC_INCR, 16#0006).
-define(UNKNOWN_COMMAND, 16#0081).
-define(OOM, 16#0082).

-define(NOT_STORED, 16#0005).
-define(NON_NUMERIC_INCR, 16#0006).
-define(UNKNOWN_COMMAND, 16#0081).
-define(OOM, 16#0082).
%%% If a connection attempt fails, or a connection is broken
-define(RECONNECT_WAIT_TIME, 200).

%%% Default timeout for instrospection functions
-define(DEFAULT_TIMEOUT, 5000).

-define(LOG_EVENT(MFA, KeyAndTags), begin
{StatModule, StatFunction, GlobalTags} = MFA,
apply(StatModule, StatFunction, [KeyAndTags ++ GlobalTags])
end).

-define(LOG_EVENT(MFA, KeyAndTags),
begin
{StatModule, StatFunction, GlobalTags} = MFA,
apply(StatModule, StatFunction, [KeyAndTags ++ GlobalTags])
end).
-define(CALLBACK_CONTEXT(StatModule, StatFunction, ClusterName, Host, Port),
{StatModule, StatFunction,
[{cluster_name, ClusterName},
{host, Host},
{port, Port}]}).
{StatModule, StatFunction, [{cluster_name, ClusterName}, {host, Host}, {port, Port}]}).

-record(mero_item, {key,
value,
cas}).
-record(mero_item, {key, value, cas}).

-endif.

7 changes: 5 additions & 2 deletions rebar.config
Expand Up @@ -49,9 +49,12 @@
]}
]}.

{alias, [{test, [xref, dialyzer, lint, eunit, ct, cover]}]}.
{alias, [{test, [format, lint, xref, dialyzer, eunit, ct, cover]}]}.

{plugins, [
{rebar3_lint, "0.1.10"},
rebar3_format,
rebar3_lint,
rebar3_hex
]}.

{format, [{files, ["src/*.erl", "test/*.erl", "include/*.hrl"]}]}.