chefstyle 0.4.0 → 0.5.0

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: 5381b1c87d477aa07cf1c2a9f82ad8f4c46f3732
4
- data.tar.gz: b8cce9e6e91fa46824f9101a219e6a14402421de
3
+ metadata.gz: 493c05753128c7b60a843de5913d01dcf2cdee20
4
+ data.tar.gz: bc3f2ea30dcf8ce171feedcbb0292ec1caff88f9
5
5
  SHA512:
6
- metadata.gz: 8a72c4b7756e89bd293acf7f3c126147d32f8c8ff158fbad5b41d1eecc6cc5b7e242e86ef8bf484626e5fdf53aea99c673df0a646625788276997d3e028cc27c
7
- data.tar.gz: 8c90216a9a3d71ec0bafbe8286f5777296fa2025f113583e74c6e5b8a5e6a42dfe9b90fb98579d6392610b287cea7515065f8fea8c37360438e4b1ea526cd0c0
6
+ metadata.gz: b852bbe98d056656c9cd84e9e58b17d2ba2bcd120f6eeae6410674297d62d1b6bf2473c26da493c1d59ee269f59fe54253b6163cd92c1ee9eb3cad45a58af492
7
+ data.tar.gz: 0bd95d570bd3c428b3ef0b25ecb52618bdd978123d36341cc13dcc93c781702ddb6abf2c55800e9d218fd2c0f29f7b32351ed3d3f9b47c8fc3a1fd4a7f3b09a1
@@ -1,4 +1,15 @@
1
1
  language: ruby
2
- rvm:
3
- - 2.2.1
2
+ cache: bundler
3
+
4
+ sudo: false
5
+
6
+ branches:
7
+ only:
8
+ - master
9
+
4
10
  before_install: gem install bundler -v 1.10.6
11
+
12
+ rvm:
13
+ - 2.2.6
14
+ - 2.3.3
15
+ - 2.4.0
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Chefstyle - Version Pinned rubocop and sane defaults for Ruby
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/chefstyle.svg)](https://badge.fury.io/rb/chefstyle) [![Build Status](https://travis-ci.org/chef/chefstyle.svg?branch=master)](https://travis-ci.org/chef/chefstyle)
4
+
3
5
  This is an internal style guide for chef ruby projects (chef-client,
4
6
  ohai, mixlib-shellout, mixlib-config, etc).
5
7
 
@@ -7,6 +9,11 @@ It is not meant for consumption by cookbooks or for any general
7
9
  purpose uses. It is not intended for any audience outside of chef
8
10
  core ruby development.
9
11
 
12
+ It will conflict with rubocop defaults, cookstyle, finstyle and other
13
+ ruby style guides entirely by design. The point is that the core
14
+ chef authors vehemently disagree with them on points of style and this
15
+ point is generally not up for debate.
16
+
10
17
  It will have many rules that are disabled simply because fixing a
11
18
  project as large as chef-client would be tedious and have little
12
19
  value. It will have other rules that are disabled because chef
data/Rakefile CHANGED
@@ -26,3 +26,5 @@ require "rubocop/rake_task"
26
26
  RuboCop::RakeTask.new(:style) do |task|
27
27
  task.options << "--display-cop-names"
28
28
  end
29
+
30
+ task default: [:build, :install]
@@ -12,14 +12,14 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = %q{Rubocop configuration for Chef's ruby projects}
13
13
  spec.homepage = "https://github.com/chef/chefstyle"
14
14
  spec.license = "Apache-2.0"
15
- spec.required_ruby_version = ">= 2.0.0"
15
+ spec.required_ruby_version = ">= 2.2"
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
18
  spec.executables = %w[chefstyle]
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.10"
22
- spec.add_development_dependency "rake", "~> 10.0"
22
+ spec.add_development_dependency "rake", "~> 12.0"
23
23
  spec.add_development_dependency "rspec"
24
24
  spec.add_dependency("rubocop", Chefstyle::RUBOCOP_VERSION)
25
25
  end
@@ -1,3 +1,10 @@
1
+ #
2
+ # Bundler
3
+ #
4
+
5
+ Bundler/DuplicatedGem:
6
+ Enabled: true
7
+
1
8
  #
2
9
  # Lint
3
10
  #
@@ -14,6 +21,8 @@ Lint/Debugger:
14
21
  Enabled: true
15
22
  Lint/DefEndAlignment:
16
23
  Enabled: true
24
+ Lint/DuplicateCaseCondition:
25
+ Enabled: true
17
26
  Lint/DuplicateMethods:
18
27
  Enabled: true
19
28
  Lint/DuplicatedKey:
@@ -24,6 +33,8 @@ Lint/ElseLayout:
24
33
  Enabled: true
25
34
  Lint/EmptyEnsure:
26
35
  Enabled: true
36
+ Lint/EmptyExpression:
37
+ Enabled: true
27
38
  Lint/EmptyInterpolation:
28
39
  Enabled: true
29
40
  Lint/EndAlignment:
@@ -38,6 +49,8 @@ Lint/FormatParameterMismatch:
38
49
  Enabled: true
39
50
  Lint/ImplicitStringConcatenation:
40
51
  Enabled: true
52
+ Lint/InheritException:
53
+ Enabled: true
41
54
  Lint/InvalidCharacterLiteral:
42
55
  Enabled: true
43
56
  Lint/LiteralInCondition:
@@ -46,20 +59,30 @@ Lint/LiteralInInterpolation:
46
59
  Enabled: true
47
60
  Lint/Loop:
48
61
  Enabled: true
62
+ Lint/MultipleCompare:
63
+ Enabled: true
49
64
  Lint/NestedMethodDefinition:
50
65
  Enabled: true
51
66
  Lint/NextWithoutAccumulator:
52
67
  Enabled: true
53
68
  Lint/NonLocalExitFromIterator:
54
69
  Enabled: true
70
+ Lint/PercentSymbolArray:
71
+ Eanbled: true
55
72
  Lint/RandOne:
56
73
  Enabled: true
57
74
  Lint/RequireParentheses:
58
75
  Enabled: true
76
+ Lint/SafeNavigationChain:
77
+ Enabled: true
59
78
  Lint/StringConversionInInterpolation:
60
79
  Enabled: true
61
80
  Lint/UnderscorePrefixedVariableName:
62
81
  Enabled: true
82
+ Lint/UnifiedInteger:
83
+ Enabled: true
84
+ Lint/UnneededDisable:
85
+ Enabled: true
63
86
  Lint/UnreachableCode:
64
87
  Enabled: true
65
88
  Lint/UselessAccessModifier:
@@ -91,7 +114,7 @@ Lint/RescueException:
91
114
  Enabled: false
92
115
 
93
116
  # we have lots of not-insecure uses of eval
94
- Lint/Eval:
117
+ Security/Eval:
95
118
  Enabled: false
96
119
 
97
120
  # disabling this will make it easier to stage chefstyle rollouts
@@ -106,6 +129,8 @@ Performance/Casecmp:
106
129
  Enabled: true
107
130
  Performance/CaseWhenSplat:
108
131
  Enabled: true
132
+ Performance/CompareWithBlock:
133
+ Enabled: true
109
134
  Performance/Count:
110
135
  Enabled: true
111
136
  Performance/Detect:
@@ -132,12 +157,16 @@ Performance/RedundantMerge:
132
157
  Enabled: true
133
158
  Performance/RedundantSortBy:
134
159
  Enabled: true
160
+ Performance/RegexpMatch:
161
+ Enabled: true
135
162
  Performance/ReverseEach:
136
163
  Enabled: true
137
164
  Performance/Sample:
138
165
  Enabled: true
139
166
  Performance/Size:
140
167
  Enabled: true
168
+ Performance/SortWithBlock:
169
+ Enabled: true
141
170
  Performance/StartWith:
142
171
  Enabled: true
143
172
  Performance/StringReplacement:
@@ -184,6 +213,8 @@ Metrics/AbcSize:
184
213
  Enabled: false
185
214
  Metrics/BlockNesting:
186
215
  Enabled: false
216
+ Metrics/BlockLength:
217
+ Enabled: false
187
218
  Metrics/ClassLength:
188
219
  Enabled: false
189
220
  Metrics/CyclomaticComplexity:
@@ -230,6 +261,10 @@ Style/CommandLiteral:
230
261
  Enabled: true
231
262
  Style/ConstantName:
232
263
  Enabled: true
264
+ Style/DefWithParentheses:
265
+ Enabled: true
266
+ Style/EachForSimpleLoop:
267
+ Enabled: true
233
268
  Style/ElseAlignment:
234
269
  Enabled: true
235
270
  Style/EmptyLineBetweenDefs:
@@ -274,8 +309,12 @@ Style/MethodDefParentheses:
274
309
  Enabled: true
275
310
  Style/MultilineBlockLayout:
276
311
  Enabled: true
312
+ Style/MultilineIfModifier:
313
+ Enabled: true
277
314
  Style/MultilineIfThen:
278
315
  Enabled: true
316
+ Style/MultilineMemoization:
317
+ Enabled: true
279
318
  Style/MultilineMethodDefinitionBraceLayout:
280
319
  Enabled: true
281
320
  Style/MultilineOperationIndentation:
@@ -289,6 +328,14 @@ Style/NestedModifier:
289
328
  Enabled: true
290
329
  Style/NestedTernaryOperator:
291
330
  Enabled: true
331
+ Style/NilComparison:
332
+ Enabled: true
333
+ Style/NonNilCheck:
334
+ Enabled: true
335
+ # `foo.zero?` is slower and substantially more annoying to read than `foo == 0`
336
+ Style/NumericPredicate:
337
+ Enabled: true
338
+ EnforcedStyle: comparison
292
339
  Style/OneLineConditional:
293
340
  Enabled: true
294
341
  Style/OpMethod:
@@ -307,6 +354,7 @@ Style/PercentLiteralDelimiters:
307
354
  PreferredDelimiters:
308
355
  '%': '{}'
309
356
  '%i': '{}'
357
+ '%I': '{}'
310
358
  '%q': '{}'
311
359
  '%Q': '{}'
312
360
  '%r': '{}'
@@ -322,6 +370,13 @@ Style/RedundantFreeze:
322
370
  Enabled: true
323
371
  Style/RescueEnsureAlignment:
324
372
  Enabled: true
373
+ Style/SafeNavigation:
374
+ Enabled: true
375
+ Style/SelfAssignment:
376
+ Enabled: true
377
+ Style/Semicolon:
378
+ AllowAsExpressionSeparator: true
379
+ Enabled: true
325
380
  # we only 'raise' and do not 'fail'
326
381
  Style/SignalException:
327
382
  EnforcedStyle: only_raise
@@ -344,18 +399,22 @@ Style/SpaceBeforeBlockBraces:
344
399
  Enabled: true
345
400
  Style/SpaceBeforeComment:
346
401
  Enabled: true
347
- Style/SpaceBeforeFirstArg:
348
- Enabled: true
349
402
  Style/SpaceBeforeSemicolon:
350
403
  Enabled: true
351
404
  Style/SpaceAroundKeyword:
352
405
  Enabled: true
406
+ Style/SpaceInLambdaLiteral:
407
+ Enabled: true
408
+ Style/SpaceInsideArrayPercentLiteral:
409
+ Enabled: true
353
410
  Style/SpaceInsideBlockBraces:
354
411
  Enabled: true
355
412
  Style/SpaceInsideHashLiteralBraces:
356
413
  Enabled: true
357
414
  Style/SpaceInsideRangeLiteral:
358
415
  Enabled: true
416
+ Style/SpaceInsideStringInterpolation:
417
+ Enabled: true
359
418
  Style/StabbyLambdaParentheses:
360
419
  Enabled: true
361
420
  # core chef community prefers double quotes over single quotes
@@ -388,6 +447,8 @@ Style/UnneededCapitalW:
388
447
  # Enabled: true
389
448
  Style/VariableName:
390
449
  Enabled: true
450
+ Style/VariableInterpolation:
451
+ Enabled: true
391
452
  Style/WhenThen:
392
453
  Enabled: true
393
454
  Style/WhileUntilDo:
@@ -405,6 +466,8 @@ Style/WordArray:
405
466
  # This is a cop that we /should/ have enabled, but tactically we can't really enable.
406
467
  Style/Documentation:
407
468
  Enabled: false
469
+ Style/DocumentationMethod:
470
+ Enabled: false
408
471
 
409
472
  # this makes whitespace formatting of DSL code impossible
410
473
  Style/SpaceBeforeFirstArg:
@@ -415,6 +478,8 @@ Style/SpaceInsideBrackets:
415
478
  Enabled: false
416
479
  Style/SpaceInsideParens:
417
480
  Enabled: false
481
+ Style/SpaceInsidePercentLiteralDelimiters:
482
+ Enabled: false
418
483
 
419
484
  # more whitespace cops that we allow since they can enhance readability
420
485
  Style/EmptyLinesAroundBlockBody:
@@ -462,3 +527,25 @@ Style/AsciiComments:
462
527
  # Parens around ternaries often make them more readable and reduces cognitive load over operator precidence
463
528
  Style/TernaryParentheses:
464
529
  Enabled: false
530
+
531
+ # Underscores in numbers are super ugly for port numbers, freebsd versions, etc.
532
+ # If we could mandate that this gets turned on only for numbers >= 1e9 which require three _'s then maybe.
533
+ Style/NumericLiterals:
534
+ Enabled: false
535
+
536
+ # I tend to find this more readable than long elsif chains
537
+ Style/EmptyCaseCondition:
538
+ Enabled: false
539
+
540
+ # This didn't quite do what we need
541
+ Style/MultilineArrayBraceLayout:
542
+ Enabled: false
543
+
544
+ # This rule isn't smart enough to figure out accessors vs. things that set stuff on the system (e.g. set_member method in group providers)
545
+ Style/AccessorMethodName:
546
+ Enabled: false
547
+
548
+ # Perl backrefs are just fine and the alternative is a lot of typing.
549
+ Style/PerlBackrefs:
550
+ Enabled: false
551
+
@@ -1,4 +1,8 @@
1
1
  ---
2
+ Bundler/DuplicatedGem:
3
+ Enabled: false
4
+ Bundler/OrderedGems:
5
+ Enabled: false
2
6
  Lint/AmbiguousOperator:
3
7
  Enabled: false
4
8
  Lint/AmbiguousRegexpLiteral:
@@ -17,6 +21,8 @@ Lint/DefEndAlignment:
17
21
  Enabled: false
18
22
  Lint/DeprecatedClassMethods:
19
23
  Enabled: false
24
+ Lint/DuplicateCaseCondition:
25
+ Enabled: false
20
26
  Lint/DuplicateMethods:
21
27
  Enabled: false
22
28
  Lint/DuplicatedKey:
@@ -27,16 +33,18 @@ Lint/ElseLayout:
27
33
  Enabled: false
28
34
  Lint/EmptyEnsure:
29
35
  Enabled: false
36
+ Lint/EmptyExpression:
37
+ Enabled: false
30
38
  Lint/EmptyInterpolation:
31
39
  Enabled: false
40
+ Lint/EmptyWhen:
41
+ Enabled: false
32
42
  Lint/EndAlignment:
33
43
  Enabled: false
34
44
  Lint/EndInMethod:
35
45
  Enabled: false
36
46
  Lint/EnsureReturn:
37
47
  Enabled: false
38
- Lint/Eval:
39
- Enabled: false
40
48
  Lint/FloatOutOfRange:
41
49
  Enabled: false
42
50
  Lint/FormatParameterMismatch:
@@ -57,6 +65,8 @@ Lint/LiteralInInterpolation:
57
65
  Enabled: false
58
66
  Lint/Loop:
59
67
  Enabled: false
68
+ Lint/MultipleCompare:
69
+ Enabled: false
60
70
  Lint/NestedMethodDefinition:
61
71
  Enabled: false
62
72
  Lint/NextWithoutAccumulator:
@@ -75,6 +85,8 @@ Lint/RequireParentheses:
75
85
  Enabled: false
76
86
  Lint/RescueException:
77
87
  Enabled: false
88
+ Lint/SafeNavigationChain:
89
+ Enabled: false
78
90
  Lint/ShadowedException:
79
91
  Enabled: false
80
92
  Lint/ShadowingOuterLocalVariable:
@@ -83,8 +95,12 @@ Lint/StringConversionInInterpolation:
83
95
  Enabled: false
84
96
  Lint/UnderscorePrefixedVariableName:
85
97
  Enabled: false
98
+ Lint/UnifiedInteger:
99
+ Enabled: false
86
100
  Lint/UnneededDisable:
87
101
  Enabled: false
102
+ Lint/UnneededSplatExpansion:
103
+ Enabled: false
88
104
  Lint/UnreachableCode:
89
105
  Enabled: false
90
106
  Lint/UnusedBlockArgument:
@@ -93,8 +109,6 @@ Lint/UnusedMethodArgument:
93
109
  Enabled: false
94
110
  Lint/UselessAccessModifier:
95
111
  Enabled: false
96
- Lint/UselessArraySplat:
97
- Enabled: false
98
112
  Lint/UselessAssignment:
99
113
  Enabled: false
100
114
  Lint/UselessComparison:
@@ -109,6 +123,8 @@ Metrics/CyclomaticComplexity:
109
123
  Enabled: false
110
124
  Metrics/AbcSize:
111
125
  Enabled: false
126
+ Metrics/BlockLength:
127
+ Enabled: false
112
128
  Metrics/BlockNesting:
113
129
  Enabled: false
114
130
  Metrics/ClassLength:
@@ -143,8 +159,6 @@ Performance/HashEachMethods:
143
159
  Enabled: false
144
160
  Performance/LstripRstrip:
145
161
  Enabled: false
146
- Performance/PushSplat:
147
- Enabled: false
148
162
  Performance/RangeInclude:
149
163
  Enabled: false
150
164
  Performance/RedundantBlockCall:
@@ -155,12 +169,16 @@ Performance/RedundantMerge:
155
169
  Enabled: false
156
170
  Performance/RedundantSortBy:
157
171
  Enabled: false
172
+ Performance/RegexpMatch:
173
+ Enabled: false
158
174
  Performance/ReverseEach:
159
175
  Enabled: false
160
176
  Performance/Sample:
161
177
  Enabled: false
162
178
  Performance/Size:
163
179
  Enabled: false
180
+ Performance/CompareWithBlock:
181
+ Enabled: false
164
182
  Performance/StartWith:
165
183
  Enabled: false
166
184
  Performance/StringReplacement:
@@ -241,6 +259,8 @@ Style/DefWithParentheses:
241
259
  Enabled: false
242
260
  Style/PreferredHashMethods:
243
261
  Enabled: false
262
+ Style/DocumentationMethod:
263
+ Enabled: false
244
264
  Style/Documentation:
245
265
  Enabled: false
246
266
  Style/DotPosition:
@@ -273,6 +293,8 @@ Style/EmptyLinesAroundModuleBody:
273
293
  Enabled: false
274
294
  Style/EmptyLiteral:
275
295
  Enabled: false
296
+ Style/EmptyMethod:
297
+ Enabled: false
276
298
  Style/Encoding:
277
299
  Enabled: false
278
300
  Style/EndBlock:
@@ -345,7 +367,9 @@ Style/LeadingCommentSpace:
345
367
  Enabled: false
346
368
  Style/LineEndConcatenation:
347
369
  Enabled: false
348
- Style/MethodCallParentheses:
370
+ Style/MethodCallWithoutArgsParentheses:
371
+ Enabled: false
372
+ Style/MethodCallWithArgsParentheses:
349
373
  Enabled: false
350
374
  Style/MethodCalledOnDoEndBlock:
351
375
  Enabled: false
@@ -371,6 +395,10 @@ Style/MultilineHashBraceLayout:
371
395
  Enabled: false
372
396
  Style/MultilineIfThen:
373
397
  Enabled: false
398
+ Style/MultilineIfModifier:
399
+ Enabled: false
400
+ Style/MultilineMemoization:
401
+ Enabled: false
374
402
  Style/MultilineMethodCallBraceLayout:
375
403
  Enabled: false
376
404
  Style/MultilineMethodCallIndentation:
@@ -449,6 +477,8 @@ Style/RescueEnsureAlignment:
449
477
  Enabled: false
450
478
  Style/RescueModifier:
451
479
  Enabled: false
480
+ Style/SafeNavigation:
481
+ Enabled: false
452
482
  Style/SelfAssignment:
453
483
  Enabled: false
454
484
  Style/Semicolon:
@@ -489,6 +519,8 @@ Style/SpaceBeforeFirstArg:
489
519
  Enabled: false
490
520
  Style/SpaceBeforeSemicolon:
491
521
  Enabled: false
522
+ Style/SpaceInLambdaLiteral:
523
+ Enabled: false
492
524
  Style/SpaceInsideArrayPercentLiteral:
493
525
  Enabled: false
494
526
  Style/SpaceInsideBlockBraces:
@@ -551,6 +583,8 @@ Style/VariableInterpolation:
551
583
  Enabled: false
552
584
  Style/VariableName:
553
585
  Enabled: false
586
+ Style/VariableNumber:
587
+ Enabled: false
554
588
  Style/WhenThen:
555
589
  Enabled: false
556
590
  Style/WhileUntilDo:
@@ -565,16 +599,28 @@ Rails/ActionFilter:
565
599
  Enabled: false
566
600
  Rails/Date:
567
601
  Enabled: false
602
+ Rails/DynamicFindBy:
603
+ Enabled: false
568
604
  Rails/Delegate:
569
605
  Enabled: false
606
+ Rails/DelegateAllowBlank:
607
+ Enabled: false
608
+ Rails/EnumUniqueness:
609
+ Enabled: false
570
610
  Rails/Exit:
571
611
  Enabled: false
612
+ Rails/FilePath:
613
+ Enabled: false
572
614
  Rails/FindBy:
573
615
  Enabled: false
574
616
  Rails/FindEach:
575
617
  Enabled: false
576
618
  Rails/HasAndBelongsToMany:
577
619
  Enabled: false
620
+ Rails/HttpPositionalArguments:
621
+ Enabled: false
622
+ Rails/NotNullColumn:
623
+ Enabled: false
578
624
  Rails/OutputSafety:
579
625
  Enabled: false
580
626
  Rails/Output:
@@ -585,13 +631,27 @@ Rails/ReadWriteAttribute:
585
631
  Enabled: false
586
632
  Rails/RequestReferer:
587
633
  Enabled: false
634
+ Rails/ReversibleMigration:
635
+ Enabled: false
636
+ Rails/SafeNavigation:
637
+ Enabled: false
588
638
  Rails/SaveBang:
589
639
  Enabled: false
590
640
  Rails/ScopeArgs:
591
641
  Enabled: false
642
+ Rails/SkipsModelValidations:
643
+ Enabled: false
592
644
  Rails/TimeZone:
593
645
  Enabled: false
594
646
  Rails/UniqBeforePluck:
595
647
  Enabled: false
596
648
  Rails/Validation:
597
649
  Enabled: false
650
+ Security/Eval:
651
+ Enabled: false
652
+ Security/JSONLoad:
653
+ Enabled: false
654
+ Security/MarshalLoad:
655
+ Enabled: false
656
+ Security/YAMLLoad:
657
+ Enabled: false