lcgstyle 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2078eb195eb828f2bcc4d02b8598f4f07882cc2f
4
- data.tar.gz: d7a5013bf728e5b0370c29ab6ea2fa3528821321
3
+ metadata.gz: 376ed72c94a5e3dfae17b55f828fb0df73fb7403
4
+ data.tar.gz: 8c465cf6394812a35248f1dadfb64fb108d5f5d0
5
5
  SHA512:
6
- metadata.gz: 6eff1735c11a9cfa6838b89ac2b0e447765f5026e6012fec127cae8a8ea585cac21c30f416dd22fe8d3646cc4a6a4386c3cf092885b8f8287bd08f9d0caaa9fd
7
- data.tar.gz: a3bde6800c7603cd0d2a00973635844f51105d8cb851e7235344e3532a2a97f3772946c606b7046e63ff431dbb897876b64b618682303917919f2a0e202e20bb
6
+ metadata.gz: 205b1e23551afe7ac874e16556ffa859c9f7a62346232d9595e633c10765baa2afd8a7f0901698bfc741679406666e7aafe24913d591d759453b11e6665680d7
7
+ data.tar.gz: 6406d85e5f66e857127eb326d28e7275ac6248b288688d0354eb5528e77f6659e271690a6d6fb4b7ce3d732d255055b91ce131d2a7cf5e472051528c1d02f17f
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ task :vendor do
14
14
 
15
15
  require "rubocop"
16
16
  require "yaml"
17
- cfg = RuboCop::Cop::Cop.all.each_with_object({}) { |acc, cop| acc[cop.cop_name] = { "Enabled" => false } }
17
+ cfg = RuboCop::Cop::Cop.all.inject({}) { |acc, cop| acc[cop.cop_name] = { "Enabled" => false }; acc }
18
18
  File.open(dst.join("disable_all.yml"), "w") { |fh| fh.write cfg.to_yaml }
19
19
 
20
20
  sh %{git add #{dst}/{upstream,enabled,disabled,disable_all}.yml}
data/config/chefstyle.yml CHANGED
@@ -32,8 +32,12 @@ Lint/EndInMethod:
32
32
  Enabled: true
33
33
  Lint/EnsureReturn:
34
34
  Enabled: true
35
+ Lint/FloatOutOfRange:
36
+ Enabled: true
35
37
  Lint/FormatParameterMismatch:
36
38
  Enabled: true
39
+ Lint/ImplicitStringConcatenation:
40
+ Enabled: true
37
41
  Lint/InvalidCharacterLiteral:
38
42
  Enabled: true
39
43
  Lint/LiteralInCondition:
@@ -42,22 +46,32 @@ Lint/LiteralInInterpolation:
42
46
  Enabled: true
43
47
  Lint/Loop:
44
48
  Enabled: true
49
+ Lint/NestedMethodDefinition:
50
+ Enabled: true
51
+ Lint/NextWithoutAccumulator:
52
+ Enabled: true
45
53
  Lint/NonLocalExitFromIterator:
46
54
  Enabled: true
55
+ Lint/RandOne:
56
+ Enabled: true
47
57
  Lint/RequireParentheses:
48
58
  Enabled: true
49
59
  Lint/StringConversionInInterpolation:
50
60
  Enabled: true
51
- Lint/UnneededDisable:
61
+ Lint/UnderscorePrefixedVariableName:
52
62
  Enabled: true
53
63
  Lint/UnreachableCode:
54
64
  Enabled: true
65
+ Lint/UselessAccessModifier:
66
+ Enabled: true
55
67
  Lint/UselessComparison:
56
68
  Enabled: true
57
69
  Lint/UselessElseWithoutRescue:
58
70
  Enabled: true
59
71
  Lint/UselessSetterCall:
60
72
  Enabled: true
73
+ Lint/Void:
74
+ Enabled: true
61
75
 
62
76
  #
63
77
  # Disabled Lint
@@ -76,6 +90,14 @@ Lint/HandleExceptions:
76
90
  Lint/RescueException:
77
91
  Enabled: false
78
92
 
93
+ # we have lots of not-insecure uses of eval
94
+ Lint/Eval:
95
+ Enabled: false
96
+
97
+ # disabling this will make it easier to stage chefstyle rollouts
98
+ Lint/UnneededDisable:
99
+ Enabled: false
100
+
79
101
  #
80
102
  # Performance
81
103
  #
@@ -84,12 +106,22 @@ Performance/Casecmp:
84
106
  Enabled: true
85
107
  Performance/CaseWhenSplat:
86
108
  Enabled: true
109
+ Performance/Count:
110
+ Enabled: true
87
111
  Performance/Detect:
88
112
  Enabled: true
113
+ Performance/DoubleStartEndWith:
114
+ Enabled: true
115
+ Performance/EndWith:
116
+ Enabled: true
89
117
  Performance/FixedSize:
90
118
  Enabled: true
91
119
  Performance/FlatMap:
92
120
  Enabled: true
121
+ Performance/HashEachMethods:
122
+ Enabled: true
123
+ Performance/LstripRstrip:
124
+ Enabled: true
93
125
  Performance/RangeInclude:
94
126
  Enabled: true
95
127
  Performance/RedundantBlockCall:
@@ -98,14 +130,20 @@ Performance/RedundantMatch:
98
130
  Enabled: true
99
131
  Performance/RedundantMerge:
100
132
  Enabled: true
133
+ Performance/RedundantSortBy:
134
+ Enabled: true
101
135
  Performance/ReverseEach:
102
136
  Enabled: true
103
137
  Performance/Sample:
104
138
  Enabled: true
105
139
  Performance/Size:
106
140
  Enabled: true
141
+ Performance/StartWith:
142
+ Enabled: true
107
143
  Performance/StringReplacement:
108
144
  Enabled: true
145
+ Performance/TimesMap:
146
+ Enabled: true
109
147
 
110
148
  #
111
149
  # Rails
@@ -166,6 +204,8 @@ Metrics/PerceivedComplexity:
166
204
  # Style
167
205
  #
168
206
 
207
+ Style/AccessModifierIndentation:
208
+ Enabled: true
169
209
  Style/AlignHash:
170
210
  Enabled: true
171
211
  Style/AndOr:
@@ -178,6 +218,8 @@ Style/Attr:
178
218
  Enabled: true
179
219
  Style/BeginBlock:
180
220
  Enabled: true
221
+ Style/BlockDelimiters:
222
+ Enabled: true
181
223
  Style/CharacterLiteral:
182
224
  Enabled: true
183
225
  Style/ClassMethods:
@@ -186,6 +228,8 @@ Style/ColonMethodCall:
186
228
  Enabled: true
187
229
  Style/CommandLiteral:
188
230
  Enabled: true
231
+ Style/ConstantName:
232
+ Enabled: true
189
233
  Style/ElseAlignment:
190
234
  Enabled: true
191
235
  Style/EmptyLineBetweenDefs:
@@ -208,8 +252,14 @@ Style/FlipFlop:
208
252
  Enabled: true
209
253
  Style/For:
210
254
  Enabled: true
255
+ Style/FrozenStringLiteralComment:
256
+ Enabled: true
257
+ Style/IfUnlessModifierOfIfUnless:
258
+ Enabled: true
211
259
  Style/IfWithSemicolon:
212
260
  Enabled: true
261
+ Style/IndentAssignment:
262
+ Enabled: true
213
263
  Style/IndentationConsistency:
214
264
  Enabled: true
215
265
  Style/IndentationWidth:
@@ -222,9 +272,17 @@ Style/LambdaCall:
222
272
  Enabled: true
223
273
  Style/MethodDefParentheses:
224
274
  Enabled: true
275
+ Style/MultilineBlockLayout:
276
+ Enabled: true
277
+ Style/MultilineIfThen:
278
+ Enabled: true
279
+ Style/MultilineMethodDefinitionBraceLayout:
280
+ Enabled: true
225
281
  Style/MultilineOperationIndentation:
226
282
  Enabled: true
227
283
  EnforcedStyle: indented
284
+ Style/MultilineTernaryOperator:
285
+ Enabled: true
228
286
  Style/NegatedWhile:
229
287
  Enabled: true
230
288
  Style/NestedModifier:
@@ -233,6 +291,10 @@ Style/NestedTernaryOperator:
233
291
  Enabled: true
234
292
  Style/OneLineConditional:
235
293
  Enabled: true
294
+ Style/OpMethod:
295
+ Enabled: true
296
+ Style/OptionalArguments:
297
+ Enabled: true
236
298
  Style/ParenthesesAroundCondition:
237
299
  Enabled: true
238
300
  # - The chef source code predominantly uses {} for %,%i,%q,%Q,%r,%w,%W
@@ -254,6 +316,8 @@ Style/PercentLiteralDelimiters:
254
316
  '%x': '{}'
255
317
  Style/PercentQLiterals:
256
318
  Enabled: true
319
+ Style/RedundantException:
320
+ Enabled: true
257
321
  Style/RedundantFreeze:
258
322
  Enabled: true
259
323
  Style/RescueEnsureAlignment:
@@ -268,6 +332,8 @@ Style/SpaceAfterComma:
268
332
  Enabled: true
269
333
  Style/SpaceAfterMethodName:
270
334
  Enabled: true
335
+ Style/SpaceAfterSemicolon:
336
+ Enabled: true
271
337
  Style/SpaceAroundBlockParameters:
272
338
  Enabled: true
273
339
  Style/SpaceAroundEqualsInParameterDefault:
@@ -276,8 +342,12 @@ Style/SpaceAroundOperators:
276
342
  Enabled: true
277
343
  Style/SpaceBeforeBlockBraces:
278
344
  Enabled: true
345
+ Style/SpaceBeforeComment:
346
+ Enabled: true
279
347
  Style/SpaceBeforeFirstArg:
280
348
  Enabled: true
349
+ Style/SpaceBeforeSemicolon:
350
+ Enabled: true
281
351
  Style/SpaceAroundKeyword:
282
352
  Enabled: true
283
353
  Style/SpaceInsideBlockBraces:
@@ -292,8 +362,12 @@ Style/StabbyLambdaParentheses:
292
362
  Style/StringLiterals:
293
363
  EnforcedStyle: double_quotes
294
364
  Enabled: true
365
+ Style/StructInheritance:
366
+ Enabled: true
295
367
  Style/SymbolLiteral:
296
368
  Enabled: true
369
+ Style/StringMethods:
370
+ Enabled: true
297
371
  Style/Tab:
298
372
  Enabled: true
299
373
  Style/TrailingBlankLines:
@@ -312,10 +386,14 @@ Style/UnneededCapitalW:
312
386
  Enabled: true
313
387
  #Style/UnneededPercentQ: # would like to enable this one but its buggy as of 0.35.1
314
388
  # Enabled: true
389
+ Style/VariableName:
390
+ Enabled: true
315
391
  Style/WhenThen:
316
392
  Enabled: true
317
393
  Style/WhileUntilDo:
318
394
  Enabled: true
395
+ Style/WhileUntilModifier:
396
+ Enabled: true
319
397
  Style/WordArray:
320
398
  Enabled: true
321
399
 
@@ -368,3 +446,19 @@ Style/IndentHash:
368
446
  # - https://github.com/chef/chef/pull/4541
369
447
  Style/TrivialAccessors:
370
448
  Enabled: false
449
+
450
+ # Not a lot of offenses and this seems to catch code that looks otherwise fine to my eye
451
+ Style/MultilineBlockChain:
452
+ Enabled: false
453
+
454
+ # We see nothing at all wrong with a trailing `rescue nil`
455
+ Style/RescueModifier:
456
+ Enabled: false
457
+
458
+ # Resulted in a bit of a bikeshed over names with unicode chars vs silently hidden unicode chars in comments
459
+ Style/AsciiComments:
460
+ Enabled: false
461
+
462
+ # Parens around ternaries often make them more readable and reduces cognitive load over operator precidence
463
+ Style/TernaryParentheses:
464
+ Enabled: false
@@ -45,6 +45,8 @@ Lint/HandleExceptions:
45
45
  Enabled: false
46
46
  Lint/ImplicitStringConcatenation:
47
47
  Enabled: false
48
+ Lint/InheritException:
49
+ Enabled: false
48
50
  Lint/IneffectiveAccessModifier:
49
51
  Enabled: false
50
52
  Lint/InvalidCharacterLiteral:
@@ -63,12 +65,18 @@ Lint/NonLocalExitFromIterator:
63
65
  Enabled: false
64
66
  Lint/ParenthesesAsGroupedExpression:
65
67
  Enabled: false
68
+ Lint/PercentStringArray:
69
+ Enabled: false
70
+ Lint/PercentSymbolArray:
71
+ Enabled: false
66
72
  Lint/RandOne:
67
73
  Enabled: false
68
74
  Lint/RequireParentheses:
69
75
  Enabled: false
70
76
  Lint/RescueException:
71
77
  Enabled: false
78
+ Lint/ShadowedException:
79
+ Enabled: false
72
80
  Lint/ShadowingOuterLocalVariable:
73
81
  Enabled: false
74
82
  Lint/StringConversionInInterpolation:
@@ -85,6 +93,8 @@ Lint/UnusedMethodArgument:
85
93
  Enabled: false
86
94
  Lint/UselessAccessModifier:
87
95
  Enabled: false
96
+ Lint/UselessArraySplat:
97
+ Enabled: false
88
98
  Lint/UselessAssignment:
89
99
  Enabled: false
90
100
  Lint/UselessComparison:
@@ -133,6 +143,8 @@ Performance/HashEachMethods:
133
143
  Enabled: false
134
144
  Performance/LstripRstrip:
135
145
  Enabled: false
146
+ Performance/PushSplat:
147
+ Enabled: false
136
148
  Performance/RangeInclude:
137
149
  Enabled: false
138
150
  Performance/RedundantBlockCall:
@@ -227,7 +239,7 @@ Style/Copyright:
227
239
  Enabled: false
228
240
  Style/DefWithParentheses:
229
241
  Enabled: false
230
- Style/DeprecatedHashMethods:
242
+ Style/PreferredHashMethods:
231
243
  Enabled: false
232
244
  Style/Documentation:
233
245
  Enabled: false
@@ -235,10 +247,14 @@ Style/DotPosition:
235
247
  Enabled: false
236
248
  Style/DoubleNegation:
237
249
  Enabled: false
250
+ Style/EachForSimpleLoop:
251
+ Enabled: false
238
252
  Style/EachWithObject:
239
253
  Enabled: false
240
254
  Style/ElseAlignment:
241
255
  Enabled: false
256
+ Style/EmptyCaseCondition:
257
+ Enabled: false
242
258
  Style/EmptyElse:
243
259
  Enabled: false
244
260
  Style/EmptyLineBetweenDefs:
@@ -303,6 +319,8 @@ Style/IfUnlessModifierOfIfUnless:
303
319
  Enabled: false
304
320
  Style/IfWithSemicolon:
305
321
  Enabled: false
322
+ Style/ImplicitRuntimeError:
323
+ Enabled: false
306
324
  Style/IndentArray:
307
325
  Enabled: false
308
326
  Style/IndentAssignment:
@@ -335,6 +353,8 @@ Style/MethodDefParentheses:
335
353
  Enabled: false
336
354
  Style/MethodName:
337
355
  Enabled: false
356
+ Style/MethodMissing:
357
+ Enabled: false
338
358
  Style/MissingElse:
339
359
  Enabled: false
340
360
  Style/ModuleFunction:
@@ -383,6 +403,10 @@ Style/Not:
383
403
  Enabled: false
384
404
  Style/NumericLiterals:
385
405
  Enabled: false
406
+ Style/NumericLiteralPrefix:
407
+ Enabled: false
408
+ Style/NumericPredicate:
409
+ Enabled: false
386
410
  Style/OneLineConditional:
387
411
  Enabled: false
388
412
  Style/OpMethod:
@@ -465,6 +489,8 @@ Style/SpaceBeforeFirstArg:
465
489
  Enabled: false
466
490
  Style/SpaceBeforeSemicolon:
467
491
  Enabled: false
492
+ Style/SpaceInsideArrayPercentLiteral:
493
+ Enabled: false
468
494
  Style/SpaceInsideBlockBraces:
469
495
  Enabled: false
470
496
  Style/SpaceInsideBrackets:
@@ -473,6 +499,8 @@ Style/SpaceInsideHashLiteralBraces:
473
499
  Enabled: false
474
500
  Style/SpaceInsideParens:
475
501
  Enabled: false
502
+ Style/SpaceInsidePercentLiteralDelimiters:
503
+ Enabled: false
476
504
  Style/SpaceInsideRangeLiteral:
477
505
  Enabled: false
478
506
  Style/SpaceInsideStringInterpolation:
@@ -497,6 +525,8 @@ Style/SymbolProc:
497
525
  Enabled: false
498
526
  Style/Tab:
499
527
  Enabled: false
528
+ Style/TernaryParentheses:
529
+ Enabled: false
500
530
  Style/TrailingBlankLines:
501
531
  Enabled: false
502
532
  Style/TrailingCommaInArguments:
@@ -537,21 +567,31 @@ Rails/Date:
537
567
  Enabled: false
538
568
  Rails/Delegate:
539
569
  Enabled: false
570
+ Rails/Exit:
571
+ Enabled: false
540
572
  Rails/FindBy:
541
573
  Enabled: false
542
574
  Rails/FindEach:
543
575
  Enabled: false
544
576
  Rails/HasAndBelongsToMany:
545
577
  Enabled: false
578
+ Rails/OutputSafety:
579
+ Enabled: false
546
580
  Rails/Output:
547
581
  Enabled: false
548
582
  Rails/PluralizationGrammar:
549
583
  Enabled: false
550
584
  Rails/ReadWriteAttribute:
551
585
  Enabled: false
586
+ Rails/RequestReferer:
587
+ Enabled: false
588
+ Rails/SaveBang:
589
+ Enabled: false
552
590
  Rails/ScopeArgs:
553
591
  Enabled: false
554
592
  Rails/TimeZone:
555
593
  Enabled: false
594
+ Rails/UniqBeforePluck:
595
+ Enabled: false
556
596
  Rails/Validation:
557
597
  Enabled: false
data/config/disabled.yml CHANGED
@@ -5,6 +5,11 @@
5
5
  Rails:
6
6
  Enabled: false
7
7
 
8
+ Rails/SaveBang:
9
+ Description: 'Identifies possible cases where Active Record save! or related should be used.'
10
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#save-bang'
11
+ Enabled: false
12
+
8
13
  Style/AutoResourceCleanup:
9
14
  Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
10
15
  Enabled: false
@@ -47,6 +52,12 @@ Style/FirstMethodParameterLineBreak:
47
52
  multi-line method parameter definition.
48
53
  Enabled: false
49
54
 
55
+ Style/ImplicitRuntimeError:
56
+ Description: >-
57
+ Use `raise` or `fail` with an explicit exception class and
58
+ message, rather than just a message.
59
+ Enabled: false
60
+
50
61
  Style/InlineComment:
51
62
  Description: 'Avoid inline comments.'
52
63
  Enabled: false
@@ -73,39 +84,11 @@ Style/MissingElse:
73
84
  - case
74
85
  - both
75
86
 
76
- Style/MultilineArrayBraceLayout:
77
- Description: >-
78
- Checks that the closing brace in an array literal is
79
- symmetrical with respect to the opening brace and the
80
- array elements.
81
- Enabled: false
82
-
83
87
  Style/MultilineAssignmentLayout:
84
88
  Description: 'Check for a newline after the assignment operator in multi-line assignments.'
85
89
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-conditional-assignment'
86
90
  Enabled: false
87
91
 
88
- Style/MultilineHashBraceLayout:
89
- Description: >-
90
- Checks that the closing brace in a hash literal is
91
- symmetrical with respect to the opening brace and the
92
- hash elements.
93
- Enabled: false
94
-
95
- Style/MultilineMethodCallBraceLayout:
96
- Description: >-
97
- Checks that the closing brace in a method call is
98
- symmetrical with respect to the opening brace and the
99
- method arguments.
100
- Enabled: false
101
-
102
- Style/MultilineMethodDefinitionBraceLayout:
103
- Description: >-
104
- Checks that the closing brace in a method definition is
105
- symmetrical with respect to the opening brace and the
106
- method parameters.
107
- Enabled: false
108
-
109
92
  Style/OptionHash:
110
93
  Description: "Don't use option hashes when you can use keyword arguments."
111
94
  Enabled: false
data/config/enabled.yml CHANGED
@@ -7,6 +7,7 @@ Style/AccessModifierIndentation:
7
7
 
8
8
  Style/AccessorMethodName:
9
9
  Description: Check the naming of accessor methods for get_/set_.
10
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#accessor_mutator_method_names'
10
11
  Enabled: true
11
12
 
12
13
  Style/Alias:
@@ -170,8 +171,8 @@ Style/DefWithParentheses:
170
171
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
171
172
  Enabled: true
172
173
 
173
- Style/DeprecatedHashMethods:
174
- Description: 'Checks for use of deprecated Hash methods.'
174
+ Style/PreferredHashMethods:
175
+ Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
175
176
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
176
177
  Enabled: true
177
178
 
@@ -192,6 +193,12 @@ Style/DoubleNegation:
192
193
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
193
194
  Enabled: true
194
195
 
196
+ Style/EachForSimpleLoop:
197
+ Description: >-
198
+ Use `Integer#times` for a simple loop which iterates a fixed
199
+ number of times.
200
+ Enabled: true
201
+
195
202
  Style/EachWithObject:
196
203
  Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
197
204
  Enabled: true
@@ -204,6 +211,10 @@ Style/EmptyElse:
204
211
  Description: 'Avoid empty else-clauses.'
205
212
  Enabled: true
206
213
 
214
+ Style/EmptyCaseCondition:
215
+ Description: 'Avoid empty condition in case statements.'
216
+ Enabled: true
217
+
207
218
  Style/EmptyLineBetweenDefs:
208
219
  Description: 'Use empty lines between defs.'
209
220
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
@@ -406,11 +417,23 @@ Style/MethodName:
406
417
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
407
418
  Enabled: true
408
419
 
420
+ Style/MethodMissing:
421
+ Description: 'Avoid using `method_missing`.'
422
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-method-missing'
423
+ Enabled: true
424
+
409
425
  Style/ModuleFunction:
410
426
  Description: 'Checks for usage of `extend self` in modules.'
411
427
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
412
428
  Enabled: true
413
429
 
430
+ Style/MultilineArrayBraceLayout:
431
+ Description: >-
432
+ Checks that the closing brace in an array literal is
433
+ either on the same line as the last array element, or
434
+ a new line.
435
+ Enabled: true
436
+
414
437
  Style/MultilineBlockChain:
415
438
  Description: 'Avoid multi-line chains of blocks.'
416
439
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
@@ -420,17 +443,38 @@ Style/MultilineBlockLayout:
420
443
  Description: 'Ensures newlines after multiline block do statements.'
421
444
  Enabled: true
422
445
 
446
+ Style/MultilineHashBraceLayout:
447
+ Description: >-
448
+ Checks that the closing brace in a hash literal is
449
+ either on the same line as the last hash element, or
450
+ a new line.
451
+ Enabled: true
452
+
423
453
  Style/MultilineIfThen:
424
454
  Description: 'Do not use then for multi-line if/unless.'
425
455
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-then'
426
456
  Enabled: true
427
457
 
458
+ Style/MultilineMethodCallBraceLayout:
459
+ Description: >-
460
+ Checks that the closing brace in a method call is
461
+ either on the same line as the last method argument, or
462
+ a new line.
463
+ Enabled: true
464
+
428
465
  Style/MultilineMethodCallIndentation:
429
466
  Description: >-
430
467
  Checks indentation of method calls with the dot operator
431
468
  that span more than one line.
432
469
  Enabled: true
433
470
 
471
+ Style/MultilineMethodDefinitionBraceLayout:
472
+ Description: >-
473
+ Checks that the closing brace in a method definition is
474
+ either on the same line as the last method parameter, or
475
+ a new line.
476
+ Enabled: true
477
+
434
478
  Style/MultilineOperationIndentation:
435
479
  Description: >-
436
480
  Checks indentation of binary operations that span more than
@@ -503,6 +547,17 @@ Style/NumericLiterals:
503
547
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
504
548
  Enabled: true
505
549
 
550
+ Style/NumericLiteralPrefix:
551
+ Description: 'Use smallcase prefixes for numeric literals.'
552
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#numeric-literal-prefixes'
553
+ Enabled: true
554
+
555
+ Style/NumericPredicate:
556
+ Description: >-
557
+ Checks for the use of predicate- or comparison methods for
558
+ numeric comparisons.
559
+ Enabled: true
560
+
506
561
  Style/OneLineConditional:
507
562
  Description: >-
508
563
  Favor the ternary operator(?:) over
@@ -716,6 +771,14 @@ Style/SpaceAroundOperators:
716
771
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
717
772
  Enabled: true
718
773
 
774
+ Style/SpaceInsideArrayPercentLiteral:
775
+ Description: 'No unnecessary additional spaces between elements in %i/%w literals.'
776
+ Enabled: true
777
+
778
+ Style/SpaceInsidePercentLiteralDelimiters:
779
+ Description: 'No unnecessary spaces inside delimiters of %i/%w/%x literals.'
780
+ Enabled: true
781
+
719
782
  Style/SpaceInsideBrackets:
720
783
  Description: 'No spaces after [ or before ].'
721
784
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
@@ -780,6 +843,10 @@ Style/Tab:
780
843
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
781
844
  Enabled: true
782
845
 
846
+ Style/TernaryParentheses:
847
+ Description: 'Checks for use of parentheses around ternary conditions.'
848
+ Enabled: true
849
+
783
850
  Style/TrailingBlankLines:
784
851
  Description: 'Checks trailing blank lines and final newline.'
785
852
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
@@ -787,7 +854,7 @@ Style/TrailingBlankLines:
787
854
 
788
855
  Style/TrailingCommaInArguments:
789
856
  Description: 'Checks for trailing comma in argument lists.'
790
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
857
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-params-comma'
791
858
  Enabled: true
792
859
 
793
860
  Style/TrailingCommaInLiteral:
@@ -1035,6 +1102,10 @@ Lint/IneffectiveAccessModifier:
1035
1102
  the visibility of a class method, which does not work.
1036
1103
  Enabled: true
1037
1104
 
1105
+ Lint/InheritException:
1106
+ Description: 'Avoid inheriting from the `Exception` class.'
1107
+ Enabled: true
1108
+
1038
1109
  Lint/InvalidCharacterLiteral:
1039
1110
  Description: >-
1040
1111
  Checks for invalid character literals with a non-escaped
@@ -1078,6 +1149,16 @@ Lint/ParenthesesAsGroupedExpression:
1078
1149
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
1079
1150
  Enabled: true
1080
1151
 
1152
+ Lint/PercentStringArray:
1153
+ Description: >-
1154
+ Checks for unwanted commas and quotes in %w/%W literals.
1155
+ Enabled: true
1156
+
1157
+ Lint/PercentSymbolArray:
1158
+ Description: >-
1159
+ Checks for unwanted commas and colons in %i/%I literals.
1160
+ Enabled: true
1161
+
1081
1162
  Lint/RandOne:
1082
1163
  Description: >-
1083
1164
  Checks for `rand(1)` calls. Such calls always return `0`
@@ -1095,6 +1176,12 @@ Lint/RescueException:
1095
1176
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues'
1096
1177
  Enabled: true
1097
1178
 
1179
+ Lint/ShadowedException:
1180
+ Description: >-
1181
+ Avoid rescuing a higher level exception
1182
+ before a lower level exception.
1183
+ Enabled: true
1184
+
1098
1185
  Lint/ShadowingOuterLocalVariable:
1099
1186
  Description: >-
1100
1187
  Do not use the same name as outer local variable
@@ -1134,6 +1221,11 @@ Lint/UnreachableCode:
1134
1221
  Lint/UselessAccessModifier:
1135
1222
  Description: 'Checks for useless access modifiers.'
1136
1223
  Enabled: true
1224
+ ContextCreatingMethods: []
1225
+
1226
+ Lint/UselessArraySplat:
1227
+ Description: 'Checks for useless array splats.'
1228
+ Enabled: true
1137
1229
 
1138
1230
  Lint/UselessAssignment:
1139
1231
  Description: 'Checks for useless assignment to a local variable.'
@@ -1234,6 +1326,10 @@ Performance/LstripRstrip:
1234
1326
  Description: 'Use `strip` instead of `lstrip.rstrip`.'
1235
1327
  Enabled: true
1236
1328
 
1329
+ Performance/PushSplat:
1330
+ Description: 'Use `concat` instead of `push(*)`.'
1331
+ Enabled: true
1332
+
1237
1333
  Performance/RangeInclude:
1238
1334
  Description: 'Use `Range#cover?` instead of `Range#include?`.'
1239
1335
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
@@ -1311,22 +1407,36 @@ Rails/Delegate:
1311
1407
  Description: 'Prefer delegate method for delegations.'
1312
1408
  Enabled: true
1313
1409
 
1410
+ Rails/Exit:
1411
+ Description: >-
1412
+ Favor `fail`, `break`, `return`, etc. over `exit` in
1413
+ application or library code outside of Rake files to avoid
1414
+ exits during unit testing or running in production.
1415
+ Enabled: true
1416
+
1314
1417
  Rails/FindBy:
1315
1418
  Description: 'Prefer find_by over where.first.'
1419
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find_by'
1316
1420
  Enabled: true
1317
1421
 
1318
1422
  Rails/FindEach:
1319
1423
  Description: 'Prefer all.find_each over all.find.'
1424
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#find-each'
1320
1425
  Enabled: true
1321
1426
 
1322
1427
  Rails/HasAndBelongsToMany:
1323
1428
  Description: 'Prefer has_many :through to has_and_belongs_to_many.'
1429
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#has-many-through'
1324
1430
  Enabled: true
1325
1431
 
1326
1432
  Rails/Output:
1327
1433
  Description: 'Checks for calls to puts, print, etc.'
1328
1434
  Enabled: true
1329
1435
 
1436
+ Rails/OutputSafety:
1437
+ Description: 'The use of `html_safe` or `raw` may be a security risk.'
1438
+ Enabled: true
1439
+
1330
1440
  Rails/PluralizationGrammar:
1331
1441
  Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
1332
1442
  Enabled: true
@@ -1335,6 +1445,11 @@ Rails/ReadWriteAttribute:
1335
1445
  Description: >-
1336
1446
  Checks for read_attribute(:attr) and
1337
1447
  write_attribute(:attr, val).
1448
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#read-attribute'
1449
+ Enabled: true
1450
+
1451
+ Rails/RequestReferer:
1452
+ Description: 'Use consistent syntax for request.referer.'
1338
1453
  Enabled: true
1339
1454
 
1340
1455
  Rails/ScopeArgs:
@@ -1347,6 +1462,10 @@ Rails/TimeZone:
1347
1462
  Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
1348
1463
  Enabled: true
1349
1464
 
1465
+ Rails/UniqBeforePluck:
1466
+ Description: 'Prefer the use of uniq or distinct before pluck.'
1467
+ Enabled: true
1468
+
1350
1469
  Rails/Validation:
1351
1470
  Description: 'Use validates :attribute, hash of validations.'
1352
1471
  Enabled: true
data/config/upstream.yml CHANGED
@@ -25,6 +25,8 @@ AllCops:
25
25
  - '**/Berksfile'
26
26
  - '**/Cheffile'
27
27
  - '**/Vagabondfile'
28
+ - '**/Fastfile'
29
+ - '**/*Fastfile'
28
30
  Exclude:
29
31
  - 'vendor/**/*'
30
32
  # Default formatter will be used if no -f/--format option is given.
@@ -63,9 +65,20 @@ AllCops:
63
65
  # which is "/tmp" on Unix-like systems, but could be something else on other
64
66
  # systems.
65
67
  CacheRootDirectory: /tmp
66
- # What version of the Ruby interpreter is the inspected code intended to
68
+ # The default cache root directory is /tmp, which on most systems is
69
+ # writable by any system user. This means that it is possible for a
70
+ # malicious user to anticipate the location of Rubocop's cache directory,
71
+ # and create a symlink in its place that could cause Rubocop to overwrite
72
+ # unintended files, or read malicious input. If you are certain that your
73
+ # cache location is secure from this kind of attack, and wish to use a
74
+ # symlinked cache location, set this value to "true".
75
+ AllowSymlinksInCacheRootDirectory: false
76
+ # What MRI version of the Ruby interpreter is the inspected code intended to
67
77
  # run on? (If there is more than one, set this to the lowest version.)
68
- TargetRubyVersion: 2.0
78
+ # If a value is specified for TargetRubyVersion then it is used.
79
+ # Else if .ruby-version exists and it contains an MRI version it is used.
80
+ # Otherwise we fallback to the oldest officially supported Ruby version (2.0).
81
+ TargetRubyVersion: ~
69
82
 
70
83
  # Indent private/protected/public as deep as method definitions
71
84
  Style/AccessModifierIndentation:
@@ -165,6 +178,9 @@ Style/AlignParameters:
165
178
  SupportedStyles:
166
179
  - with_first_parameter
167
180
  - with_fixed_indentation
181
+ # By default, the indentation width from Style/IndentationWidth is used
182
+ # But it can be overridden by setting this parameter
183
+ IndentationWidth: ~
168
184
 
169
185
  Style/AndOr:
170
186
  # Whether `and` and `or` are banned only in conditionals (conditionals)
@@ -425,10 +441,11 @@ Style/EmptyLinesAroundModuleBody:
425
441
  # AutoCorrectEncodingComment must match the regex
426
442
  # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
427
443
  Style/Encoding:
428
- EnforcedStyle: always
444
+ EnforcedStyle: never
429
445
  SupportedStyles:
430
446
  - when_needed
431
447
  - always
448
+ - never
432
449
  AutoCorrectEncodingComment: '# encoding: utf-8'
433
450
 
434
451
  Style/ExtraSpacing:
@@ -518,8 +535,10 @@ Style/HashSyntax:
518
535
  - ruby19
519
536
  - ruby19_no_mixed_keys
520
537
  - hash_rockets
521
- # Force hashes that have a symbol value to use hash rockets
538
+ # Force hashes that have a symbol value to use hash rockets
522
539
  UseHashRocketsWithSymbolValues: false
540
+ # Do not suggest { a?: 1 } over { :a? => 1 } in ruby19 style
541
+ PreferHashRocketsForNonAlnumEndingSymbols: false
523
542
 
524
543
  Style/IfUnlessModifier:
525
544
  MaxLineLength: 80
@@ -590,6 +609,13 @@ Style/IndentHash:
590
609
  # But it can be overridden by setting this parameter
591
610
  IndentationWidth: ~
592
611
 
612
+ Style/Lambda:
613
+ EnforcedStyle: line_count_dependent
614
+ SupportedStyles:
615
+ - line_count_dependent
616
+ - lambda
617
+ - literal
618
+
593
619
  Style/LambdaCall:
594
620
  EnforcedStyle: call
595
621
  SupportedStyles:
@@ -617,6 +643,12 @@ Style/NonNilCheck:
617
643
  # offenses for `!x.nil?` and does no changes that might change behavior.
618
644
  IncludeSemanticChanges: false
619
645
 
646
+ Style/NumericPredicate:
647
+ EnforcedStyle: predicate
648
+ SupportedStyles:
649
+ - predicate
650
+ - comparison
651
+
620
652
  Style/MethodDefParentheses:
621
653
  EnforcedStyle: require_parentheses
622
654
  SupportedStyles:
@@ -630,6 +662,22 @@ Style/MethodName:
630
662
  - snake_case
631
663
  - camelCase
632
664
 
665
+ Style/ModuleFunction:
666
+ EnforcedStyle: module_function
667
+ SupportedStyles:
668
+ - module_function
669
+ - extend_self
670
+
671
+ Style/MultilineArrayBraceLayout:
672
+ EnforcedStyle: symmetrical
673
+ SupportedStyles:
674
+ # symmetrical: closing brace is positioned in same way as opening brace
675
+ # new_line: closing brace is always on a new line
676
+ # same_line: closing brace is always on the same line as last element
677
+ - symmetrical
678
+ - new_line
679
+ - same_line
680
+
633
681
  Style/MultilineAssignmentLayout:
634
682
  # The types of assignments which are subject to this rule.
635
683
  SupportedTypes:
@@ -648,15 +696,46 @@ Style/MultilineAssignmentLayout:
648
696
  # for the set of supported types.
649
697
  - new_line
650
698
 
699
+ Style/MultilineHashBraceLayout:
700
+ EnforcedStyle: symmetrical
701
+ SupportedStyles:
702
+ # symmetrical: closing brace is positioned in same way as opening brace
703
+ # new_line: closing brace is always on a new line
704
+ # same_line: closing brace is always on same line as last element
705
+ - symmetrical
706
+ - new_line
707
+ - same_line
708
+
709
+ Style/MultilineMethodCallBraceLayout:
710
+ EnforcedStyle: symmetrical
711
+ SupportedStyles:
712
+ # symmetrical: closing brace is positioned in same way as opening brace
713
+ # new_line: closing brace is always on a new line
714
+ # same_line: closing brace is always on the same line as last argument
715
+ - symmetrical
716
+ - new_line
717
+ - same_line
718
+
651
719
  Style/MultilineMethodCallIndentation:
652
720
  EnforcedStyle: aligned
653
721
  SupportedStyles:
654
722
  - aligned
655
723
  - indented
724
+ - indented_relative_to_receiver
656
725
  # By default, the indentation width from Style/IndentationWidth is used
657
726
  # But it can be overridden by setting this parameter
658
727
  IndentationWidth: ~
659
728
 
729
+ Style/MultilineMethodDefinitionBraceLayout:
730
+ EnforcedStyle: symmetrical
731
+ SupportedStyles:
732
+ # symmetrical: closing brace is positioned in same way as opening brace
733
+ # new_line: closing brace is always on a new line
734
+ # same_line: closing brace is always on the same line as last parameter
735
+ - symmetrical
736
+ - new_line
737
+ - same_line
738
+
660
739
  Style/MultilineOperationIndentation:
661
740
  EnforcedStyle: aligned
662
741
  SupportedStyles:
@@ -669,6 +748,12 @@ Style/MultilineOperationIndentation:
669
748
  Style/NumericLiterals:
670
749
  MinDigits: 5
671
750
 
751
+ Style/NumericLiteralPrefix:
752
+ EnforcedOctalStyle: zero_with_o
753
+ SupportedOctalStyles:
754
+ - zero_with_o
755
+ - zero_only
756
+
672
757
  Style/OptionHash:
673
758
  # A list of parameter names that will be flagged by this cop.
674
759
  SuspiciousParamNames:
@@ -715,6 +800,10 @@ Style/PredicateName:
715
800
  # should still be accepted
716
801
  NameWhitelist:
717
802
  - is_a?
803
+ # Exclude Rspec specs because there is a strong convetion to write spec
804
+ # helpers in the form of `have_something` or `be_something`.
805
+ Exclude:
806
+ - 'spec/**/*'
718
807
 
719
808
  Style/RaiseArgs:
720
809
  EnforcedStyle: exploded
@@ -846,6 +935,9 @@ Style/SpaceInsideHashLiteralBraces:
846
935
  SupportedStyles:
847
936
  - space
848
937
  - no_space
938
+ # 'compact' normally requires a space inside hash braces, with the exception
939
+ # that successive left braces or right braces are collapsed together
940
+ - compact
849
941
 
850
942
  Style/SpaceInsideStringInterpolation:
851
943
  EnforcedStyle: no_space
@@ -864,6 +956,14 @@ Style/SymbolProc:
864
956
  # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
865
957
  IgnoredMethods:
866
958
  - respond_to
959
+ - define_method
960
+
961
+ Style/TernaryParentheses:
962
+ EnforcedStyle: require_no_parentheses
963
+ SupportedStyles:
964
+ - require_parentheses
965
+ - require_no_parentheses
966
+ AllowSafeAssignment: true
867
967
 
868
968
  Style/TrailingBlankLines:
869
969
  EnforcedStyle: final_newline
@@ -944,11 +1044,17 @@ Style/VariableName:
944
1044
  Style/WhileUntilModifier:
945
1045
  MaxLineLength: 80
946
1046
 
1047
+ # WordArray enforces how array literals of word-like strings should be expressed.
947
1048
  Style/WordArray:
948
1049
  EnforcedStyle: percent
949
1050
  SupportedStyles:
1051
+ # percent style: %w(word1 word2)
950
1052
  - percent
1053
+ # bracket style: ['word1', 'word2']
951
1054
  - brackets
1055
+ # The MinSize option causes the WordArray rule to be ignored for arrays
1056
+ # smaller than a certain size. The rule is only applied to arrays
1057
+ # whose element count is greater than or equal to MinSize.
952
1058
  MinSize: 0
953
1059
  # The regular expression WordRegex decides what is considered a word.
954
1060
  WordRegex: !ruby/regexp '/\A[\p{Word}\n\t]+\z/'
@@ -1006,7 +1112,7 @@ Lint/AssignmentInCondition:
1006
1112
  Lint/BlockAlignment:
1007
1113
  # The value `start_of_block` means that the `end` should be aligned with line
1008
1114
  # where the `do` keyword appears.
1009
- # The value `start_of_line` means it should be aligned with the whole
1115
+ # The value `start_of_line` means it should be aligned with the whole
1010
1116
  # expression's starting line.
1011
1117
  # The value `either` means both are allowed.
1012
1118
  AlignWith: either
@@ -1042,9 +1148,17 @@ Lint/DefEndAlignment:
1042
1148
  - def
1043
1149
  AutoCorrect: false
1044
1150
 
1151
+ Lint/InheritException:
1152
+ # The default base class in favour of `Exception`.
1153
+ EnforcedStyle: runtime_error
1154
+ SupportedStyles:
1155
+ - runtime_error
1156
+ - standard_error
1157
+
1045
1158
  # Checks for unused block arguments
1046
1159
  Lint/UnusedBlockArgument:
1047
1160
  IgnoreEmptyBlocks: true
1161
+ AllowUnusedKeywordArguments: false
1048
1162
 
1049
1163
  # Checks for unused method arguments.
1050
1164
  Lint/UnusedMethodArgument:
@@ -1078,6 +1192,14 @@ Rails/Date:
1078
1192
  - strict
1079
1193
  - flexible
1080
1194
 
1195
+ Rails/Exit:
1196
+ Include:
1197
+ - app/**/*.rb
1198
+ - config/**/*.rb
1199
+ - lib/**/*.rb
1200
+ Exclude:
1201
+ - lib/**/*.rake
1202
+
1081
1203
  Rails/FindBy:
1082
1204
  Include:
1083
1205
  - app/models/**/*.rb
@@ -1101,6 +1223,12 @@ Rails/ReadWriteAttribute:
1101
1223
  Include:
1102
1224
  - app/models/**/*.rb
1103
1225
 
1226
+ Rails/RequestReferer:
1227
+ EnforcedStyle: referer
1228
+ SupportedStyles:
1229
+ - referer
1230
+ - referrer
1231
+
1104
1232
  Rails/ScopeArgs:
1105
1233
  Include:
1106
1234
  - app/models/**/*.rb
@@ -1113,6 +1241,13 @@ Rails/TimeZone:
1113
1241
  - strict
1114
1242
  - flexible
1115
1243
 
1244
+ Rails/UniqBeforePluck:
1245
+ EnforcedMode: conservative
1246
+ SupportedModes:
1247
+ - conservative
1248
+ - aggressive
1249
+ AutoCorrect: false
1250
+
1116
1251
  Rails/Validation:
1117
1252
  Include:
1118
1253
  - app/models/**/*.rb
@@ -1,4 +1,4 @@
1
1
  module Lcgstyle
2
- VERSION = "0.0.1".freeze
3
- RUBOCOP_VERSION = "0.39.0".freeze
2
+ VERSION = "0.0.2".freeze
3
+ RUBOCOP_VERSION = "0.42.0".freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lcgstyle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thom May
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-19 00:00:00.000000000 Z
11
+ date: 2016-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 0.39.0
61
+ version: 0.42.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 0.39.0
68
+ version: 0.42.0
69
69
  description:
70
70
  email:
71
71
  - thom@chef.io
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  requirements: []
113
113
  rubyforge_project:
114
- rubygems_version: 2.6.2
114
+ rubygems_version: 2.4.8
115
115
  signing_key:
116
116
  specification_version: 4
117
117
  summary: Rubocop configuration for Chef's ruby projects