moose-inventory 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +0 -0
  3. data/.gitignore +17 -0
  4. data/.rubocop.yml +793 -0
  5. data/Gemfile +3 -0
  6. data/Guardfile +38 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +31 -0
  9. data/README.md.orig +35 -0
  10. data/Rakefile +1 -0
  11. data/bin/moose_inventory +10 -0
  12. data/config/dotfiles/coveralls.yml +0 -0
  13. data/config/dotfiles/gitignore +17 -0
  14. data/config/dotfiles/rubocop.yml +793 -0
  15. data/lib/moose/inventory/cli/application.rb +30 -0
  16. data/lib/moose/inventory/cli/formatter.rb +92 -0
  17. data/lib/moose/inventory/cli/group.rb +23 -0
  18. data/lib/moose/inventory/cli/group_add.rb +98 -0
  19. data/lib/moose/inventory/cli/group_addchild.rb +21 -0
  20. data/lib/moose/inventory/cli/group_addhost.rb +97 -0
  21. data/lib/moose/inventory/cli/group_addvar.rb +72 -0
  22. data/lib/moose/inventory/cli/group_get.rb +52 -0
  23. data/lib/moose/inventory/cli/group_list.rb +41 -0
  24. data/lib/moose/inventory/cli/group_rm.rb +77 -0
  25. data/lib/moose/inventory/cli/group_rmchild.rb +20 -0
  26. data/lib/moose/inventory/cli/group_rmhost.rb +89 -0
  27. data/lib/moose/inventory/cli/group_rmvar.rb +65 -0
  28. data/lib/moose/inventory/cli/host.rb +24 -0
  29. data/lib/moose/inventory/cli/host_add.rb +93 -0
  30. data/lib/moose/inventory/cli/host_addgroup.rb +88 -0
  31. data/lib/moose/inventory/cli/host_addvar.rb +76 -0
  32. data/lib/moose/inventory/cli/host_get.rb +59 -0
  33. data/lib/moose/inventory/cli/host_list.rb +40 -0
  34. data/lib/moose/inventory/cli/host_rm.rb +62 -0
  35. data/lib/moose/inventory/cli/host_rmgroup.rb +80 -0
  36. data/lib/moose/inventory/cli/host_rmvar.rb +69 -0
  37. data/lib/moose/inventory/config/config.rb +169 -0
  38. data/lib/moose/inventory/db/db.rb +249 -0
  39. data/lib/moose/inventory/db/exceptions.rb +14 -0
  40. data/lib/moose/inventory/db/models.rb +32 -0
  41. data/lib/moose/inventory/moose_inventory_cli.rb +25 -0
  42. data/lib/moose/inventory/version.rb +7 -0
  43. data/moose-inventory.gemspec +45 -0
  44. data/scripts/guard_quality.sh +3 -0
  45. data/scripts/guard_test.sh +2 -0
  46. data/scripts/reports.sh +4 -0
  47. data/spec/config/config.yml +12 -0
  48. data/spec/lib/moose/inventory/cli/application_spec.rb +15 -0
  49. data/spec/lib/moose/inventory/cli/cli_spec.rb +26 -0
  50. data/spec/lib/moose/inventory/cli/formatter_spec.rb +63 -0
  51. data/spec/lib/moose/inventory/cli/group_add_spec.rb +398 -0
  52. data/spec/lib/moose/inventory/cli/group_addhost_spec.rb +251 -0
  53. data/spec/lib/moose/inventory/cli/group_addvar_spec.rb +235 -0
  54. data/spec/lib/moose/inventory/cli/group_get_spec.rb +107 -0
  55. data/spec/lib/moose/inventory/cli/group_list_spec.rb +79 -0
  56. data/spec/lib/moose/inventory/cli/group_rm_spec.rb +191 -0
  57. data/spec/lib/moose/inventory/cli/group_rmhost_spec.rb +215 -0
  58. data/spec/lib/moose/inventory/cli/group_rmvar_spec.rb +202 -0
  59. data/spec/lib/moose/inventory/cli/group_spec.rb +15 -0
  60. data/spec/lib/moose/inventory/cli/host_add_spec.rb +330 -0
  61. data/spec/lib/moose/inventory/cli/host_addgroup_spec.rb +248 -0
  62. data/spec/lib/moose/inventory/cli/host_addvar_spec.rb +233 -0
  63. data/spec/lib/moose/inventory/cli/host_get_spec.rb +106 -0
  64. data/spec/lib/moose/inventory/cli/host_list_spec.rb +83 -0
  65. data/spec/lib/moose/inventory/cli/host_rm_spec.rb +132 -0
  66. data/spec/lib/moose/inventory/cli/host_rmgroup_spec.rb +245 -0
  67. data/spec/lib/moose/inventory/cli/host_rmvar_spec.rb +206 -0
  68. data/spec/lib/moose/inventory/cli/host_spec.rb +12 -0
  69. data/spec/lib/moose/inventory/config/config_spec.rb +80 -0
  70. data/spec/lib/moose/inventory/db/db_spec.rb +184 -0
  71. data/spec/lib/moose/inventory/db/models_spec.rb +150 -0
  72. data/spec/shared/shared_config_setup.rb +21 -0
  73. data/spec/spec_helper.rb +110 -0
  74. metadata +386 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a36d03c6ae89cf795e5a1dc16f8c1e16bdbda490
4
+ data.tar.gz: ee86a42d34057daed117acee49d9dae438f47e17
5
+ SHA512:
6
+ metadata.gz: e8c437c8a1e087066806e02d9feb322b01a21ac534b5b65b754e5d587d2b7c39a7725dea4ebd4e1b89fa6f595adec70bd052601e752455c58bf692f2aaf5e4d7
7
+ data.tar.gz: ca2c9ca3edd55d9000f5d6fe9b2684367f800140f1c6bbd0ada84311cf6079347864d321a922323435b1929ef20eea36c313eb8be5f7eb016dd93d98273a21ba
data/.coveralls.yml ADDED
File without changes
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ .buildpath
16
+ .project
17
+ /coverage/
data/.rubocop.yml ADDED
@@ -0,0 +1,793 @@
1
+ #inherit_from:
2
+ # - enabled.yml
3
+ # - disabled.yml
4
+
5
+ # Common configuration.
6
+ AllCops:
7
+ # Include common Ruby source files.
8
+ Include:
9
+ - '**/*.gemspec'
10
+ - '**/*.podspec'
11
+ - '**/*.jbuilder'
12
+ - '**/*.rake'
13
+ - '**/*.opal'
14
+ - '**/config.ru'
15
+ - '**/Gemfile'
16
+ - '**/Rakefile'
17
+ - '**/Capfile'
18
+ - '**/Guardfile'
19
+ - '**/Podfile'
20
+ - '**/Thorfile'
21
+ - '**/Vagrantfile'
22
+ - '**/Berksfile'
23
+ - '**/Cheffile'
24
+ - '**/Vagabondfile'
25
+ Exclude:
26
+ - 'vendor/**/*'
27
+ # By default, the rails cops are not run. Override in project or home
28
+ # directory .rubocop.yml files, or by giving the -R/--rails option.
29
+ RunRailsCops: false
30
+ # Cop names are not displayed in offense messages by default. Change behavior
31
+ # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
32
+ # option.
33
+ DisplayCopNames: false
34
+ # Style guide URLs are not displayed in offense messages by default. Change
35
+ # behavior by overriding DisplayStyleGuide, or by giving the
36
+ # -S/--display-style-guide option.
37
+ DisplayStyleGuide: false
38
+ # Additional cops that do not reference a style guide rule may be enabled by
39
+ # default. Change behavior by overriding StyleGuideCopsOnly, or by giving
40
+ # the --only-guide-cops option.
41
+ StyleGuideCopsOnly: false
42
+
43
+ # Indent private/protected/public as deep as method definitions
44
+ Style/AccessModifierIndentation:
45
+ EnforcedStyle: indent
46
+ SupportedStyles:
47
+ - outdent
48
+ - indent
49
+
50
+ # Align the elements of a hash literal if they span more than one line.
51
+ Style/AlignHash:
52
+ # Alignment of entries using hash rocket as separator. Valid values are:
53
+ #
54
+ # key - left alignment of keys
55
+ # 'a' => 2
56
+ # 'bb' => 3
57
+ # separator - alignment of hash rockets, keys are right aligned
58
+ # 'a' => 2
59
+ # 'bb' => 3
60
+ # table - left alignment of keys, hash rockets, and values
61
+ # 'a' => 2
62
+ # 'bb' => 3
63
+ EnforcedHashRocketStyle: key
64
+ # Alignment of entries using colon as separator. Valid values are:
65
+ #
66
+ # key - left alignment of keys
67
+ # a: 0
68
+ # bb: 1
69
+ # separator - alignment of colons, keys are right aligned
70
+ # a: 0
71
+ # bb: 1
72
+ # table - left alignment of keys and values
73
+ # a: 0
74
+ # bb: 1
75
+ EnforcedColonStyle: key
76
+ # Select whether hashes that are the last argument in a method call should be
77
+ # inspected? Valid values are:
78
+ #
79
+ # always_inspect - Inspect both implicit and explicit hashes.
80
+ # Registers an offense for:
81
+ # function(a: 1,
82
+ # b: 2)
83
+ # Registers an offense for:
84
+ # function({a: 1,
85
+ # b: 2})
86
+ # always_ignore - Ignore both implicit and explicit hashes.
87
+ # Accepts:
88
+ # function(a: 1,
89
+ # b: 2)
90
+ # Accepts:
91
+ # function({a: 1,
92
+ # b: 2})
93
+ # ignore_implicit - Ignore only implicit hashes.
94
+ # Accepts:
95
+ # function(a: 1,
96
+ # b: 2)
97
+ # Registers an offense for:
98
+ # function({a: 1,
99
+ # b: 2})
100
+ # ignore_explicit - Ignore only explicit hashes.
101
+ # Accepts:
102
+ # function({a: 1,
103
+ # b: 2})
104
+ # Registers an offense for:
105
+ # function(a: 1,
106
+ # b: 2)
107
+ EnforcedLastArgumentHashStyle: always_inspect
108
+ SupportedLastArgumentHashStyles:
109
+ - always_inspect
110
+ - always_ignore
111
+ - ignore_implicit
112
+ - ignore_explicit
113
+
114
+ Style/AlignParameters:
115
+ # Alignment of parameters in multi-line method calls.
116
+ #
117
+ # The `with_first_parameter` style aligns the following lines along the same
118
+ # column as the first parameter.
119
+ #
120
+ # method_call(a,
121
+ # b)
122
+ #
123
+ # The `with_fixed_indentation` style aligns the following lines with one
124
+ # level of indentation relative to the start of the line with the method call.
125
+ #
126
+ # method_call(a,
127
+ # b)
128
+ EnforcedStyle: with_first_parameter
129
+ SupportedStyles:
130
+ - with_first_parameter
131
+ - with_fixed_indentation
132
+
133
+ Style/AndOr:
134
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
135
+ # or completely (always).
136
+ EnforcedStyle: always
137
+ SupportedStyles:
138
+ - always
139
+ - conditionals
140
+
141
+
142
+ # Checks if usage of %() or %Q() matches configuration.
143
+ Style/BarePercentLiterals:
144
+ EnforcedStyle: bare_percent
145
+ SupportedStyles:
146
+ - percent_q
147
+ - bare_percent
148
+
149
+ Style/BlockDelimiters:
150
+ EnforcedStyle: line_count_based
151
+ SupportedStyles:
152
+ # The `line_count_based` style enforces braces around single line blocks and
153
+ # do..end around multi-line blocks.
154
+ - line_count_based
155
+ # The `semantic` style enforces braces around functional blocks, where the
156
+ # primary purpose of the block is to return a value and do..end for
157
+ # procedural blocks, where the primary purpose of the block is its
158
+ # side-effects.
159
+ #
160
+ # This looks at the usage of a block's method to determine its type (e.g. is
161
+ # the result of a `map` assigned to a variable or passed to another
162
+ # method) but exceptions are permitted in the `ProceduralMethods`,
163
+ # `FunctionalMethods` and `IgnoredMethods` sections below.
164
+ - semantic
165
+ ProceduralMethods:
166
+ # Methods that are known to be procedural in nature but look functional from
167
+ # their usage, e.g.
168
+ #
169
+ # time = Benchmark.realtime do
170
+ # foo.bar
171
+ # end
172
+ #
173
+ # Here, the return value of the block is discarded but the return value of
174
+ # `Benchmark.realtime` is used.
175
+ - benchmark
176
+ - bm
177
+ - bmbm
178
+ - create
179
+ - each_with_object
180
+ - measure
181
+ - new
182
+ - realtime
183
+ - tap
184
+ - with_object
185
+ FunctionalMethods:
186
+ # Methods that are known to be functional in nature but look procedural from
187
+ # their usage, e.g.
188
+ #
189
+ # let(:foo) { Foo.new }
190
+ #
191
+ # Here, the return value of `Foo.new` is used to define a `foo` helper but
192
+ # doesn't appear to be used from the return value of `let`.
193
+ - let
194
+ - let!
195
+ - subject
196
+ - watch
197
+ IgnoredMethods:
198
+ # Methods that can be either procedural or functional and cannot be
199
+ # categorised from their usage alone, e.g.
200
+ #
201
+ # foo = lambda do |x|
202
+ # puts "Hello, #{x}"
203
+ # end
204
+ #
205
+ # foo = lambda do |x|
206
+ # x * 100
207
+ # end
208
+ #
209
+ # Here, it is impossible to tell from the return value of `lambda` whether
210
+ # the inner block's return value is significant.
211
+ - lambda
212
+ - proc
213
+ - it
214
+
215
+ Style/BracesAroundHashParameters:
216
+ EnforcedStyle: no_braces
217
+ SupportedStyles:
218
+ # The `braces` style enforces braces around all method parameters that are
219
+ # hashes.
220
+ - braces
221
+ # The `no_braces` style checks that the last parameter doesn't have braces
222
+ # around it.
223
+ - no_braces
224
+ # The `context_dependent` style checks that the last parameter doesn't have
225
+ # braces around it, but requires braces if the second to last parameter is
226
+ # also a hash literal.
227
+ - context_dependent
228
+
229
+ # Indentation of `when`.
230
+ Style/CaseIndentation:
231
+ IndentWhenRelativeTo: case
232
+ SupportedStyles:
233
+ - case
234
+ - end
235
+ IndentOneStep: false
236
+
237
+ Style/ClassAndModuleChildren:
238
+ # Checks the style of children definitions at classes and modules.
239
+ #
240
+ # Basically there are two different styles:
241
+ #
242
+ # `nested` - have each child on a separate line
243
+ # class Foo
244
+ # class Bar
245
+ # end
246
+ # end
247
+ #
248
+ # `compact` - combine definitions as much as possible
249
+ # class Foo::Bar
250
+ # end
251
+ #
252
+ # The compact style is only forced, for classes / modules with one child.
253
+ EnforcedStyle: nested
254
+ SupportedStyles:
255
+ - nested
256
+ - compact
257
+
258
+ Style/ClassCheck:
259
+ EnforcedStyle: is_a?
260
+ SupportedStyles:
261
+ - is_a?
262
+ - kind_of?
263
+
264
+ # Align with the style guide.
265
+ Style/CollectionMethods:
266
+ # Mapping from undesired method to desired_method
267
+ # e.g. to use `detect` over `find`:
268
+ #
269
+ # CollectionMethods:
270
+ # PreferredMethods:
271
+ # find: detect
272
+ PreferredMethods:
273
+ collect: 'map'
274
+ collect!: 'map!'
275
+ inject: 'reduce'
276
+ detect: 'find'
277
+ find_all: 'select'
278
+
279
+ # Use ` or %x around command literals.
280
+ Style/CommandLiteral:
281
+ EnforcedStyle: backticks
282
+ # backticks: Always use backticks.
283
+ # percent_x: Always use %x.
284
+ # mixed: Use backticks on single-line commands, and %x on multi-line commands.
285
+ SupportedStyles:
286
+ - backticks
287
+ - percent_x
288
+ - mixed
289
+ # If false, the cop will always recommend using %x if one or more backticks
290
+ # are found in the command string.
291
+ AllowInnerBackticks: false
292
+
293
+ # Checks formatting of special comments
294
+ Style/CommentAnnotation:
295
+ Keywords:
296
+ - TODO
297
+ - FIXME
298
+ - OPTIMIZE
299
+ - HACK
300
+ - REVIEW
301
+
302
+ # Checks that you have put a copyright in a comment before any code.
303
+ #
304
+ # You can override the default Notice in your .rubocop.yml file.
305
+ #
306
+ # In order to use autocorrect, you must supply a value for the
307
+ # AutocorrectNotice key that matches the regexp Notice. A blank
308
+ # AutocorrectNotice will cause an error during autocorrect.
309
+ #
310
+ # Autocorrect will add a copyright notice in a comment at the top
311
+ # of the file immediately after any shebang or encoding comments.
312
+ #
313
+ # Example rubocop.yml:
314
+ #
315
+ # Style/Copyright:
316
+ # Enabled: true
317
+ # Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
318
+ # AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
319
+ #
320
+ Style/Copyright:
321
+ Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
322
+ AutocorrectNotice: 'Copyright (c) 2015 Blakemere Technologies Inc.'
323
+
324
+ # Multi-line method chaining should be done with leading dots.
325
+ Style/DotPosition:
326
+ EnforcedStyle: leading
327
+ SupportedStyles:
328
+ - leading
329
+ - trailing
330
+
331
+ # Warn on empty else statements
332
+ # empty - warn only on empty else
333
+ # nil - warn on else with nil in it
334
+ # both - warn on empty else and else with nil in it
335
+ Style/EmptyElse:
336
+ EnforcedStyle: both
337
+ SupportedStyles:
338
+ - empty
339
+ - nil
340
+ - both
341
+
342
+ # Use empty lines between defs.
343
+ Style/EmptyLineBetweenDefs:
344
+ # If true, this parameter means that single line method definitions don't
345
+ # need an empty line between them.
346
+ AllowAdjacentOneLineDefs: false
347
+
348
+ Style/EmptyLinesAroundBlockBody:
349
+ EnforcedStyle: no_empty_lines
350
+ SupportedStyles:
351
+ - empty_lines
352
+ - no_empty_lines
353
+
354
+ Style/EmptyLinesAroundClassBody:
355
+ EnforcedStyle: no_empty_lines
356
+ SupportedStyles:
357
+ - empty_lines
358
+ - no_empty_lines
359
+
360
+ Style/EmptyLinesAroundModuleBody:
361
+ EnforcedStyle: no_empty_lines
362
+ SupportedStyles:
363
+ - empty_lines
364
+ - no_empty_lines
365
+
366
+ # Checks whether the source file has a utf-8 encoding comment or not
367
+ # AutoCorrectEncodingComment must match the regex
368
+ # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
369
+ Style/Encoding:
370
+ EnforcedStyle: always
371
+ SupportedStyles:
372
+ - when_needed
373
+ - always
374
+ AutoCorrectEncodingComment: '# encoding: utf-8'
375
+
376
+ Style/FileName:
377
+ # File names listed in AllCops:Include are excluded by default. Add extra
378
+ # excludes here.
379
+ Exclude: []
380
+
381
+ Style/FirstParameterIndentation:
382
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
383
+ SupportedStyles:
384
+ # The first parameter should always be indented one step more than the
385
+ # preceding line.
386
+ - consistent
387
+ # The first parameter should normally be indented one step more than the
388
+ # preceding line, but if it's a parameter for a method call that is itself
389
+ # a parameter in a method call, then the inner parameter should be indented
390
+ # relative to the inner method.
391
+ - special_for_inner_method_call
392
+ # Same as special_for_inner_method_call except that the special rule only
393
+ # applies if the outer method call encloses its arguments in parentheses.
394
+ - special_for_inner_method_call_in_parentheses
395
+
396
+ # Checks use of for or each in multiline loops.
397
+ Style/For:
398
+ EnforcedStyle: each
399
+ SupportedStyles:
400
+ - for
401
+ - each
402
+
403
+ # Enforce the method used for string formatting.
404
+ Style/FormatString:
405
+ EnforcedStyle: format
406
+ SupportedStyles:
407
+ - format
408
+ - sprintf
409
+ - percent
410
+
411
+ # Built-in global variables are allowed by default.
412
+ Style/GlobalVars:
413
+ AllowedVariables: []
414
+
415
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
416
+ # needs to have to trigger this cop
417
+ Style/GuardClause:
418
+ MinBodyLength: 1
419
+
420
+ Style/HashSyntax:
421
+ EnforcedStyle: ruby19
422
+ SupportedStyles:
423
+ - ruby19
424
+ - ruby19_no_mixed_keys
425
+ - hash_rockets
426
+ # Force hashes that have a symbol value to use hash rockets
427
+ UseHashRocketsWithSymbolValues: false
428
+
429
+ Style/IfUnlessModifier:
430
+ MaxLineLength: 80
431
+
432
+ Style/IndentationConsistency:
433
+ # The difference between `rails` and `normal` is that the `rails` style
434
+ # prescribes that in classes and modules the `protected` and `private`
435
+ # modifier keywords shall be indented the same as public methods and that
436
+ # protected and private members shall be indented one step more than the
437
+ # modifiers. Other than that, both styles mean that entities on the same
438
+ # logical depth shall have the same indentation.
439
+ EnforcedStyle: normal
440
+ SupportedStyles:
441
+ - normal
442
+ - rails
443
+
444
+ Style/IndentationWidth:
445
+ # Number of spaces for each indentation level.
446
+ Width: 2
447
+
448
+ # Checks the indentation of the first key in a hash literal.
449
+ Style/IndentHash:
450
+ # The value `special_inside_parentheses` means that hash literals with braces
451
+ # that have their opening brace on the same line as a surrounding opening
452
+ # round parenthesis, shall have their first key indented relative to the
453
+ # first position inside the parenthesis.
454
+ # The value `consistent` means that the indentation of the first key shall
455
+ # always be relative to the first position of the line where the opening
456
+ # brace is.
457
+ EnforcedStyle: special_inside_parentheses
458
+ SupportedStyles:
459
+ - special_inside_parentheses
460
+ - consistent
461
+
462
+ Style/LambdaCall:
463
+ EnforcedStyle: call
464
+ SupportedStyles:
465
+ - call
466
+ - braces
467
+
468
+ Style/Next:
469
+ # With `always` all conditions at the end of an iteration needs to be
470
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
471
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
472
+ EnforcedStyle: skip_modifier_ifs
473
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
474
+ # needs to have to trigger this cop
475
+ MinBodyLength: 3
476
+ SupportedStyles:
477
+ - skip_modifier_ifs
478
+ - always
479
+
480
+ Style/NonNilCheck:
481
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
482
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
483
+ # **usually** OK, but might change behavior.
484
+ #
485
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
486
+ # offenses for `!x.nil?` and does no changes that might change behavior.
487
+ IncludeSemanticChanges: false
488
+
489
+ Style/MethodDefParentheses:
490
+ EnforcedStyle: require_parentheses
491
+ SupportedStyles:
492
+ - require_parentheses
493
+ - require_no_parentheses
494
+
495
+ Style/MethodName:
496
+ EnforcedStyle: snake_case
497
+ SupportedStyles:
498
+ - snake_case
499
+ - camelCase
500
+
501
+ Style/MultilineOperationIndentation:
502
+ EnforcedStyle: aligned
503
+ SupportedStyles:
504
+ - aligned
505
+ - indented
506
+
507
+ Style/NumericLiterals:
508
+ MinDigits: 5
509
+
510
+ # Allow safe assignment in conditions.
511
+ Style/ParenthesesAroundCondition:
512
+ AllowSafeAssignment: true
513
+
514
+ Style/PercentLiteralDelimiters:
515
+ PreferredDelimiters:
516
+ '%': ()
517
+ '%i': ()
518
+ '%q': ()
519
+ '%Q': ()
520
+ '%r': '{}'
521
+ '%s': ()
522
+ '%w': ()
523
+ '%W': ()
524
+ '%x': ()
525
+
526
+ Style/PercentQLiterals:
527
+ EnforcedStyle: lower_case_q
528
+ SupportedStyles:
529
+ - lower_case_q # Use %q when possible, %Q when necessary
530
+ - upper_case_q # Always use %Q
531
+
532
+ Style/PredicateName:
533
+ # Predicate name prefices.
534
+ NamePrefix:
535
+ - is_
536
+ - has_
537
+ - have_
538
+ # Predicate name prefices that should be removed.
539
+ NamePrefixBlacklist:
540
+ - is_
541
+ - has_
542
+ - have_
543
+
544
+ Style/RaiseArgs:
545
+ EnforcedStyle: exploded
546
+ SupportedStyles:
547
+ - compact # raise Exception.new(msg)
548
+ - exploded # raise Exception, msg
549
+
550
+ Style/RedundantReturn:
551
+ # When true allows code like `return x, y`.
552
+ AllowMultipleReturnValues: false
553
+
554
+ # Use / or %r around regular expressions.
555
+ Style/RegexpLiteral:
556
+ EnforcedStyle: slashes
557
+ # slashes: Always use slashes.
558
+ # percent_r: Always use %r.
559
+ # mixed: Use slashes on single-line regexes, and %r on multi-line regexes.
560
+ SupportedStyles:
561
+ - slashes
562
+ - percent_r
563
+ - mixed
564
+ # If false, the cop will always recommend using %r if one or more slashes
565
+ # are found in the regexp string.
566
+ AllowInnerSlashes: false
567
+
568
+ Style/Semicolon:
569
+ # Allow ; to separate several expressions on the same line.
570
+ AllowAsExpressionSeparator: false
571
+
572
+ Style/SignalException:
573
+ EnforcedStyle: semantic
574
+ SupportedStyles:
575
+ - only_raise
576
+ - only_fail
577
+ - semantic
578
+
579
+ Style/SingleLineBlockParams:
580
+ Methods:
581
+ - reduce:
582
+ - a
583
+ - e
584
+ - inject:
585
+ - a
586
+ - e
587
+
588
+ Style/SingleLineMethods:
589
+ AllowIfMethodIsEmpty: true
590
+
591
+ Style/StringLiterals:
592
+ EnforcedStyle: single_quotes
593
+ SupportedStyles:
594
+ - single_quotes
595
+ - double_quotes
596
+
597
+ Style/StringLiteralsInInterpolation:
598
+ EnforcedStyle: single_quotes
599
+ SupportedStyles:
600
+ - single_quotes
601
+ - double_quotes
602
+
603
+ Style/SpaceAroundBlockParameters:
604
+ EnforcedStyleInsidePipes: no_space
605
+ SupportedStyles:
606
+ - space
607
+ - no_space
608
+
609
+ Style/SpaceAroundEqualsInParameterDefault:
610
+ EnforcedStyle: space
611
+ SupportedStyles:
612
+ - space
613
+ - no_space
614
+
615
+ Style/SpaceAroundOperators:
616
+ MultiSpaceAllowedForOperators:
617
+ - '='
618
+ - '=>'
619
+
620
+ Style/SpaceBeforeBlockBraces:
621
+ EnforcedStyle: space
622
+ SupportedStyles:
623
+ - space
624
+ - no_space
625
+
626
+ Style/SpaceInsideBlockBraces:
627
+ EnforcedStyle: space
628
+ SupportedStyles:
629
+ - space
630
+ - no_space
631
+ # Valid values are: space, no_space
632
+ EnforcedStyleForEmptyBraces: no_space
633
+ # Space between { and |. Overrides EnforcedStyle if there is a conflict.
634
+ SpaceBeforeBlockParameters: true
635
+
636
+ Style/SpaceInsideHashLiteralBraces:
637
+ EnforcedStyle: space
638
+ EnforcedStyleForEmptyBraces: no_space
639
+ SupportedStyles:
640
+ - space
641
+ - no_space
642
+
643
+ Style/SymbolProc:
644
+ # A list of method names to be ignored by the check.
645
+ # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
646
+ IgnoredMethods:
647
+ - respond_to
648
+
649
+ Style/TrailingBlankLines:
650
+ EnforcedStyle: final_newline
651
+ SupportedStyles:
652
+ - final_newline
653
+ - final_blank_line
654
+
655
+ Style/TrailingComma:
656
+ # If EnforcedStyleForMultiline is comma, the cop requires a comma after the
657
+ # last item of a list, but only for lists where each item is on its own line.
658
+ # If EnforcedStyleForMultiline is consistent_comma, the cop requires a comma
659
+ # after the last item of a list, for all lists.
660
+ EnforcedStyleForMultiline: no_comma
661
+ SupportedStyles:
662
+ - comma
663
+ - consistent_comma
664
+ - no_comma
665
+
666
+ # TrivialAccessors requires exact name matches and doesn't allow
667
+ # predicated methods by default.
668
+ Style/TrivialAccessors:
669
+ # When set to false the cop will suggest the use of accessor methods
670
+ # in situations like:
671
+ #
672
+ # def name
673
+ # @other_name
674
+ # end
675
+ #
676
+ # This way you can uncover "hidden" attributes in your code.
677
+ ExactNameMatch: true
678
+ AllowPredicates: false
679
+ # Allows trivial writers that don't end in an equal sign. e.g.
680
+ #
681
+ # def on_exception(action)
682
+ # @on_exception=action
683
+ # end
684
+ # on_exception :restart
685
+ #
686
+ # Commonly used in DSLs
687
+ AllowDSLWriters: false
688
+ IgnoreClassMethods: false
689
+ Whitelist:
690
+ - to_ary
691
+ - to_a
692
+ - to_c
693
+ - to_enum
694
+ - to_h
695
+ - to_hash
696
+ - to_i
697
+ - to_int
698
+ - to_io
699
+ - to_open
700
+ - to_path
701
+ - to_proc
702
+ - to_r
703
+ - to_regexp
704
+ - to_str
705
+ - to_s
706
+ - to_sym
707
+
708
+ Style/VariableName:
709
+ EnforcedStyle: snake_case
710
+ SupportedStyles:
711
+ - snake_case
712
+ - camelCase
713
+
714
+ Style/WhileUntilModifier:
715
+ MaxLineLength: 80
716
+
717
+ Style/WordArray:
718
+ MinSize: 0
719
+ # The regular expression WordRegex decides what is considered a word.
720
+ WordRegex: !ruby/regexp '/\A[\p{Word}]+\z/'
721
+
722
+ ##################### Metrics ##################################
723
+
724
+ Metrics/AbcSize:
725
+ # The ABC size is a calculated magnitude, so this number can be a Fixnum or
726
+ # a Float.
727
+ Max: 15
728
+
729
+ Metrics/BlockNesting:
730
+ Max: 3
731
+
732
+ Metrics/ClassLength:
733
+ CountComments: false # count full line comments?
734
+ Max: 100
735
+
736
+ Metrics/ModuleLength:
737
+ CountComments: false # count full line comments?
738
+ Max: 200
739
+
740
+ # Avoid complex methods.
741
+ Metrics/CyclomaticComplexity:
742
+ Max: 6
743
+
744
+ Metrics/LineLength:
745
+ Max: 80
746
+ # To make it possible to copy or click on URIs in the code, we allow lines
747
+ # contaning a URI to be longer than Max.
748
+ AllowURI: true
749
+ URISchemes:
750
+ - http
751
+ - https
752
+
753
+ Metrics/MethodLength:
754
+ CountComments: false # count full line comments?
755
+ Max: 40
756
+
757
+ Metrics/ParameterLists:
758
+ Max: 5
759
+ CountKeywordArgs: true
760
+
761
+ Metrics/PerceivedComplexity:
762
+ Max: 7
763
+
764
+ ##################### Lint ##################################
765
+
766
+ # Allow safe assignment in conditions.
767
+ Lint/AssignmentInCondition:
768
+ AllowSafeAssignment: true
769
+
770
+ # Align ends correctly.
771
+ Lint/EndAlignment:
772
+ # The value `keyword` means that `end` should be aligned with the matching
773
+ # keyword (if, while, etc.).
774
+ # The value `variable` means that in assignments, `end` should be aligned
775
+ # with the start of the variable on the left hand side of `=`. In all other
776
+ # situations, `end` should still be aligned with the keyword.
777
+ AlignWith: keyword
778
+ SupportedStyles:
779
+ - keyword
780
+ - variable
781
+ AutoCorrect: false
782
+
783
+ Lint/DefEndAlignment:
784
+ # The value `def` means that `end` should be aligned with the def keyword.
785
+ # The value `start_of_line` means that `end` should be aligned with method
786
+ # calls like `private`, `public`, etc, if present in front of the `def`
787
+ # keyword on the same line.
788
+ AlignWith: start_of_line
789
+ SupportedStyles:
790
+ - start_of_line
791
+ - def
792
+ AutoCorrect: false
793
+