netdot-restclient 1.4 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rubocop-bbatsov-default.yml +720 -0
- data/.rubocop-bbatsov-disabled.yml +50 -0
- data/.rubocop-bbatsov-enabled.yml +1030 -0
- data/.rubocop.yml +720 -0
- data/README.md +2 -0
- data/Rakefile +7 -1
- data/lib/netdot.rb +5 -4
- data/lib/netdot/host.rb +32 -26
- data/lib/netdot/ipblock.rb +118 -0
- data/lib/netdot/restclient.rb +76 -106
- data/lib/netdot/restclient/version.rb +3 -2
- data/netdot-restclient.gemspec +13 -14
- data/sample/sample.rb +43 -0
- data/spec/host_spec.rb +21 -22
- data/spec/ipblock_spec.rb +108 -0
- data/spec/restclient_spec.rb +34 -46
- data/spec/spec_helper.rb +1 -1
- metadata +22 -42
- data/lib/netdot/subnet.rb +0 -107
- data/sample/host.rb +0 -36
- data/spec/subnet_spec.rb +0 -46
data/.rubocop.yml
ADDED
@@ -0,0 +1,720 @@
|
|
1
|
+
# This is the default configuration file. Enabling and disabling is configured
|
2
|
+
# in separate files. This file adds all other parameters apart from Enabled.
|
3
|
+
|
4
|
+
inherit_from:
|
5
|
+
- .rubocop-bbatsov-enabled.yml
|
6
|
+
- .rubocop-bbatsov-disabled.yml
|
7
|
+
|
8
|
+
# Common configuration.
|
9
|
+
AllCops:
|
10
|
+
# Include gemspec and Rakefile
|
11
|
+
Include:
|
12
|
+
- '**/*.gemspec'
|
13
|
+
- '**/*.podspec'
|
14
|
+
- '**/*.jbuilder'
|
15
|
+
- '**/*.rake'
|
16
|
+
- '**/*.opal'
|
17
|
+
- '**/Gemfile'
|
18
|
+
- '**/Rakefile'
|
19
|
+
- '**/Capfile'
|
20
|
+
- '**/Guardfile'
|
21
|
+
- '**/Podfile'
|
22
|
+
- '**/Thorfile'
|
23
|
+
- '**/Vagrantfile'
|
24
|
+
- '**/Berksfile'
|
25
|
+
- '**/Cheffile'
|
26
|
+
- '**/Vagabondfile'
|
27
|
+
Exclude:
|
28
|
+
- 'vendor/**/*'
|
29
|
+
# By default, the rails cops are not run. Override in project or home
|
30
|
+
# directory .rubocop.yml files, or by giving the -R/--rails option.
|
31
|
+
RunRailsCops: false
|
32
|
+
# Cop names are not displayed in offense messages by default. Change behavior
|
33
|
+
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
|
34
|
+
# option.
|
35
|
+
DisplayCopNames: false
|
36
|
+
# Style guide URLs are not displayed in offense messages by default. Change
|
37
|
+
# behavior by overriding DisplayStyleGuide, or by giving the
|
38
|
+
# -S/--display-style-guide option.
|
39
|
+
DisplayStyleGuide: false
|
40
|
+
# Additional cops that do not reference a style guide rule may be enabled by
|
41
|
+
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
|
42
|
+
# the --only-guide-cops option.
|
43
|
+
StyleGuideCopsOnly: false
|
44
|
+
|
45
|
+
# Indent private/protected/public as deep as method definitions
|
46
|
+
Style/AccessModifierIndentation:
|
47
|
+
EnforcedStyle: indent
|
48
|
+
SupportedStyles:
|
49
|
+
- outdent
|
50
|
+
- indent
|
51
|
+
|
52
|
+
# Align the elements of a hash literal if they span more than one line.
|
53
|
+
Style/AlignHash:
|
54
|
+
# Alignment of entries using hash rocket as separator. Valid values are:
|
55
|
+
#
|
56
|
+
# key - left alignment of keys
|
57
|
+
# 'a' => 2
|
58
|
+
# 'bb' => 3
|
59
|
+
# separator - alignment of hash rockets, keys are right aligned
|
60
|
+
# 'a' => 2
|
61
|
+
# 'bb' => 3
|
62
|
+
# table - left alignment of keys, hash rockets, and values
|
63
|
+
# 'a' => 2
|
64
|
+
# 'bb' => 3
|
65
|
+
EnforcedHashRocketStyle: key
|
66
|
+
# Alignment of entries using colon as separator. Valid values are:
|
67
|
+
#
|
68
|
+
# key - left alignment of keys
|
69
|
+
# a: 0
|
70
|
+
# bb: 1
|
71
|
+
# separator - alignment of colons, keys are right aligned
|
72
|
+
# a: 0
|
73
|
+
# bb: 1
|
74
|
+
# table - left alignment of keys and values
|
75
|
+
# a: 0
|
76
|
+
# bb: 1
|
77
|
+
EnforcedColonStyle: key
|
78
|
+
# Select whether hashes that are the last argument in a method call should be
|
79
|
+
# inspected? Valid values are:
|
80
|
+
#
|
81
|
+
# always_inspect - Inspect both implicit and explicit hashes.
|
82
|
+
# Registers an offense for:
|
83
|
+
# function(a: 1,
|
84
|
+
# b: 2)
|
85
|
+
# Registers an offense for:
|
86
|
+
# function({a: 1,
|
87
|
+
# b: 2})
|
88
|
+
# always_ignore - Ignore both implicit and explicit hashes.
|
89
|
+
# Accepts:
|
90
|
+
# function(a: 1,
|
91
|
+
# b: 2)
|
92
|
+
# Accepts:
|
93
|
+
# function({a: 1,
|
94
|
+
# b: 2})
|
95
|
+
# ignore_implicit - Ignore only implicit hashes.
|
96
|
+
# Accepts:
|
97
|
+
# function(a: 1,
|
98
|
+
# b: 2)
|
99
|
+
# Registers an offense for:
|
100
|
+
# function({a: 1,
|
101
|
+
# b: 2})
|
102
|
+
# ignore_explicit - Ignore only explicit hashes.
|
103
|
+
# Accepts:
|
104
|
+
# function({a: 1,
|
105
|
+
# b: 2})
|
106
|
+
# Registers an offense for:
|
107
|
+
# function(a: 1,
|
108
|
+
# b: 2)
|
109
|
+
EnforcedLastArgumentHashStyle: always_inspect
|
110
|
+
SupportedLastArgumentHashStyles:
|
111
|
+
- always_inspect
|
112
|
+
- always_ignore
|
113
|
+
- ignore_implicit
|
114
|
+
- ignore_explicit
|
115
|
+
|
116
|
+
Style/AlignParameters:
|
117
|
+
# Alignment of parameters in multi-line method calls.
|
118
|
+
#
|
119
|
+
# The `with_first_parameter` style aligns the following lines along the same
|
120
|
+
# column as the first parameter.
|
121
|
+
#
|
122
|
+
# method_call(a,
|
123
|
+
# b)
|
124
|
+
#
|
125
|
+
# The `with_fixed_indentation` style aligns the following lines with one
|
126
|
+
# level of indentation relative to the start of the line with the method call.
|
127
|
+
#
|
128
|
+
# method_call(a,
|
129
|
+
# b)
|
130
|
+
EnforcedStyle: with_first_parameter
|
131
|
+
SupportedStyles:
|
132
|
+
- with_first_parameter
|
133
|
+
- with_fixed_indentation
|
134
|
+
|
135
|
+
Style/AndOr:
|
136
|
+
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
137
|
+
# or completely (always).
|
138
|
+
EnforcedStyle: always
|
139
|
+
SupportedStyles:
|
140
|
+
- always
|
141
|
+
- conditionals
|
142
|
+
|
143
|
+
|
144
|
+
# Checks if usage of %() or %Q() matches configuration.
|
145
|
+
Style/BarePercentLiterals:
|
146
|
+
EnforcedStyle: bare_percent
|
147
|
+
SupportedStyles:
|
148
|
+
- percent_q
|
149
|
+
- bare_percent
|
150
|
+
|
151
|
+
Style/BracesAroundHashParameters:
|
152
|
+
EnforcedStyle: no_braces
|
153
|
+
SupportedStyles:
|
154
|
+
# The `braces` style enforces braces around all method parameters that are
|
155
|
+
# hashes.
|
156
|
+
- braces
|
157
|
+
# The `no_braces` style checks that the last parameter doesn't have braces
|
158
|
+
# around it.
|
159
|
+
- no_braces
|
160
|
+
# The `context_dependent` style checks that the last parameter doesn't have
|
161
|
+
# braces around it, but requires braces if the second to last parameter is
|
162
|
+
# also a hash literal.
|
163
|
+
- context_dependent
|
164
|
+
|
165
|
+
# Indentation of `when`.
|
166
|
+
Style/CaseIndentation:
|
167
|
+
IndentWhenRelativeTo: case
|
168
|
+
SupportedStyles:
|
169
|
+
- case
|
170
|
+
- end
|
171
|
+
IndentOneStep: false
|
172
|
+
|
173
|
+
Style/ClassAndModuleChildren:
|
174
|
+
# Checks the style of children definitions at classes and modules.
|
175
|
+
#
|
176
|
+
# Basically there are two different styles:
|
177
|
+
#
|
178
|
+
# `nested` - have each child on a separate line
|
179
|
+
# class Foo
|
180
|
+
# class Bar
|
181
|
+
# end
|
182
|
+
# end
|
183
|
+
#
|
184
|
+
# `compact` - combine definitions as much as possible
|
185
|
+
# class Foo::Bar
|
186
|
+
# end
|
187
|
+
#
|
188
|
+
# The compact style is only forced, for classes / modules with one child.
|
189
|
+
EnforcedStyle: nested
|
190
|
+
SupportedStyles:
|
191
|
+
- nested
|
192
|
+
- compact
|
193
|
+
|
194
|
+
Style/ClassCheck:
|
195
|
+
EnforcedStyle: is_a?
|
196
|
+
SupportedStyles:
|
197
|
+
- is_a?
|
198
|
+
- kind_of?
|
199
|
+
|
200
|
+
# Align with the style guide.
|
201
|
+
Style/CollectionMethods:
|
202
|
+
# Mapping from undesired method to desired_method
|
203
|
+
# e.g. to use `detect` over `find`:
|
204
|
+
#
|
205
|
+
# CollectionMethods:
|
206
|
+
# PreferredMethods:
|
207
|
+
# find: detect
|
208
|
+
PreferredMethods:
|
209
|
+
collect: 'map'
|
210
|
+
collect!: 'map!'
|
211
|
+
inject: 'reduce'
|
212
|
+
detect: 'find'
|
213
|
+
find_all: 'select'
|
214
|
+
|
215
|
+
# Checks formatting of special comments
|
216
|
+
Style/CommentAnnotation:
|
217
|
+
Keywords:
|
218
|
+
- TODO
|
219
|
+
- FIXME
|
220
|
+
- OPTIMIZE
|
221
|
+
- HACK
|
222
|
+
- REVIEW
|
223
|
+
|
224
|
+
# Multi-line method chaining should be done with leading dots.
|
225
|
+
Style/DotPosition:
|
226
|
+
EnforcedStyle: leading
|
227
|
+
SupportedStyles:
|
228
|
+
- leading
|
229
|
+
- trailing
|
230
|
+
|
231
|
+
# Warn on empty else statements
|
232
|
+
# empty - warn only on empty else
|
233
|
+
# nil - warn on else with nil in it
|
234
|
+
# both - warn on empty else and else with nil in it
|
235
|
+
Style/EmptyElse:
|
236
|
+
EnforcedStyle: both
|
237
|
+
SupportedStyles:
|
238
|
+
- empty
|
239
|
+
- nil
|
240
|
+
- both
|
241
|
+
|
242
|
+
# Use empty lines between defs.
|
243
|
+
Style/EmptyLineBetweenDefs:
|
244
|
+
# If true, this parameter means that single line method definitions don't
|
245
|
+
# need an empty line between them.
|
246
|
+
AllowAdjacentOneLineDefs: false
|
247
|
+
|
248
|
+
Style/EmptyLinesAroundBlockBody:
|
249
|
+
EnforcedStyle: no_empty_lines
|
250
|
+
SupportedStyles:
|
251
|
+
- empty_lines
|
252
|
+
- no_empty_lines
|
253
|
+
|
254
|
+
Style/EmptyLinesAroundClassBody:
|
255
|
+
EnforcedStyle: no_empty_lines
|
256
|
+
SupportedStyles:
|
257
|
+
- empty_lines
|
258
|
+
- no_empty_lines
|
259
|
+
|
260
|
+
Style/EmptyLinesAroundModuleBody:
|
261
|
+
EnforcedStyle: no_empty_lines
|
262
|
+
SupportedStyles:
|
263
|
+
- empty_lines
|
264
|
+
- no_empty_lines
|
265
|
+
|
266
|
+
# Checks whether the source file has a utf-8 encoding comment or not
|
267
|
+
# AutoCorrectEncodingComment must match the regex
|
268
|
+
# /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
|
269
|
+
Style/Encoding:
|
270
|
+
EnforcedStyle: always
|
271
|
+
SupportedStyles:
|
272
|
+
- when_needed
|
273
|
+
- always
|
274
|
+
AutoCorrectEncodingComment: '# encoding: utf-8'
|
275
|
+
|
276
|
+
Style/FileName:
|
277
|
+
# File names listed in AllCops:Include are excluded by default. Add extra
|
278
|
+
# excludes here.
|
279
|
+
Exclude: []
|
280
|
+
|
281
|
+
Style/FirstParameterIndentation:
|
282
|
+
EnforcedStyle: special_for_inner_method_call_in_parentheses
|
283
|
+
SupportedStyles:
|
284
|
+
# The first parameter should always be indented one step more than the
|
285
|
+
# preceding line.
|
286
|
+
- consistent
|
287
|
+
# The first parameter should normally be indented one step more than the
|
288
|
+
# preceding line, but if it's a parameter for a method call that is itself
|
289
|
+
# a parameter in a method call, then the inner parameter should be indented
|
290
|
+
# relative to the inner method.
|
291
|
+
- special_for_inner_method_call
|
292
|
+
# Same as special_for_inner_method_call except that the special rule only
|
293
|
+
# applies if the outer method call encloses its arguments in parentheses.
|
294
|
+
- special_for_inner_method_call_in_parentheses
|
295
|
+
|
296
|
+
# Checks use of for or each in multiline loops.
|
297
|
+
Style/For:
|
298
|
+
EnforcedStyle: each
|
299
|
+
SupportedStyles:
|
300
|
+
- for
|
301
|
+
- each
|
302
|
+
|
303
|
+
# Enforce the method used for string formatting.
|
304
|
+
Style/FormatString:
|
305
|
+
EnforcedStyle: format
|
306
|
+
SupportedStyles:
|
307
|
+
- format
|
308
|
+
- sprintf
|
309
|
+
- percent
|
310
|
+
|
311
|
+
# Built-in global variables are allowed by default.
|
312
|
+
Style/GlobalVars:
|
313
|
+
AllowedVariables: []
|
314
|
+
|
315
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
316
|
+
# needs to have to trigger this cop
|
317
|
+
Style/GuardClause:
|
318
|
+
MinBodyLength: 1
|
319
|
+
|
320
|
+
Style/HashSyntax:
|
321
|
+
EnforcedStyle: ruby19
|
322
|
+
SupportedStyles:
|
323
|
+
- ruby19
|
324
|
+
- ruby19_no_mixed_keys
|
325
|
+
- hash_rockets
|
326
|
+
# Force hashes that have a symbol value to use hash rockets
|
327
|
+
UseHashRocketsWithSymbolValues: false
|
328
|
+
|
329
|
+
Style/IfUnlessModifier:
|
330
|
+
MaxLineLength: 80
|
331
|
+
|
332
|
+
Style/IndentationWidth:
|
333
|
+
# Number of spaces for each indentation level.
|
334
|
+
Width: 2
|
335
|
+
|
336
|
+
# Checks the indentation of the first key in a hash literal.
|
337
|
+
Style/IndentHash:
|
338
|
+
# The value `special_inside_parentheses` means that hash literals with braces
|
339
|
+
# that have their opening brace on the same line as a surrounding opening
|
340
|
+
# round parenthesis, shall have their first key indented relative to the
|
341
|
+
# first position inside the parenthesis.
|
342
|
+
# The value `consistent` means that the indentation of the first key shall
|
343
|
+
# always be relative to the first position of the line where the opening
|
344
|
+
# brace is.
|
345
|
+
EnforcedStyle: special_inside_parentheses
|
346
|
+
SupportedStyles:
|
347
|
+
- special_inside_parentheses
|
348
|
+
- consistent
|
349
|
+
|
350
|
+
Style/LambdaCall:
|
351
|
+
EnforcedStyle: call
|
352
|
+
SupportedStyles:
|
353
|
+
- call
|
354
|
+
- braces
|
355
|
+
|
356
|
+
Style/Next:
|
357
|
+
# With `always` all conditions at the end of an iteration needs to be
|
358
|
+
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
359
|
+
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
360
|
+
EnforcedStyle: skip_modifier_ifs
|
361
|
+
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
362
|
+
# needs to have to trigger this cop
|
363
|
+
MinBodyLength: 3
|
364
|
+
SupportedStyles:
|
365
|
+
- skip_modifier_ifs
|
366
|
+
- always
|
367
|
+
|
368
|
+
Style/NonNilCheck:
|
369
|
+
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
370
|
+
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
371
|
+
# **usually** OK, but might change behavior.
|
372
|
+
#
|
373
|
+
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
374
|
+
# offenses for `!x.nil?` and does no changes that might change behavior.
|
375
|
+
IncludeSemanticChanges: false
|
376
|
+
|
377
|
+
Style/MethodDefParentheses:
|
378
|
+
EnforcedStyle: require_parentheses
|
379
|
+
SupportedStyles:
|
380
|
+
- require_parentheses
|
381
|
+
- require_no_parentheses
|
382
|
+
|
383
|
+
Style/MethodName:
|
384
|
+
EnforcedStyle: snake_case
|
385
|
+
SupportedStyles:
|
386
|
+
- snake_case
|
387
|
+
- camelCase
|
388
|
+
|
389
|
+
Style/MultilineOperationIndentation:
|
390
|
+
EnforcedStyle: aligned
|
391
|
+
SupportedStyles:
|
392
|
+
- aligned
|
393
|
+
- indented
|
394
|
+
|
395
|
+
Style/NumericLiterals:
|
396
|
+
MinDigits: 5
|
397
|
+
|
398
|
+
# Allow safe assignment in conditions.
|
399
|
+
Style/ParenthesesAroundCondition:
|
400
|
+
AllowSafeAssignment: true
|
401
|
+
|
402
|
+
Style/PercentLiteralDelimiters:
|
403
|
+
PreferredDelimiters:
|
404
|
+
'%': ()
|
405
|
+
'%i': ()
|
406
|
+
'%q': ()
|
407
|
+
'%Q': ()
|
408
|
+
'%r': '{}'
|
409
|
+
'%s': ()
|
410
|
+
'%w': ()
|
411
|
+
'%W': ()
|
412
|
+
'%x': ()
|
413
|
+
|
414
|
+
Style/PercentQLiterals:
|
415
|
+
EnforcedStyle: lower_case_q
|
416
|
+
SupportedStyles:
|
417
|
+
- lower_case_q # Use %q when possible, %Q when necessary
|
418
|
+
- upper_case_q # Always use %Q
|
419
|
+
|
420
|
+
Style/PredicateName:
|
421
|
+
# Predicate name prefices.
|
422
|
+
NamePrefix:
|
423
|
+
- is_
|
424
|
+
- has_
|
425
|
+
- have_
|
426
|
+
# Predicate name prefices that should be removed.
|
427
|
+
NamePrefixBlacklist:
|
428
|
+
- is_
|
429
|
+
- has_
|
430
|
+
- have_
|
431
|
+
|
432
|
+
Style/RaiseArgs:
|
433
|
+
EnforcedStyle: exploded
|
434
|
+
SupportedStyles:
|
435
|
+
- compact # raise Exception.new(msg)
|
436
|
+
- exploded # raise Exception, msg
|
437
|
+
|
438
|
+
Style/RedundantReturn:
|
439
|
+
# When true allows code like `return x, y`.
|
440
|
+
AllowMultipleReturnValues: false
|
441
|
+
|
442
|
+
Style/RegexpLiteral:
|
443
|
+
# The maximum number of (escaped) slashes that a slash-delimited regexp is
|
444
|
+
# allowed to have. If there are more slashes, a %r regexp shall be used.
|
445
|
+
MaxSlashes: 1
|
446
|
+
|
447
|
+
Style/Semicolon:
|
448
|
+
# Allow ; to separate several expressions on the same line.
|
449
|
+
AllowAsExpressionSeparator: false
|
450
|
+
|
451
|
+
Style/SignalException:
|
452
|
+
EnforcedStyle: semantic
|
453
|
+
SupportedStyles:
|
454
|
+
- only_raise
|
455
|
+
- only_fail
|
456
|
+
- semantic
|
457
|
+
|
458
|
+
Style/SingleLineBlockParams:
|
459
|
+
Methods:
|
460
|
+
- reduce:
|
461
|
+
- a
|
462
|
+
- e
|
463
|
+
- inject:
|
464
|
+
- a
|
465
|
+
- e
|
466
|
+
|
467
|
+
Style/SingleLineMethods:
|
468
|
+
AllowIfMethodIsEmpty: true
|
469
|
+
|
470
|
+
Style/StringLiterals:
|
471
|
+
EnforcedStyle: single_quotes
|
472
|
+
SupportedStyles:
|
473
|
+
- single_quotes
|
474
|
+
- double_quotes
|
475
|
+
|
476
|
+
Style/StringLiteralsInInterpolation:
|
477
|
+
EnforcedStyle: single_quotes
|
478
|
+
SupportedStyles:
|
479
|
+
- single_quotes
|
480
|
+
- double_quotes
|
481
|
+
|
482
|
+
Style/SpaceAroundBlockParameters:
|
483
|
+
EnforcedStyleInsidePipes: no_space
|
484
|
+
SupportedStyles:
|
485
|
+
- space
|
486
|
+
- no_space
|
487
|
+
|
488
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
489
|
+
EnforcedStyle: space
|
490
|
+
SupportedStyles:
|
491
|
+
- space
|
492
|
+
- no_space
|
493
|
+
|
494
|
+
Style/SpaceAroundOperators:
|
495
|
+
MultiSpaceAllowedForOperators:
|
496
|
+
- '='
|
497
|
+
- '=>'
|
498
|
+
|
499
|
+
Style/SpaceBeforeBlockBraces:
|
500
|
+
EnforcedStyle: space
|
501
|
+
SupportedStyles:
|
502
|
+
- space
|
503
|
+
- no_space
|
504
|
+
|
505
|
+
Style/SpaceInsideBlockBraces:
|
506
|
+
EnforcedStyle: space
|
507
|
+
SupportedStyles:
|
508
|
+
- space
|
509
|
+
- no_space
|
510
|
+
# Valid values are: space, no_space
|
511
|
+
EnforcedStyleForEmptyBraces: no_space
|
512
|
+
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
513
|
+
SpaceBeforeBlockParameters: true
|
514
|
+
|
515
|
+
Style/SpaceInsideHashLiteralBraces:
|
516
|
+
EnforcedStyle: space
|
517
|
+
EnforcedStyleForEmptyBraces: no_space
|
518
|
+
SupportedStyles:
|
519
|
+
- space
|
520
|
+
- no_space
|
521
|
+
|
522
|
+
Style/SymbolProc:
|
523
|
+
# A list of method names to be ignored by the check.
|
524
|
+
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
525
|
+
IgnoredMethods:
|
526
|
+
- respond_to
|
527
|
+
|
528
|
+
Style/TrailingBlankLines:
|
529
|
+
EnforcedStyle: final_newline
|
530
|
+
SupportedStyles:
|
531
|
+
- final_newline
|
532
|
+
- final_blank_line
|
533
|
+
|
534
|
+
Style/TrailingComma:
|
535
|
+
# If EnforcedStyleForMultiline is comma, the cop requires a comma after the
|
536
|
+
# last item of a list, but only for lists where each item is on its own line.
|
537
|
+
# If EnforcedStyleForMultiline is consistent_comma, the cop requires a comma
|
538
|
+
# after the last item of a list, for all lists.
|
539
|
+
EnforcedStyleForMultiline: no_comma
|
540
|
+
SupportedStyles:
|
541
|
+
- comma
|
542
|
+
- consistent_comma
|
543
|
+
- no_comma
|
544
|
+
|
545
|
+
# TrivialAccessors doesn't require exact name matches and doesn't allow
|
546
|
+
# predicated methods by default.
|
547
|
+
Style/TrivialAccessors:
|
548
|
+
ExactNameMatch: false
|
549
|
+
AllowPredicates: false
|
550
|
+
# Allows trivial writers that don't end in an equal sign. e.g.
|
551
|
+
#
|
552
|
+
# def on_exception(action)
|
553
|
+
# @on_exception=action
|
554
|
+
# end
|
555
|
+
# on_exception :restart
|
556
|
+
#
|
557
|
+
# Commonly used in DSLs
|
558
|
+
AllowDSLWriters: false
|
559
|
+
IgnoreClassMethods: false
|
560
|
+
Whitelist:
|
561
|
+
- to_ary
|
562
|
+
- to_a
|
563
|
+
- to_c
|
564
|
+
- to_enum
|
565
|
+
- to_h
|
566
|
+
- to_hash
|
567
|
+
- to_i
|
568
|
+
- to_int
|
569
|
+
- to_io
|
570
|
+
- to_open
|
571
|
+
- to_path
|
572
|
+
- to_proc
|
573
|
+
- to_r
|
574
|
+
- to_regexp
|
575
|
+
- to_str
|
576
|
+
- to_s
|
577
|
+
- to_sym
|
578
|
+
|
579
|
+
Style/VariableName:
|
580
|
+
EnforcedStyle: snake_case
|
581
|
+
SupportedStyles:
|
582
|
+
- snake_case
|
583
|
+
- camelCase
|
584
|
+
|
585
|
+
Style/WhileUntilModifier:
|
586
|
+
MaxLineLength: 80
|
587
|
+
|
588
|
+
Style/WordArray:
|
589
|
+
MinSize: 0
|
590
|
+
# The regular expression WordRegex decides what is considered a word.
|
591
|
+
WordRegex: !ruby/regexp '/\A[\p{Word}]+\z/'
|
592
|
+
|
593
|
+
##################### Metrics ##################################
|
594
|
+
|
595
|
+
Metrics/AbcSize:
|
596
|
+
# The ABC size is a calculated magnitude, so this number can be a Fixnum or
|
597
|
+
# a Float.
|
598
|
+
Max: 50 # 15
|
599
|
+
|
600
|
+
Metrics/BlockNesting:
|
601
|
+
Max: 3
|
602
|
+
|
603
|
+
Metrics/ClassLength:
|
604
|
+
CountComments: false # count full line comments?
|
605
|
+
Max: 100
|
606
|
+
|
607
|
+
# Avoid complex methods.
|
608
|
+
Metrics/CyclomaticComplexity:
|
609
|
+
Max: 18 # 6
|
610
|
+
|
611
|
+
Metrics/LineLength:
|
612
|
+
Max: 80
|
613
|
+
# To make it possible to copy or click on URIs in the code, we allow lines
|
614
|
+
# contaning a URI to be longer than Max.
|
615
|
+
AllowURI: true
|
616
|
+
URISchemes:
|
617
|
+
- http
|
618
|
+
- https
|
619
|
+
|
620
|
+
Metrics/MethodLength:
|
621
|
+
CountComments: false # count full line comments?
|
622
|
+
Max: 100 # 10
|
623
|
+
|
624
|
+
Metrics/ParameterLists:
|
625
|
+
Max: 5
|
626
|
+
CountKeywordArgs: true
|
627
|
+
|
628
|
+
Metrics/PerceivedComplexity:
|
629
|
+
Max: 20 # 7
|
630
|
+
|
631
|
+
##################### Lint ##################################
|
632
|
+
|
633
|
+
# Allow safe assignment in conditions.
|
634
|
+
Lint/AssignmentInCondition:
|
635
|
+
AllowSafeAssignment: true
|
636
|
+
|
637
|
+
# Align ends correctly.
|
638
|
+
Lint/EndAlignment:
|
639
|
+
# The value `keyword` means that `end` should be aligned with the matching
|
640
|
+
# keyword (if, while, etc.).
|
641
|
+
# The value `variable` means that in assignments, `end` should be aligned
|
642
|
+
# with the start of the variable on the left hand side of `=`. In all other
|
643
|
+
# situations, `end` should still be aligned with the keyword.
|
644
|
+
AlignWith: keyword
|
645
|
+
SupportedStyles:
|
646
|
+
- keyword
|
647
|
+
- variable
|
648
|
+
|
649
|
+
Lint/DefEndAlignment:
|
650
|
+
# The value `def` means that `end` should be aligned with the def keyword.
|
651
|
+
# The value `start_of_line` means that `end` should be aligned with method
|
652
|
+
# calls like `private`, `public`, etc, if present in front of the `def`
|
653
|
+
# keyword on the same line.
|
654
|
+
AlignWith: start_of_line
|
655
|
+
SupportedStyles:
|
656
|
+
- start_of_line
|
657
|
+
- def
|
658
|
+
|
659
|
+
##################### Rails ##################################
|
660
|
+
|
661
|
+
Rails/ActionFilter:
|
662
|
+
EnforcedStyle: action
|
663
|
+
SupportedStyles:
|
664
|
+
- action
|
665
|
+
- filter
|
666
|
+
Include:
|
667
|
+
- app/controllers/**/*.rb
|
668
|
+
|
669
|
+
Rails/Date:
|
670
|
+
# The value `always` disallows usage of `Date.today`, `Date.current`,
|
671
|
+
# `Date#to_time` etc.
|
672
|
+
# The value `acceptable` allows usage of `Date.current`, `Date.yesterday`, etc
|
673
|
+
# (but not `Date.today`) which are overriden by ActiveSupport to handle current
|
674
|
+
# time zone.
|
675
|
+
EnforcedStyle: always
|
676
|
+
SupportedStyles:
|
677
|
+
- always
|
678
|
+
- acceptable
|
679
|
+
|
680
|
+
Rails/DefaultScope:
|
681
|
+
Include:
|
682
|
+
- app/models/**/*.rb
|
683
|
+
|
684
|
+
Rails/HasAndBelongsToMany:
|
685
|
+
Include:
|
686
|
+
- app/models/**/*.rb
|
687
|
+
|
688
|
+
Rails/Output:
|
689
|
+
Include:
|
690
|
+
- app/**/*.rb
|
691
|
+
- config/**/*.rb
|
692
|
+
- db/**/*.rb
|
693
|
+
- lib/**/*.rb
|
694
|
+
|
695
|
+
Rails/ReadWriteAttribute:
|
696
|
+
Include:
|
697
|
+
- app/models/**/*.rb
|
698
|
+
|
699
|
+
Rails/ScopeArgs:
|
700
|
+
Include:
|
701
|
+
- app/models/**/*.rb
|
702
|
+
|
703
|
+
Rails/TimeZone:
|
704
|
+
# The value `always` means that `Time` should be used with `zone`.
|
705
|
+
# The value `acceptable` allows usage of `in_time_zone` instead of `zone`.
|
706
|
+
EnforcedStyle: always
|
707
|
+
SupportedStyles:
|
708
|
+
- always
|
709
|
+
- acceptable
|
710
|
+
|
711
|
+
Rails/Validation:
|
712
|
+
Include:
|
713
|
+
- app/models/**/*.rb
|
714
|
+
|
715
|
+
##################### Performance ##################################
|
716
|
+
|
717
|
+
Performance/Detect:
|
718
|
+
# Defines what method to use instead of `select.first`, e.g.
|
719
|
+
# `detect` or `find`.
|
720
|
+
PreferredMethod: detect
|