rubycritic 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +593 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/CONTRIBUTING.md +17 -15
- data/README.md +15 -4
- data/Rakefile +9 -6
- data/bin/rubycritic +2 -2
- data/lib/rubycritic.rb +21 -1
- data/lib/rubycritic/analysers/churn.rb +4 -2
- data/lib/rubycritic/analysers/helpers/ast_node.rb +4 -8
- data/lib/rubycritic/analysers/helpers/methods_counter.rb +2 -5
- data/lib/rubycritic/analysers/helpers/modules_locator.rb +2 -5
- data/lib/rubycritic/analysers/helpers/parser.rb +12 -0
- data/lib/rubycritic/analysers/helpers/reek.rb +6 -2
- data/lib/rubycritic/analysers/smells/reek.rb +1 -1
- data/lib/rubycritic/analysers_runner.rb +13 -7
- data/lib/rubycritic/cli/application.rb +24 -0
- data/lib/rubycritic/cli/options.rb +57 -0
- data/lib/rubycritic/commands/ci.rb +28 -0
- data/lib/rubycritic/commands/default.rb +30 -0
- data/lib/rubycritic/commands/help.rb +13 -0
- data/lib/rubycritic/commands/version.rb +11 -0
- data/lib/rubycritic/configuration.rb +19 -14
- data/lib/rubycritic/core/analysed_module.rb +1 -1
- data/lib/rubycritic/core/smell.rb +1 -1
- data/lib/rubycritic/report_generators/base.rb +1 -1
- data/lib/rubycritic/report_generators/line.rb +1 -1
- data/lib/rubycritic/report_generators/smells_index.rb +1 -0
- data/lib/rubycritic/report_generators/templates/code_file.html.erb +1 -1
- data/lib/rubycritic/report_generators/templates/smells_index.html.erb +6 -2
- data/lib/rubycritic/report_generators/templates/smelly_line.html.erb +1 -1
- data/lib/rubycritic/report_generators/view_helpers.rb +4 -4
- data/lib/rubycritic/reporters/base.rb +1 -1
- data/lib/rubycritic/revision_comparator.rb +14 -14
- data/lib/rubycritic/source_control_systems/base.rb +9 -32
- data/lib/rubycritic/source_control_systems/double.rb +6 -7
- data/lib/rubycritic/source_control_systems/git.rb +10 -16
- data/lib/rubycritic/source_control_systems/mercurial.rb +29 -0
- data/lib/rubycritic/source_locator.rb +4 -5
- data/lib/rubycritic/version.rb +1 -1
- data/rubycritic.gemspec +4 -3
- data/test/lib/rubycritic/analysers/churn_test.rb +5 -5
- data/test/lib/rubycritic/analysers/smells/flay_test.rb +1 -1
- data/test/lib/rubycritic/configuration_test.rb +8 -7
- data/test/lib/rubycritic/core/analysed_module_test.rb +2 -2
- data/test/lib/rubycritic/core/smell_test.rb +2 -2
- data/test/lib/rubycritic/source_control_systems/{source_control_system_test.rb → base_test.rb} +1 -1
- data/test/lib/rubycritic/source_control_systems/double_test.rb +11 -0
- data/test/lib/rubycritic/source_control_systems/git_test.rb +13 -0
- data/test/lib/rubycritic/source_control_systems/interfaces/basic.rb +7 -0
- data/test/lib/rubycritic/source_control_systems/interfaces/time_travel.rb +7 -0
- data/test/lib/rubycritic/source_control_systems/mercurial_test.rb +11 -0
- data/test/lib/rubycritic/source_locator_test.rb +8 -2
- data/test/test_helper.rb +29 -0
- metadata +49 -13
- data/lib/rubycritic/cli.rb +0 -46
- data/lib/rubycritic/modules_initializer.rb +0 -14
- data/lib/rubycritic/orchestrator.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e86148ed6e8dc3e9649695c90784be4cc5dc95ec
|
4
|
+
data.tar.gz: 201c5008a2b0e0b7db1dbe7f18a59ecf4187f19e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb0f3a23a9d8080fb6d2b7c46a15e1752957058c81af4f5e15618f15cdf415048b9a8554f776729aa811b865daa2b7d42765bd34c6f6af2adcfeb0c03f44b988
|
7
|
+
data.tar.gz: 0f6af7917e75941cd405fc5b311345bf2464894e4e8acbe4573a20d9cf076958e1483d1763f8dacdf9b25ba9b5db2dcc932f014e7754b8fb1f1d34356763ac22
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,593 @@
|
|
1
|
+
AllCops:
|
2
|
+
Include:
|
3
|
+
- '**/*.gemspec'
|
4
|
+
- '**/*.rake'
|
5
|
+
- '**/Gemfile'
|
6
|
+
- '**/Rakefile'
|
7
|
+
Exclude:
|
8
|
+
- 'test/samples/**/*'
|
9
|
+
# By default, the rails cops are not run. Override in project or home
|
10
|
+
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
11
|
+
RunRailsCops: false
|
12
|
+
|
13
|
+
Style/AccessorMethodName:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
# Indent private/protected/public as deep as method definitions
|
17
|
+
Style/AccessModifierIndentation:
|
18
|
+
EnforcedStyle: indent
|
19
|
+
SupportedStyles:
|
20
|
+
- outdent
|
21
|
+
- indent
|
22
|
+
|
23
|
+
# Align the elements of a hash literal if they span more than one line.
|
24
|
+
Style/AlignHash:
|
25
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
26
|
+
#
|
27
|
+
# key - left alignment of keys
|
28
|
+
# 'a' => 2
|
29
|
+
# 'bb' => 3
|
30
|
+
# separator - alignment of hash rockets, keys are right aligned
|
31
|
+
# 'a' => 2
|
32
|
+
# 'bb' => 3
|
33
|
+
# table - left alignment of keys, hash rockets, and values
|
34
|
+
# 'a' => 2
|
35
|
+
# 'bb' => 3
|
36
|
+
EnforcedHashRocketStyle: key
|
37
|
+
# Alignment of entries using colon as separator. Valid values are:
|
38
|
+
#
|
39
|
+
# key - left alignment of keys
|
40
|
+
# a: 0
|
41
|
+
# bb: 1
|
42
|
+
# separator - alignment of colons, keys are right aligned
|
43
|
+
# a: 0
|
44
|
+
# bb: 1
|
45
|
+
# table - left alignment of keys and values
|
46
|
+
# a: 0
|
47
|
+
# bb: 1
|
48
|
+
EnforcedColonStyle: key
|
49
|
+
# Select whether hashes that are the last argument in a method call should be
|
50
|
+
# inspected? Valid values are:
|
51
|
+
#
|
52
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
53
|
+
# Registers an offense for:
|
54
|
+
# function(a: 1,
|
55
|
+
# b: 2)
|
56
|
+
# Registers an offense for:
|
57
|
+
# function({a: 1,
|
58
|
+
# b: 2})
|
59
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
60
|
+
# Accepts:
|
61
|
+
# function(a: 1,
|
62
|
+
# b: 2)
|
63
|
+
# Accepts:
|
64
|
+
# function({a: 1,
|
65
|
+
# b: 2})
|
66
|
+
# ignore_implicit - Ignore only implicit hashes.
|
67
|
+
# Accepts:
|
68
|
+
# function(a: 1,
|
69
|
+
# b: 2)
|
70
|
+
# Registers an offense for:
|
71
|
+
# function({a: 1,
|
72
|
+
# b: 2})
|
73
|
+
# ignore_explicit - Ignore only explicit hashes.
|
74
|
+
# Accepts:
|
75
|
+
# function({a: 1,
|
76
|
+
# b: 2})
|
77
|
+
# Registers an offense for:
|
78
|
+
# function(a: 1,
|
79
|
+
# b: 2)
|
80
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
81
|
+
SupportedLastArgumentHashStyles:
|
82
|
+
- always_inspect
|
83
|
+
- always_ignore
|
84
|
+
- ignore_implicit
|
85
|
+
- ignore_explicit
|
86
|
+
|
87
|
+
Style/AlignParameters:
|
88
|
+
# Alignment of parameters in multi-line method calls.
|
89
|
+
#
|
90
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
91
|
+
# column as the first parameter.
|
92
|
+
#
|
93
|
+
# method_call(a,
|
94
|
+
# b)
|
95
|
+
#
|
96
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
97
|
+
# level of indentation relative to the start of the line with the method call.
|
98
|
+
#
|
99
|
+
# method_call(a,
|
100
|
+
# b)
|
101
|
+
EnforcedStyle: with_first_parameter
|
102
|
+
SupportedStyles:
|
103
|
+
- with_first_parameter
|
104
|
+
- with_fixed_indentation
|
105
|
+
# My prefered method is not available:
|
106
|
+
# method_call(
|
107
|
+
# a,
|
108
|
+
# b
|
109
|
+
# )
|
110
|
+
Enabled: false
|
111
|
+
|
112
|
+
Style/AndOr:
|
113
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
114
|
+
# or completely (always).
|
115
|
+
EnforcedStyle: always
|
116
|
+
SupportedStyles:
|
117
|
+
- always
|
118
|
+
- conditionals
|
119
|
+
|
120
|
+
|
121
|
+
# Checks if usage of %() or %Q() matches configuration.
|
122
|
+
Style/BarePercentLiterals:
|
123
|
+
EnforcedStyle: bare_percent
|
124
|
+
SupportedStyles:
|
125
|
+
- percent_q
|
126
|
+
- bare_percent
|
127
|
+
|
128
|
+
Style/BracesAroundHashParameters:
|
129
|
+
EnforcedStyle: no_braces
|
130
|
+
SupportedStyles:
|
131
|
+
# The `braces` style enforces braces around all method parameters that are
|
132
|
+
# hashes.
|
133
|
+
- braces
|
134
|
+
# The `no_braces` style checks that the last parameter doesn't have braces
|
135
|
+
# around it.
|
136
|
+
- no_braces
|
137
|
+
# The `context_dependent` style checks that the last parameter doesn't have
|
138
|
+
# braces around it, but requires braces if the second to last parameter is
|
139
|
+
# also a hash literal.
|
140
|
+
- context_dependent
|
141
|
+
|
142
|
+
# Indentation of `when`.
|
143
|
+
Style/CaseIndentation:
|
144
|
+
IndentWhenRelativeTo: case
|
145
|
+
SupportedStyles:
|
146
|
+
- case
|
147
|
+
- end
|
148
|
+
IndentOneStep: false
|
149
|
+
|
150
|
+
Style/ClassAndModuleChildren:
|
151
|
+
# Checks the style of children definitions at classes and modules.
|
152
|
+
#
|
153
|
+
# Basically there are two different styles:
|
154
|
+
#
|
155
|
+
# `nested` - have each child on a separate line
|
156
|
+
# class Foo
|
157
|
+
# class Bar
|
158
|
+
# end
|
159
|
+
# end
|
160
|
+
#
|
161
|
+
# `compact` - combine definitions as much as possible
|
162
|
+
# class Foo::Bar
|
163
|
+
# end
|
164
|
+
#
|
165
|
+
# The compact style is only forced, for classes / modules with one child.
|
166
|
+
EnforcedStyle: nested
|
167
|
+
SupportedStyles:
|
168
|
+
- nested
|
169
|
+
- compact
|
170
|
+
|
171
|
+
Style/ClassCheck:
|
172
|
+
EnforcedStyle: is_a?
|
173
|
+
SupportedStyles:
|
174
|
+
- is_a?
|
175
|
+
- kind_of?
|
176
|
+
|
177
|
+
Style/ClassVars:
|
178
|
+
Enabled: false
|
179
|
+
|
180
|
+
# Align with the style guide.
|
181
|
+
Style/CollectionMethods:
|
182
|
+
# Mapping from undesired method to desired_method
|
183
|
+
# e.g. to use `detect` over `find`:
|
184
|
+
#
|
185
|
+
# CollectionMethods:
|
186
|
+
# PreferredMethods:
|
187
|
+
# find: detect
|
188
|
+
PreferredMethods:
|
189
|
+
collect: 'map'
|
190
|
+
collect!: 'map!'
|
191
|
+
inject: 'reduce'
|
192
|
+
detect: 'find'
|
193
|
+
find_all: 'select'
|
194
|
+
|
195
|
+
# Checks formatting of special comments
|
196
|
+
Style/CommentAnnotation:
|
197
|
+
Keywords:
|
198
|
+
- TODO
|
199
|
+
- FIXME
|
200
|
+
- OPTIMIZE
|
201
|
+
- HACK
|
202
|
+
- REVIEW
|
203
|
+
|
204
|
+
Style/Documentation:
|
205
|
+
Enabled: false
|
206
|
+
|
207
|
+
# Multi-line method chaining should be done with leading dots.
|
208
|
+
Style/DotPosition:
|
209
|
+
EnforcedStyle: leading
|
210
|
+
SupportedStyles:
|
211
|
+
- leading
|
212
|
+
- trailing
|
213
|
+
|
214
|
+
# Use empty lines between defs.
|
215
|
+
Style/EmptyLineBetweenDefs:
|
216
|
+
# If true, this parameter means that single line method definitions don't
|
217
|
+
# need an empty line between them.
|
218
|
+
AllowAdjacentOneLineDefs: false
|
219
|
+
|
220
|
+
Style/EmptyLinesAroundBlockBody:
|
221
|
+
EnforcedStyle: no_empty_lines
|
222
|
+
SupportedStyles:
|
223
|
+
- empty_lines
|
224
|
+
- no_empty_lines
|
225
|
+
|
226
|
+
Style/EmptyLinesAroundClassBody:
|
227
|
+
Enabled: false
|
228
|
+
EnforcedStyle: no_empty_lines
|
229
|
+
SupportedStyles:
|
230
|
+
- empty_lines
|
231
|
+
- no_empty_lines
|
232
|
+
|
233
|
+
Style/EmptyLinesAroundModuleBody:
|
234
|
+
Enabled: false
|
235
|
+
EnforcedStyle: no_empty_lines
|
236
|
+
SupportedStyles:
|
237
|
+
- empty_lines
|
238
|
+
- no_empty_lines
|
239
|
+
|
240
|
+
# Checks whether the source file has a utf-8 encoding comment or not
|
241
|
+
Style/Encoding:
|
242
|
+
EnforcedStyle: when_needed
|
243
|
+
SupportedStyles:
|
244
|
+
- when_needed
|
245
|
+
- always
|
246
|
+
|
247
|
+
Style/FileName:
|
248
|
+
# File names listed in AllCops:Include are excluded by default. Add extra
|
249
|
+
# excludes here.
|
250
|
+
Exclude: []
|
251
|
+
|
252
|
+
# Checks use of for or each in multiline loops.
|
253
|
+
Style/For:
|
254
|
+
EnforcedStyle: each
|
255
|
+
SupportedStyles:
|
256
|
+
- for
|
257
|
+
- each
|
258
|
+
|
259
|
+
# Enforce the method used for string formatting.
|
260
|
+
Style/FormatString:
|
261
|
+
EnforcedStyle: format
|
262
|
+
SupportedStyles:
|
263
|
+
- format
|
264
|
+
- sprintf
|
265
|
+
- percent
|
266
|
+
|
267
|
+
# Built-in global variables are allowed by default.
|
268
|
+
Style/GlobalVars:
|
269
|
+
AllowedVariables: []
|
270
|
+
|
271
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
272
|
+
# needs to have to trigger this cop
|
273
|
+
Style/GuardClause:
|
274
|
+
MinBodyLength: 1
|
275
|
+
|
276
|
+
Style/HashSyntax:
|
277
|
+
EnforcedStyle: hash_rockets
|
278
|
+
SupportedStyles:
|
279
|
+
- ruby19
|
280
|
+
- hash_rockets
|
281
|
+
|
282
|
+
Style/IfUnlessModifier:
|
283
|
+
MaxLineLength: 80
|
284
|
+
|
285
|
+
Style/IndentationWidth:
|
286
|
+
# Number of spaces for each indentation level.
|
287
|
+
Width: 2
|
288
|
+
|
289
|
+
# Checks the indentation of the first key in a hash literal.
|
290
|
+
Style/IndentHash:
|
291
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
292
|
+
# that have their opening brace on the same line as a surrounding opening
|
293
|
+
# round parenthesis, shall have their first key indented relative to the
|
294
|
+
# first position inside the parenthesis.
|
295
|
+
# The value `consistent` means that the indentation of the first key shall
|
296
|
+
# always be relative to the first position of the line where the opening
|
297
|
+
# brace is.
|
298
|
+
EnforcedStyle: special_inside_parentheses
|
299
|
+
SupportedStyles:
|
300
|
+
- special_inside_parentheses
|
301
|
+
- consistent
|
302
|
+
|
303
|
+
Style/LambdaCall:
|
304
|
+
EnforcedStyle: call
|
305
|
+
SupportedStyles:
|
306
|
+
- call
|
307
|
+
- braces
|
308
|
+
|
309
|
+
Style/Next:
|
310
|
+
# With `always` all conditions at the end of an iteration needs to be
|
311
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
312
|
+
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
313
|
+
EnforcedStyle: skip_modifier_ifs
|
314
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
315
|
+
# needs to have to trigger this cop
|
316
|
+
MinBodyLength: 3
|
317
|
+
SupportedStyles:
|
318
|
+
- skip_modifier_ifs
|
319
|
+
- always
|
320
|
+
|
321
|
+
Style/NonNilCheck:
|
322
|
+
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
323
|
+
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
324
|
+
# **usually** OK, but might change behavior.
|
325
|
+
#
|
326
|
+
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
327
|
+
# offenses for `!x.nil?` and does no changes that might change behavior.
|
328
|
+
IncludeSemanticChanges: false
|
329
|
+
|
330
|
+
Style/MethodDefParentheses:
|
331
|
+
EnforcedStyle: require_parentheses
|
332
|
+
SupportedStyles:
|
333
|
+
- require_parentheses
|
334
|
+
- require_no_parentheses
|
335
|
+
|
336
|
+
Style/MethodName:
|
337
|
+
EnforcedStyle: snake_case
|
338
|
+
SupportedStyles:
|
339
|
+
- snake_case
|
340
|
+
- camelCase
|
341
|
+
|
342
|
+
Style/MultilineOperationIndentation:
|
343
|
+
EnforcedStyle: indented
|
344
|
+
SupportedStyles:
|
345
|
+
- aligned
|
346
|
+
- indented
|
347
|
+
|
348
|
+
Style/NumericLiterals:
|
349
|
+
MinDigits: 5
|
350
|
+
|
351
|
+
# Allow safe assignment in conditions.
|
352
|
+
Style/ParenthesesAroundCondition:
|
353
|
+
AllowSafeAssignment: true
|
354
|
+
|
355
|
+
Style/PercentLiteralDelimiters:
|
356
|
+
PreferredDelimiters:
|
357
|
+
'%': ()
|
358
|
+
'%i': ()
|
359
|
+
'%q': ()
|
360
|
+
'%Q': ()
|
361
|
+
'%r': '{}'
|
362
|
+
'%s': ()
|
363
|
+
'%w': ()
|
364
|
+
'%W': ()
|
365
|
+
'%x': ()
|
366
|
+
|
367
|
+
Style/PercentQLiterals:
|
368
|
+
EnforcedStyle: lower_case_q
|
369
|
+
SupportedStyles:
|
370
|
+
- lower_case_q # Use %q when possible, %Q when necessary
|
371
|
+
- upper_case_q # Always use %Q
|
372
|
+
|
373
|
+
Style/PredicateName:
|
374
|
+
# Predicate name prefices.
|
375
|
+
NamePrefix:
|
376
|
+
- is_
|
377
|
+
- has_
|
378
|
+
- have_
|
379
|
+
# Predicate name prefices that should be removed.
|
380
|
+
NamePrefixBlacklist:
|
381
|
+
- is_
|
382
|
+
- has_
|
383
|
+
- have_
|
384
|
+
|
385
|
+
Style/RaiseArgs:
|
386
|
+
EnforcedStyle: compact
|
387
|
+
SupportedStyles:
|
388
|
+
- compact # raise Exception.new(msg)
|
389
|
+
- exploded # raise Exception, msg
|
390
|
+
|
391
|
+
Style/RedundantReturn:
|
392
|
+
# When true allows code like `return x, y`.
|
393
|
+
AllowMultipleReturnValues: false
|
394
|
+
|
395
|
+
Style/RegexpLiteral:
|
396
|
+
# The maximum number of (escaped) slashes that a slash-delimited regexp is
|
397
|
+
# allowed to have. If there are more slashes, a %r regexp shall be used.
|
398
|
+
MaxSlashes: 1
|
399
|
+
|
400
|
+
Style/Semicolon:
|
401
|
+
# Allow ; to separate several expressions on the same line.
|
402
|
+
AllowAsExpressionSeparator: false
|
403
|
+
|
404
|
+
Style/SignalException:
|
405
|
+
Enabled: false
|
406
|
+
EnforcedStyle: semantic
|
407
|
+
SupportedStyles:
|
408
|
+
- only_raise
|
409
|
+
- only_fail
|
410
|
+
- semantic
|
411
|
+
|
412
|
+
Style/SingleLineBlockParams:
|
413
|
+
Methods:
|
414
|
+
- reduce:
|
415
|
+
- a
|
416
|
+
- e
|
417
|
+
- inject:
|
418
|
+
- a
|
419
|
+
- e
|
420
|
+
|
421
|
+
Style/SingleLineMethods:
|
422
|
+
AllowIfMethodIsEmpty: true
|
423
|
+
|
424
|
+
Style/StringLiterals:
|
425
|
+
EnforcedStyle: double_quotes
|
426
|
+
SupportedStyles:
|
427
|
+
- single_quotes
|
428
|
+
- double_quotes
|
429
|
+
|
430
|
+
Style/StringLiteralsInInterpolation:
|
431
|
+
EnforcedStyle: single_quotes
|
432
|
+
SupportedStyles:
|
433
|
+
- single_quotes
|
434
|
+
- double_quotes
|
435
|
+
|
436
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
437
|
+
EnforcedStyle: space
|
438
|
+
SupportedStyles:
|
439
|
+
- space
|
440
|
+
- no_space
|
441
|
+
|
442
|
+
Style/SpaceBeforeBlockBraces:
|
443
|
+
EnforcedStyle: space
|
444
|
+
SupportedStyles:
|
445
|
+
- space
|
446
|
+
- no_space
|
447
|
+
|
448
|
+
Style/SpaceInsideBlockBraces:
|
449
|
+
EnforcedStyle: space
|
450
|
+
SupportedStyles:
|
451
|
+
- space
|
452
|
+
- no_space
|
453
|
+
# Valid values are: space, no_space
|
454
|
+
EnforcedStyleForEmptyBraces: no_space
|
455
|
+
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
456
|
+
SpaceBeforeBlockParameters: true
|
457
|
+
|
458
|
+
Style/SpaceInsideHashLiteralBraces:
|
459
|
+
EnforcedStyle: space
|
460
|
+
EnforcedStyleForEmptyBraces: no_space
|
461
|
+
SupportedStyles:
|
462
|
+
- space
|
463
|
+
- no_space
|
464
|
+
|
465
|
+
Style/SymbolProc:
|
466
|
+
# A list of method names to be ignored by the check.
|
467
|
+
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
468
|
+
IgnoredMethods:
|
469
|
+
- respond_to
|
470
|
+
|
471
|
+
Style/SpecialGlobalVars:
|
472
|
+
Enabled: false
|
473
|
+
|
474
|
+
Style/TrailingBlankLines:
|
475
|
+
EnforcedStyle: final_newline
|
476
|
+
SupportedStyles:
|
477
|
+
- final_newline
|
478
|
+
- final_blank_line
|
479
|
+
|
480
|
+
Style/TrailingComma:
|
481
|
+
# If EnforcedStyleForMultiline is comma, the cop allows a comma after the
|
482
|
+
# last item of a list, but only for lists where each item is on its own line.
|
483
|
+
EnforcedStyleForMultiline: no_comma
|
484
|
+
SupportedStyles:
|
485
|
+
- comma
|
486
|
+
- no_comma
|
487
|
+
|
488
|
+
# TrivialAccessors doesn't require exact name matches and doesn't allow
|
489
|
+
# predicated methods by default.
|
490
|
+
Style/TrivialAccessors:
|
491
|
+
ExactNameMatch: false
|
492
|
+
AllowPredicates: false
|
493
|
+
# Allows trivial writers that don't end in an equal sign. e.g.
|
494
|
+
#
|
495
|
+
# def on_exception(action)
|
496
|
+
# @on_exception=action
|
497
|
+
# end
|
498
|
+
# on_exception :restart
|
499
|
+
#
|
500
|
+
# Commonly used in DSLs
|
501
|
+
AllowDSLWriters: false
|
502
|
+
Whitelist:
|
503
|
+
- to_ary
|
504
|
+
- to_a
|
505
|
+
- to_c
|
506
|
+
- to_enum
|
507
|
+
- to_h
|
508
|
+
- to_hash
|
509
|
+
- to_i
|
510
|
+
- to_int
|
511
|
+
- to_io
|
512
|
+
- to_open
|
513
|
+
- to_path
|
514
|
+
- to_proc
|
515
|
+
- to_r
|
516
|
+
- to_regexp
|
517
|
+
- to_str
|
518
|
+
- to_s
|
519
|
+
- to_sym
|
520
|
+
|
521
|
+
Style/VariableName:
|
522
|
+
EnforcedStyle: snake_case
|
523
|
+
SupportedStyles:
|
524
|
+
- snake_case
|
525
|
+
- camelCase
|
526
|
+
|
527
|
+
Style/WhileUntilModifier:
|
528
|
+
Enabled: false
|
529
|
+
MaxLineLength: 80
|
530
|
+
|
531
|
+
Style/WordArray:
|
532
|
+
MinSize: 0
|
533
|
+
# The regular expression WordRegex decides what is considered a word.
|
534
|
+
WordRegex: !ruby/regexp '/\A[\p{Word}]+\z/'
|
535
|
+
|
536
|
+
##################### Metrics ##################################
|
537
|
+
|
538
|
+
Metrics/BlockNesting:
|
539
|
+
Max: 2
|
540
|
+
|
541
|
+
Metrics/ClassLength:
|
542
|
+
CountComments: false # count full line comments?
|
543
|
+
Max: 100
|
544
|
+
|
545
|
+
# Avoid complex methods.
|
546
|
+
Metrics/CyclomaticComplexity:
|
547
|
+
Max: 6
|
548
|
+
|
549
|
+
Metrics/LineLength:
|
550
|
+
Max: 120
|
551
|
+
AllowURI: true
|
552
|
+
URISchemes:
|
553
|
+
- http
|
554
|
+
- https
|
555
|
+
|
556
|
+
Metrics/MethodLength:
|
557
|
+
CountComments: false # count full line comments?
|
558
|
+
Max: 16
|
559
|
+
|
560
|
+
Metrics/ParameterLists:
|
561
|
+
Max: 5
|
562
|
+
CountKeywordArgs: true
|
563
|
+
|
564
|
+
Metrics/PerceivedComplexity:
|
565
|
+
Max: 7
|
566
|
+
|
567
|
+
##################### Lint ##################################
|
568
|
+
|
569
|
+
# Allow safe assignment in conditions.
|
570
|
+
Lint/AssignmentInCondition:
|
571
|
+
AllowSafeAssignment: true
|
572
|
+
|
573
|
+
# Align ends correctly.
|
574
|
+
Lint/EndAlignment:
|
575
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
576
|
+
# keyword (if, while, etc.).
|
577
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
578
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
579
|
+
# situations, `end` should still be aligned with the keyword.
|
580
|
+
AlignWith: keyword
|
581
|
+
SupportedStyles:
|
582
|
+
- keyword
|
583
|
+
- variable
|
584
|
+
|
585
|
+
Lint/DefEndAlignment:
|
586
|
+
# The value `def` means that `end` should be aligned with the def keyword.
|
587
|
+
# The value `start_of_line` means that `end` should be aligned with method
|
588
|
+
# calls like `private`, `public`, etc, if present in front of the `def`
|
589
|
+
# keyword on the same line.
|
590
|
+
AlignWith: start_of_line
|
591
|
+
SupportedStyles:
|
592
|
+
- start_of_line
|
593
|
+
- def
|