-
Notifications
You must be signed in to change notification settings - Fork 0
/
elvis.config
154 lines (149 loc) · 6.13 KB
/
elvis.config
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
%%%
%%% Copyright 2020 RBKmoney
%%%
%%% Licensed under the Apache License, Version 2.0 (the "License");
%%% you may not use this file except in compliance with the License.
%%% You may obtain a copy of the License at
%%%
%%% http://www.apache.org/licenses/LICENSE-2.0
%%%
%%% Unless required by applicable law or agreed to in writing, software
%%% distributed under the License is distributed on an "AS IS" BASIS,
%%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%%% See the License for the specific language governing permissions and
%%% limitations under the License.
%%%
[
{elvis, [
{verbose, true},
{config, [
#{
dirs => ["apps/*/src"],
filter => "*.erl",
ruleset => erl_files,
rules => [
%% NOTE Maybe uncomment lines below
%% % Too opionated
%% {elvis_style, state_record_and_type, disable},
%% {elvis_style, no_if_expression, disable},
%% {elvis_style, no_nested_try_catch, disable},
%% {elvis_style, nesting_level, #{level => 3}},
%% {elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*$"}},
%% {elvis_style, no_if_expression, disable},
{elvis_style, no_if_expression, #{
ignore => [
mg_core_dirange
]
}},
{elvis_style, state_record_and_type, #{
ignore => [
mg_core_gen_squad,
mg_core_gen_squad_heart,
mg_core_storage_memory,
mg_core_union,
mg_core_worker
]
}},
{elvis_style, no_nested_try_catch, #{
ignore => [
mg_core_machine
]
}},
% Too broad
{elvis_style, invalid_dynamic_call, #{
ignore => [
% Working with generic registries.
mg_core_utils
]
}},
{elvis_style, no_debug_call, #{
ignore => [
mg_cth,
mg_cth_pulse
]
}},
% In line with erlfmt settings.
{elvis_text_style, line_length, #{limit => 120}},
% Was too strict.
{elvis_style, dont_repeat_yourself, #{min_complexity => 20}},
{elvis_style, god_modules, #{
limit => 30,
ignore => [
% Provides a bunch of simple and easy to understand utilities for the configurator.
mg_configuration_utils
]
}}
]
},
#{
dirs => ["apps/*/test"],
filter => "*.erl",
ruleset => erl_files,
rules => [
%% NOTE Maybe uncomment lines below
%% {elvis_style, invalid_dynamic_call, disable},
%% {elvis_style, state_record_and_type, disable},
%% % Assert macros can trigger use of ignored binding, yet we want them for better
%% % readability.
%% {elvis_style, used_ignored_variable, disable},
%% {elvis_style, nesting_level, #{level => 3}},
%% {elvis_style, function_naming_convention, #{regex => "^([a-z][a-z0-9]*_?)*$"}},
%% {elvis_style, no_if_expression, disable},
{elvis_style, state_record_and_type, #{ignore => [ct_proxy]}},
{elvis_style, invalid_dynamic_call, #{
ignore => [
ct_proxy_protocol
]
}},
{elvis_style, used_ignored_variable, #{
ignore => [
mg_core_events_sink_kafka_errors_SUITE,
mg_core_workers_SUITE
]
}},
% In line with erlfmt settings.
{elvis_text_style, line_length, #{limit => 120}},
% We want to use `ct:pal/2` and friends in test code.
{elvis_style, no_debug_call, disable},
% Tests are usually more comprehensible when a bit more verbose.
{elvis_style, dont_repeat_yourself, #{min_complexity => 20}},
{elvis_style, god_modules, #{
ignore => [
mg_prometheus_metric_SUITE,
mg_tests_SUITE,
mg_woody_tests_SUITE
]
}}
]
},
#{
dirs => [".", "apps/*"],
filter => "rebar.config",
rules => [
{elvis_text_style, line_length, #{limit => 120}},
{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace}
]
},
#{
dirs => ["apps/*/src"],
filter => "*.app.src",
rules => [
{elvis_text_style, line_length, #{limit => 120}},
{elvis_text_style, no_tabs},
{elvis_text_style, no_trailing_whitespace}
]
},
#{
dirs => ["."],
filter => "elvis.config",
ruleset => elvis_config
},
#{
dirs => ["."],
filter => "Makefile",
ruleset => makefiles
}
]}
]}
].