forked from red-data-tools/red_amber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.rubocop.yml
executable file
·255 lines (227 loc) · 6.8 KB
/
.rubocop.yml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# We will use cops to detect bugs in an early stage
# Feel free to use .rubocop_todo.yml by --auto-gen-config
inherit_from: .rubocop_todo.yml
require:
- rubocop-performance
- rubocop-rubycw
- rubocop-rake
AllCops:
# drop support for 2.7 (since 0.3.0)
TargetRubyVersion: 3.0
# accept new cops if any
NewCops: enable
# ===
# Globally I change these 3 cops from default
# alias is hard to see separately
Style/Alias:
EnforcedStyle: prefer_alias_method
# For consistency and portability
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
# Should not set for Style/TrailingCommaInArguments
# ===
# To let you know the possibility of refactoring ===
# Max: 120
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
# URISchemes: http, https
Layout/LineLength:
Max: 90
Exclude:
- 'test/**/*'
# EnforcedStyle: aligned
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented_relative_to_receiver
# Disabled to define Vector operators
# Offense count: 38
Lint/BinaryOperatorWithIdenticalOperands:
Exclude:
- 'test/test_vector_binary_element_wise.rb'
Lint/Debugger:
Exclude:
- 'bin/example'
# Need for test with empty block
# Offense count: 1
# Configuration parameters: AllowComments, AllowEmptyLambdas.
Lint/EmptyBlock:
Exclude:
- 'test/test_group.rb'
# avoid unused variable asignment
# Offense count: 6
Lint/UselessAssignment:
Exclude:
- 'test/**/*'
# <= 17 satisfactory
# 18..30 unsatisfactory
# > 30 dangerous
# Offense count: 28
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 30
CountRepeatedAttributes: false
AllowedMethods: [
'join_merge_keys', # 54.18
'join', # 53.1
'dataframe_info', # 46.5
'format_table', # 84.62
'to_long', # 33.66
'to_wide', #38.22
'slice_by', # 38.29
'remove', # 44.42
'drop', # 31.42
'[]', # 33.76
'split', # 37.35
'aggregate', # 38.13
'filters', # 33.91
'merge_keys', # 32.17
'rename_keys', # 31.64
]
# Max: 25
# Offense count: 57
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
# AllowedMethods: refine
Metrics/BlockLength:
Max: 25
Exclude:
- 'test/**/*'
- 'lib/red_amber/helper.rb' # 32
# It's ok if class is big
# Max: 100
# Offense count: 15
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Exclude:
- 'test/**/*'
- 'lib/red_amber/data_frame.rb' # 162
- 'lib/red_amber/group.rb' # 105
- 'lib/red_amber/subframes.rb' # 110
- 'lib/red_amber/vector.rb' # 152
- 'lib/red_amber/vector_binary_element_wise.rb' # 109
# Only for monitoring. I will measure by PerceivedComplexity.
# Max: 7
# Offense count: 16
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/CyclomaticComplexity:
Max: 12
AllowedMethods: [
'split', # 33
'format_table', # 21
'normalize_element', # 17
'slice_by', # 16
'assign_update', # 14
'join', # 14
'parse_range', # 14
'remove', # 14
'[]', # 13
'drop', # 13
'aggregate', # 13
]
# Max: 10
# Offense count: 34
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/MethodLength:
Max: 30
AllowedMethods: [
'join', # 47
'join_merge_keys', # 41
'format_table', # 53
'slice_by', # 38
'assign_update', # 35
'summarize', # 35
'dataframe_info', # 33
'drop', # 32
'aggregate', # 31
]
# Max: 100
# Offense count: 5
# Configuration parameters: CountComments, CountAsOne.
Metrics/ModuleLength:
Max: 100
Exclude:
- 'lib/red_amber/data_frame_combinable.rb' # Max: 149
- 'lib/red_amber/data_frame_displayable.rb' # Max: 226
- 'lib/red_amber/data_frame_selectable.rb' # Max: 175
- 'lib/red_amber/data_frame_variable_operation.rb' # Max: 171
- 'lib/red_amber/vector_functions.rb' # Max: 165
- 'lib/red_amber/vector_selectable.rb' # Max: 104
- 'lib/red_amber/vector_updatable.rb' # Max: 103
# Max: 5
# Offense count: 1
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
Metrics/ParameterLists:
Exclude:
- 'lib/red_amber/data_frame_combinable.rb' # Max: 6, at 'join'
# Max: 8
# Offense count: 15
# Configuration parameters: AllowedMethods, AllowedPatterns, IgnoredMethods.
Metrics/PerceivedComplexity:
Max: 10
AllowedMethods: [
'format_table', # 22
'slice_by', # 20
'normalize_element', # 17
'assign_update', # 15
'parse_range', # 15
'join', # 14
'remove', # 14
'split', # 14
'dataframe_info', # 13
'replace', # 13
'drop', # 12
'initialize', # 12
'aggregate', # 12
'[]', # 11
'filters', # 11
'html_table', # 11
'slice', # 11
'pick', # 11
]
# Offense count: 1
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
Naming/FileName:
Exclude:
- 'lib/red-amber.rb'
# Necessary to define is_na, is_in, etc.
# Offense count: 3
# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros.
# NamePrefix: is_, has_, have_
# ForbiddenPrefixes: is_, has_, have_
# AllowedMethods: is_a?
# MethodDefinitionMacros: define_method, define_singleton_method
Naming/PredicateName:
Exclude:
- 'lib/red_amber/vector.rb'
- 'lib/red_amber/vector_functions.rb'
- 'lib/red_amber/vector_selectable.rb'
# avoid unused variable asignment
Rubycw/Rubycw:
Exclude:
- 'test/**/*'
- 'bin/example'
# Offense count: 16
# This cop supports safe autocorrection (--autocorrect).
Style/OperatorMethodCall:
Exclude:
- 'test/test_vector_binary_element_wise.rb'
# Necessary to test when range.end == -1
# Offense count: 2
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/SlicingWithRange:
Exclude:
- 'test/test_data_frame_selectable.rb'
Style/MixinUsage:
Exclude:
- 'bin/example'
# Necessary to Vector < 0 element-wise comparison
# Offense count: 5
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns, IgnoredMethods.
# SupportedStyles: predicate, comparison
Style/NumericPredicate:
Exclude:
- 'lib/red_amber/data_frame_selectable.rb'
- 'lib/red_amber/vector_selectable.rb'