Skip to content

Commit

Permalink
Improve rule lookup performance (#4)
Browse files Browse the repository at this point in the history
* Run test in parallel

* Improve rule lookup performance

Previously, it used to do a lookup by removing the last character of the
agent one by one until it found a match. This is really inefficient.

Instead, we now reverse the agents before storing and we remove the
first character one by one instead of the last.

* Format the configuration

* Switch clause to remove pattern
  • Loading branch information
AntoineGagne committed Jun 29, 2021
1 parent 2cb5edc commit cb111f6
Show file tree
Hide file tree
Showing 4 changed files with 292 additions and 214 deletions.
142 changes: 64 additions & 78 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,97 +1,83 @@
{minimum_otp_vsn, "21.0"}.

{alias, [
{check, [lint, xref, dialyzer, edoc,
{eunit, "-c"}, {ct, "-c"}, {proper, "-c"},
{cover, "-v --min_coverage=85"},
todo
]}
]}.
{check, [
lint,
xref,
dialyzer,
edoc,
{eunit, "-c"},
{ct, "-c"},
{proper, "-c"},
{cover, "-v --min_coverage=85"},
todo
]}
]}.

{dialyzer, [{warnings, [unknown]}]}.

{edoc_opts, []}.
{edoc_opts, [
{app_default, "https://www.erlang.org/doc/man"},
{image, ""},
{preprocess, true},
{title, "robots"}
]}.

{erl_opts, [
debug_info,
warn_unused_import,
warnings_as_errors
]}.
debug_info,
warn_unused_import,
warnings_as_errors
]}.

{deps, []
}.
{deps, []}.

{profiles, [{prod, [{relx, [{dev_mode, false},
{include_erts, true}]}]
},
{profiles, [
{prod, [
{relx, [
{dev_mode, false},
{include_erts, true}
]}
]},

{test, [
{erl_opts, [nowarn_export_all]},
{deps, [
{meck, "0.8.9"},
{proper, {git, "https://github.com/manopapad/proper.git", {branch, "master"}}}
]}
]}
]
}.
{test, [
{erl_opts, [nowarn_export_all]},
{eunit_opts, [no_tty, {report, {unite_compact, []}}]},
{deps, [
{meck, "0.8.9"},
{proper, {git, "https://github.com/manopapad/proper.git", {branch, "master"}}},
{unite, {git, "git://github.com/eproxus/unite.git", {tag, "0.3.1"}}}
]}
]}
]}.

{plugins, [
{rebar3_proper, "0.11.1"},
{rebar3_lint, {git, "https://github.com/project-fifo/rebar3_lint.git", {tag, "0.1.2"}}},
{rebar3_todo, {git, "https://github.com/ferd/rebar3_todo.git", {branch, "master"}}},
rebar3_hex,
coveralls
]}.
{rebar3_proper, "0.11.1"},
{rebar3_lint, {git, "https://github.com/project-fifo/rebar3_lint.git", {tag, "v0.4.0"}}},
{rebar3_todo, {git, "https://github.com/ferd/rebar3_todo.git", {branch, "master"}}},
rebar3_hex,
coveralls
]}.

{cover_enabled, true}.

{cover_opts, [verbose]}.

{cover_export_enabled, true}.

{elvis,
[#{dirs => ["apps/*/src/**",
"apps/*/test/**"],
filter => "*.erl",
rules => [{elvis_style, line_length,
#{ignore => [],
limit => 120,
skip_comments => false}},
{elvis_style, no_tabs},
{elvis_style, no_trailing_whitespace},
{elvis_style, macro_names, #{ignore => []}},
{elvis_style, macro_module_names},
{elvis_style, operator_spaces, #{rules => [{right, ","},
{right, "++"},
{left, "++"}]}},
{elvis_style, nesting_level, #{level => 3}},
{elvis_style, god_modules,
#{limit => 25,
ignore => []}},
{elvis_style, no_if_expression},
{elvis_style, invalid_dynamic_call,
#{ignore => []}},
{elvis_style, used_ignored_variable},
{elvis_style, no_behavior_info},
{elvis_style,
module_naming_convention,
#{regex => "^[a-z]([a-z0-9]*_?)*(_SUITE)?$", ignore => []}},
{elvis_style,
function_naming_convention,
#{regex => "^[a-z]([a-z0-9]*_?)*$"}},
{elvis_style, state_record_and_type},
{elvis_style, no_spec_with_records},
{elvis_style, dont_repeat_yourself, #{min_complexity => 20}},
{elvis_style, no_debug_call, #{ignore => []}}
]
},
#{dirs => ["."],
filter => "rebar.config",
rules => [{elvis_project, no_deps_master_rebar, #{ignore => []}}]
}
]
}.
{elvis, [
#{
dirs => ["."],
filter => "rebar.config",
ruleset => rebar_config
}
]}.

{xref_checks, [
undefined_function_calls,
undefined_functions,
locals_not_used,
deprecated_function_calls,
deprecated_functions
]}.

{xref_checks,[undefined_function_calls,
undefined_functions,
locals_not_used,
deprecated_function_calls,
deprecated_functions]}.
{xref_ignores, []}.
Loading

0 comments on commit cb111f6

Please sign in to comment.