puppet-lint 3.4.0 → 4.0.0.rc.1

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/lib/puppet-lint/bin.rb +7 -11
  3. data/lib/puppet-lint/checkplugin.rb +4 -8
  4. data/lib/puppet-lint/checks.rb +7 -9
  5. data/lib/puppet-lint/configuration.rb +2 -2
  6. data/lib/puppet-lint/data.rb +35 -39
  7. data/lib/puppet-lint/lexer/string_slurper.rb +2 -3
  8. data/lib/puppet-lint/lexer/token.rb +6 -5
  9. data/lib/puppet-lint/lexer.rb +35 -38
  10. data/lib/puppet-lint/monkeypatches.rb +4 -4
  11. data/lib/puppet-lint/optparser.rb +1 -1
  12. data/lib/puppet-lint/plugins/check_classes/arrow_on_right_operand_line.rb +1 -0
  13. data/lib/puppet-lint/plugins/check_classes/autoloader_layout.rb +2 -4
  14. data/lib/puppet-lint/plugins/check_classes/class_inherits_from_params_class.rb +2 -2
  15. data/lib/puppet-lint/plugins/check_classes/code_on_top_scope.rb +1 -1
  16. data/lib/puppet-lint/plugins/check_classes/nested_classes_or_defines.rb +5 -5
  17. data/lib/puppet-lint/plugins/check_classes/parameter_order.rb +8 -9
  18. data/lib/puppet-lint/plugins/check_classes/variable_scope.rb +32 -34
  19. data/lib/puppet-lint/plugins/check_conditionals/case_without_default.rb +2 -2
  20. data/lib/puppet-lint/plugins/check_documentation/documentation.rb +7 -6
  21. data/lib/puppet-lint/plugins/check_nodes/unquoted_node_name.rb +1 -1
  22. data/lib/puppet-lint/plugins/check_resources/ensure_first_param.rb +3 -5
  23. data/lib/puppet-lint/plugins/check_resources/ensure_not_symlink_target.rb +2 -2
  24. data/lib/puppet-lint/plugins/check_resources/file_mode.rb +6 -6
  25. data/lib/puppet-lint/plugins/check_resources/unquoted_file_mode.rb +4 -4
  26. data/lib/puppet-lint/plugins/check_strings/double_quoted_strings.rb +4 -4
  27. data/lib/puppet-lint/plugins/check_strings/only_variable_string.rb +4 -5
  28. data/lib/puppet-lint/plugins/check_strings/quoted_booleans.rb +4 -4
  29. data/lib/puppet-lint/plugins/check_strings/single_quote_string_with_variables.rb +2 -2
  30. data/lib/puppet-lint/plugins/check_strings/variables_not_enclosed.rb +8 -7
  31. data/lib/puppet-lint/plugins/check_variables/variable_contains_dash.rb +3 -3
  32. data/lib/puppet-lint/plugins/check_variables/variable_is_lowercase.rb +2 -2
  33. data/lib/puppet-lint/plugins/check_whitespace/140chars.rb +1 -0
  34. data/lib/puppet-lint/plugins/check_whitespace/80chars.rb +2 -1
  35. data/lib/puppet-lint/plugins/check_whitespace/arrow_alignment.rb +9 -9
  36. data/lib/puppet-lint/plugins/check_whitespace/hard_tabs.rb +2 -2
  37. data/lib/puppet-lint/plugins/check_whitespace/line_length.rb +6 -6
  38. data/lib/puppet-lint/plugins/legacy_facts/legacy_facts.rb +106 -105
  39. data/lib/puppet-lint/plugins/top_scope_facts/top_scope_facts.rb +3 -2
  40. data/lib/puppet-lint/plugins.rb +3 -4
  41. data/lib/puppet-lint/report/codeclimate.rb +3 -2
  42. data/lib/puppet-lint/report/github.rb +1 -0
  43. data/lib/puppet-lint/tasks/puppet-lint.rb +7 -26
  44. data/lib/puppet-lint/tasks/release_test.rb +4 -4
  45. data/lib/puppet-lint/version.rb +1 -1
  46. data/lib/puppet-lint.rb +5 -3
  47. data/rubocop_baseline.yml +3 -440
  48. data/spec/spec_helper.rb +3 -2
  49. data/spec/spec_helper_acceptance_local.rb +1 -1
  50. data/spec/unit/puppet-lint/bin_spec.rb +12 -2
  51. data/spec/unit/puppet-lint/configuration_spec.rb +14 -14
  52. data/spec/unit/puppet-lint/lexer/string_slurper_spec.rb +3 -5
  53. data/spec/unit/puppet-lint/lexer_spec.rb +10 -11
  54. data/spec/unit/puppet-lint/plugins/check_classes/parameter_order_spec.rb +2 -2
  55. data/spec/unit/puppet-lint/plugins/check_conditionals/case_without_default_spec.rb +5 -5
  56. data/spec/unit/puppet-lint/plugins/check_strings/double_quoted_strings_spec.rb +1 -1
  57. data/spec/unit/puppet-lint/plugins/check_strings/only_variable_string_spec.rb +1 -1
  58. data/spec/unit/puppet-lint/plugins/check_whitespace/140chars_spec.rb +0 -2
  59. data/spec/unit/puppet-lint/plugins/check_whitespace/80chars_spec.rb +1 -3
  60. data/spec/unit/puppet-lint/plugins/legacy_facts/legacy_facts_spec.rb +16 -0
  61. data/spec/unit/puppet-lint/plugins/top_scope_facts/top_scope_facts_spec.rb +1 -0
  62. metadata +5 -5
data/rubocop_baseline.yml CHANGED
@@ -3,6 +3,9 @@ require:
3
3
  - rubocop-performance
4
4
  - rubocop-rspec
5
5
  AllCops:
6
+ NewCops: enable
7
+ ExtraDetails: true
8
+ DisplayStyleGuide: true
6
9
  TargetRubyVersion: '2.7'
7
10
  DisplayCopNames: true
8
11
  SuggestExtensions: false
@@ -78,443 +81,3 @@ Style/Documentation:
78
81
  - spec/**/*
79
82
  Style/WordArray:
80
83
  EnforcedStyle: brackets
81
- Performance/AncestorsInclude:
82
- Enabled: true
83
- Performance/BigDecimalWithNumericArgument:
84
- Enabled: true
85
- Performance/BlockGivenWithExplicitBlock:
86
- Enabled: true
87
- Performance/CaseWhenSplat:
88
- Enabled: true
89
- Performance/ConstantRegexp:
90
- Enabled: true
91
- Performance/MethodObjectAsBlock:
92
- Enabled: true
93
- Performance/RedundantSortBlock:
94
- Enabled: true
95
- Performance/RedundantStringChars:
96
- Enabled: true
97
- Performance/ReverseFirst:
98
- Enabled: true
99
- Performance/SortReverse:
100
- Enabled: true
101
- Performance/Squeeze:
102
- Enabled: true
103
- Performance/StringInclude:
104
- Enabled: true
105
- Performance/Sum:
106
- Enabled: true
107
- Style/CollectionMethods:
108
- Enabled: true
109
- Style/MethodCalledOnDoEndBlock:
110
- Enabled: true
111
- Style/StringMethods:
112
- Enabled: true
113
- Bundler/InsecureProtocolSource:
114
- Enabled: false
115
- Gemspec/DuplicatedAssignment:
116
- Enabled: false
117
- Gemspec/OrderedDependencies:
118
- Enabled: false
119
- Gemspec/RequiredRubyVersion:
120
- Enabled: false
121
- Gemspec/RubyVersionGlobalsUsage:
122
- Enabled: false
123
- Layout/ArgumentAlignment:
124
- Enabled: false
125
- Layout/BeginEndAlignment:
126
- Enabled: false
127
- Layout/ClosingHeredocIndentation:
128
- Enabled: false
129
- Layout/EmptyComment:
130
- Enabled: false
131
- Layout/EmptyLineAfterGuardClause:
132
- Enabled: false
133
- Layout/EmptyLinesAroundArguments:
134
- Enabled: false
135
- Layout/EmptyLinesAroundAttributeAccessor:
136
- Enabled: false
137
- Layout/EndOfLine:
138
- Enabled: false
139
- Layout/FirstArgumentIndentation:
140
- Enabled: false
141
- Layout/HashAlignment:
142
- Enabled: false
143
- Layout/HeredocIndentation:
144
- Enabled: false
145
- Layout/LeadingEmptyLines:
146
- Enabled: false
147
- Layout/SpaceAroundMethodCallOperator:
148
- Enabled: false
149
- Layout/SpaceInsideArrayLiteralBrackets:
150
- Enabled: false
151
- Layout/SpaceInsideReferenceBrackets:
152
- Enabled: false
153
- Lint/BigDecimalNew:
154
- Enabled: false
155
- Lint/BooleanSymbol:
156
- Enabled: false
157
- Lint/ConstantDefinitionInBlock:
158
- Enabled: false
159
- Lint/DeprecatedOpenSSLConstant:
160
- Enabled: false
161
- Lint/DisjunctiveAssignmentInConstructor:
162
- Enabled: false
163
- Lint/DuplicateElsifCondition:
164
- Enabled: false
165
- Lint/DuplicateRequire:
166
- Enabled: false
167
- Lint/DuplicateRescueException:
168
- Enabled: false
169
- Lint/EmptyConditionalBody:
170
- Enabled: false
171
- Lint/EmptyFile:
172
- Enabled: false
173
- Lint/ErbNewArguments:
174
- Enabled: false
175
- Lint/FloatComparison:
176
- Enabled: false
177
- Lint/HashCompareByIdentity:
178
- Enabled: false
179
- Lint/IdentityComparison:
180
- Enabled: false
181
- Lint/InterpolationCheck:
182
- Enabled: false
183
- Lint/MissingCopEnableDirective:
184
- Enabled: false
185
- Lint/MixedRegexpCaptureTypes:
186
- Enabled: false
187
- Lint/NestedPercentLiteral:
188
- Enabled: false
189
- Lint/NonDeterministicRequireOrder:
190
- Enabled: false
191
- Lint/OrderedMagicComments:
192
- Enabled: false
193
- Lint/OutOfRangeRegexpRef:
194
- Enabled: false
195
- Lint/RaiseException:
196
- Enabled: false
197
- Lint/RedundantCopEnableDirective:
198
- Enabled: false
199
- Lint/RedundantRequireStatement:
200
- Enabled: false
201
- Lint/RedundantSafeNavigation:
202
- Enabled: false
203
- Lint/RedundantWithIndex:
204
- Enabled: false
205
- Lint/RedundantWithObject:
206
- Enabled: false
207
- Lint/RegexpAsCondition:
208
- Enabled: false
209
- Lint/ReturnInVoidContext:
210
- Enabled: false
211
- Lint/SafeNavigationConsistency:
212
- Enabled: false
213
- Lint/SafeNavigationWithEmpty:
214
- Enabled: false
215
- Lint/SelfAssignment:
216
- Enabled: false
217
- Lint/SendWithMixinArgument:
218
- Enabled: false
219
- Lint/ShadowedArgument:
220
- Enabled: false
221
- Lint/StructNewOverride:
222
- Enabled: false
223
- Lint/ToJSON:
224
- Enabled: false
225
- Lint/TopLevelReturnWithArgument:
226
- Enabled: false
227
- Lint/TrailingCommaInAttributeDeclaration:
228
- Enabled: false
229
- Lint/UnreachableLoop:
230
- Enabled: false
231
- Lint/UriEscapeUnescape:
232
- Enabled: false
233
- Lint/UriRegexp:
234
- Enabled: false
235
- Lint/UselessMethodDefinition:
236
- Enabled: false
237
- Lint/UselessTimes:
238
- Enabled: false
239
- Metrics/AbcSize:
240
- Enabled: false
241
- Metrics/BlockLength:
242
- Enabled: false
243
- Metrics/BlockNesting:
244
- Enabled: false
245
- Metrics/ClassLength:
246
- Enabled: false
247
- Metrics/CyclomaticComplexity:
248
- Enabled: false
249
- Metrics/MethodLength:
250
- Enabled: false
251
- Metrics/ModuleLength:
252
- Enabled: false
253
- Metrics/ParameterLists:
254
- Enabled: false
255
- Metrics/PerceivedComplexity:
256
- Enabled: false
257
- Migration/DepartmentName:
258
- Enabled: false
259
- Naming/AccessorMethodName:
260
- Enabled: false
261
- Naming/BlockParameterName:
262
- Enabled: false
263
- Naming/HeredocDelimiterCase:
264
- Enabled: false
265
- Naming/HeredocDelimiterNaming:
266
- Enabled: false
267
- Naming/MemoizedInstanceVariableName:
268
- Enabled: false
269
- Naming/MethodParameterName:
270
- Enabled: false
271
- Naming/RescuedExceptionsVariableName:
272
- Enabled: false
273
- Naming/VariableNumber:
274
- Enabled: false
275
- Performance/BindCall:
276
- Enabled: false
277
- Performance/DeletePrefix:
278
- Enabled: false
279
- Performance/DeleteSuffix:
280
- Enabled: false
281
- Performance/InefficientHashSearch:
282
- Enabled: false
283
- Performance/UnfreezeString:
284
- Enabled: false
285
- Performance/UriDefaultParser:
286
- Enabled: false
287
- RSpec/Be:
288
- Enabled: false
289
- RSpec/Capybara/CurrentPathExpectation:
290
- Enabled: false
291
- RSpec/Capybara/FeatureMethods:
292
- Enabled: false
293
- RSpec/Capybara/VisibilityMatcher:
294
- Enabled: false
295
- RSpec/ContextMethod:
296
- Enabled: false
297
- RSpec/ContextWording:
298
- Enabled: false
299
- RSpec/DescribeClass:
300
- Enabled: false
301
- RSpec/EmptyHook:
302
- Enabled: false
303
- RSpec/EmptyLineAfterExample:
304
- Enabled: false
305
- RSpec/EmptyLineAfterExampleGroup:
306
- Enabled: false
307
- RSpec/EmptyLineAfterHook:
308
- Enabled: false
309
- RSpec/ExampleLength:
310
- Enabled: false
311
- RSpec/ExampleWithoutDescription:
312
- Enabled: false
313
- RSpec/ExpectChange:
314
- Enabled: false
315
- RSpec/ExpectInHook:
316
- Enabled: false
317
- RSpec/FactoryBot/AttributeDefinedStatically:
318
- Enabled: false
319
- RSpec/FactoryBot/CreateList:
320
- Enabled: false
321
- RSpec/FactoryBot/FactoryClassName:
322
- Enabled: false
323
- RSpec/HooksBeforeExamples:
324
- Enabled: false
325
- RSpec/ImplicitBlockExpectation:
326
- Enabled: false
327
- RSpec/ImplicitSubject:
328
- Enabled: false
329
- RSpec/LeakyConstantDeclaration:
330
- Enabled: false
331
- RSpec/LetBeforeExamples:
332
- Enabled: false
333
- RSpec/MissingExampleGroupArgument:
334
- Enabled: false
335
- RSpec/MultipleExpectations:
336
- Enabled: false
337
- RSpec/MultipleMemoizedHelpers:
338
- Enabled: false
339
- RSpec/MultipleSubjects:
340
- Enabled: false
341
- RSpec/NestedGroups:
342
- Enabled: false
343
- RSpec/PredicateMatcher:
344
- Enabled: false
345
- RSpec/ReceiveCounts:
346
- Enabled: false
347
- RSpec/ReceiveNever:
348
- Enabled: false
349
- RSpec/RepeatedExampleGroupBody:
350
- Enabled: false
351
- RSpec/RepeatedExampleGroupDescription:
352
- Enabled: false
353
- RSpec/RepeatedIncludeExample:
354
- Enabled: false
355
- RSpec/ReturnFromStub:
356
- Enabled: false
357
- RSpec/SharedExamples:
358
- Enabled: false
359
- RSpec/StubbedMock:
360
- Enabled: false
361
- RSpec/UnspecifiedException:
362
- Enabled: false
363
- RSpec/VariableDefinition:
364
- Enabled: false
365
- RSpec/VoidExpect:
366
- Enabled: false
367
- RSpec/Yield:
368
- Enabled: false
369
- Security/Open:
370
- Enabled: false
371
- Style/AccessModifierDeclarations:
372
- Enabled: false
373
- Style/AccessorGrouping:
374
- Enabled: false
375
- Style/AsciiComments:
376
- Enabled: false
377
- Style/BisectedAttrAccessor:
378
- Enabled: false
379
- Style/CaseLikeIf:
380
- Enabled: false
381
- Style/ClassEqualityComparison:
382
- Enabled: false
383
- Style/ColonMethodDefinition:
384
- Enabled: false
385
- Style/CombinableLoops:
386
- Enabled: false
387
- Style/CommentedKeyword:
388
- Enabled: false
389
- Style/Dir:
390
- Enabled: false
391
- Style/DoubleCopDisableDirective:
392
- Enabled: false
393
- Style/EmptyBlockParameter:
394
- Enabled: false
395
- Style/EmptyLambdaParameter:
396
- Enabled: false
397
- Style/Encoding:
398
- Enabled: false
399
- Style/EvalWithLocation:
400
- Enabled: false
401
- Style/ExpandPathArguments:
402
- Enabled: false
403
- Style/ExplicitBlockArgument:
404
- Enabled: false
405
- Style/ExponentialNotation:
406
- Enabled: false
407
- Style/FloatDivision:
408
- Enabled: false
409
- Style/FrozenStringLiteralComment:
410
- Enabled: false
411
- Style/GlobalStdStream:
412
- Enabled: false
413
- Style/HashAsLastArrayItem:
414
- Enabled: false
415
- Style/HashLikeCase:
416
- Enabled: false
417
- Style/HashTransformKeys:
418
- Enabled: false
419
- Style/HashTransformValues:
420
- Enabled: false
421
- Style/IfUnlessModifier:
422
- Enabled: false
423
- Style/KeywordParametersOrder:
424
- Enabled: false
425
- Style/MinMax:
426
- Enabled: false
427
- Style/MixinUsage:
428
- Enabled: false
429
- Style/MultilineWhenThen:
430
- Enabled: false
431
- Style/NegatedUnless:
432
- Enabled: false
433
- Style/NumericPredicate:
434
- Enabled: false
435
- Style/OptionalBooleanParameter:
436
- Enabled: false
437
- Style/OrAssignment:
438
- Enabled: false
439
- Style/RandomWithOffset:
440
- Enabled: false
441
- Style/RedundantAssignment:
442
- Enabled: false
443
- Style/RedundantCondition:
444
- Enabled: false
445
- Style/RedundantConditional:
446
- Enabled: false
447
- Style/RedundantFetchBlock:
448
- Enabled: false
449
- Style/RedundantFileExtensionInRequire:
450
- Enabled: false
451
- Style/RedundantRegexpCharacterClass:
452
- Enabled: false
453
- Style/RedundantRegexpEscape:
454
- Enabled: false
455
- Style/RedundantSelfAssignment:
456
- Enabled: false
457
- Style/RedundantSort:
458
- Enabled: false
459
- Style/RescueStandardError:
460
- Enabled: false
461
- Style/SingleArgumentDig:
462
- Enabled: false
463
- Style/SlicingWithRange:
464
- Enabled: false
465
- Style/SoleNestedConditional:
466
- Enabled: false
467
- Style/StderrPuts:
468
- Enabled: false
469
- Style/StringConcatenation:
470
- Enabled: false
471
- Style/Strip:
472
- Enabled: false
473
- Style/SymbolProc:
474
- Enabled: false
475
- Style/TrailingBodyOnClass:
476
- Enabled: false
477
- Style/TrailingBodyOnMethodDefinition:
478
- Enabled: false
479
- Style/TrailingBodyOnModule:
480
- Enabled: false
481
- Style/TrailingCommaInHashLiteral:
482
- Enabled: false
483
- Style/TrailingMethodEndStatement:
484
- Enabled: false
485
- Style/UnpackFirst:
486
- Enabled: false
487
- Lint/DuplicateBranch:
488
- Enabled: false
489
- Lint/DuplicateRegexpCharacterClassElement:
490
- Enabled: false
491
- Lint/EmptyBlock:
492
- Enabled: false
493
- Lint/EmptyClass:
494
- Enabled: false
495
- Lint/NoReturnInBeginEndBlocks:
496
- Enabled: false
497
- Lint/ToEnumArguments:
498
- Enabled: false
499
- Lint/UnexpectedBlockArity:
500
- Enabled: false
501
- Lint/UnmodifiedReduceAccumulator:
502
- Enabled: false
503
- Performance/CollectionLiteralInLoop:
504
- Enabled: false
505
- Style/ArgumentsForwarding:
506
- Enabled: false
507
- Style/CollectionCompact:
508
- Enabled: false
509
- Style/DocumentDynamicEvalDefinition:
510
- Enabled: false
511
- Style/NegatedIfElseCondition:
512
- Enabled: false
513
- Style/NilLambda:
514
- Enabled: false
515
- Style/RedundantArgument:
516
- Enabled: false
517
- Style/SwapValues:
518
- Enabled: false
519
- RSpec/FilePath:
520
- Enabled: false
data/spec/spec_helper.rb CHANGED
@@ -23,8 +23,8 @@ module RSpec::LintExampleGroup
23
23
  class HaveProblem
24
24
  def initialize(method, message)
25
25
  @expected_problem = {
26
- kind: method.to_s.gsub(%r{\Acontain_}, '').to_sym,
27
- message: message,
26
+ kind: method.to_s.delete_prefix('contain_').to_sym,
27
+ message: message
28
28
  }
29
29
  @description = ["contain a #{@expected_problem[:kind]}"]
30
30
  end
@@ -100,6 +100,7 @@ module RSpec::LintExampleGroup
100
100
 
101
101
  def method_missing(method, *args, &block)
102
102
  return HaveProblem.new(method, args.first) if method.to_s.start_with?('contain_')
103
+
103
104
  super
104
105
  end
105
106
 
@@ -17,7 +17,7 @@ def puppet_lint(args = [])
17
17
  {
18
18
  stdout: stdout.chomp,
19
19
  stderr: stderr.chomp,
20
- exit_code: status.exitstatus,
20
+ exit_code: status.exitstatus
21
21
  }
22
22
  end
23
23
 
@@ -89,6 +89,7 @@ describe PuppetLint::Bin do
89
89
  end
90
90
 
91
91
  its(:exitstatus) { is_expected.to eq(1) }
92
+
92
93
  its(:stdout) do
93
94
  is_expected.to eq(
94
95
  [
@@ -145,6 +146,7 @@ describe PuppetLint::Bin do
145
146
  end
146
147
 
147
148
  its(:exitstatus) { is_expected.to eq(1) }
149
+
148
150
  its(:stdout) do
149
151
  is_expected.to match(%r{WARNING})
150
152
  is_expected.not_to match(%r{ERROR})
@@ -162,13 +164,14 @@ describe PuppetLint::Bin do
162
164
  end
163
165
 
164
166
  its(:exitstatus) { is_expected.to eq(0) }
167
+
165
168
  its(:stdout) do
166
169
  is_expected.not_to match(%r{ERROR})
167
170
  is_expected.to match(%r{WARNING})
168
171
  end
169
172
  end
170
173
 
171
- context 'when asked to display filenames ' do
174
+ context 'when asked to display filenames' do
172
175
  let(:args) do
173
176
  [
174
177
  '--with-filename',
@@ -200,6 +203,7 @@ describe PuppetLint::Bin do
200
203
  end
201
204
 
202
205
  its(:exitstatus) { is_expected.to eq(0) }
206
+
203
207
  its(:stdout) do
204
208
  is_expected.to eq(
205
209
  [
@@ -294,8 +298,9 @@ describe PuppetLint::Bin do
294
298
  end
295
299
 
296
300
  its(:exitstatus) { is_expected.to eq(1) }
301
+
297
302
  its(:stdout) do
298
- is_expected.to match(%r{^(/|[A-Za-z]\:).+/spec/fixtures/test/manifests/fail\.pp$})
303
+ is_expected.to match(%r{^(/|[A-Za-z]:).+/spec/fixtures/test/manifests/fail\.pp$})
299
304
  end
300
305
  end
301
306
 
@@ -374,6 +379,7 @@ describe PuppetLint::Bin do
374
379
  end
375
380
 
376
381
  its(:exitstatus) { is_expected.to eq(0) }
382
+
377
383
  its(:stdout) do
378
384
  if respond_to?(:include_json)
379
385
  is_expected.to include_json([[{ 'KIND' => 'WARNING' }]])
@@ -393,6 +399,7 @@ describe PuppetLint::Bin do
393
399
  end
394
400
 
395
401
  its(:exitstatus) { is_expected.to eq(1) }
402
+
396
403
  its(:stdout) do
397
404
  if respond_to?(:include_json)
398
405
  is_expected.to include_json([[{ 'KIND' => 'ERROR' }], [{ 'KIND' => 'WARNING' }]])
@@ -493,6 +500,7 @@ describe PuppetLint::Bin do
493
500
  end
494
501
 
495
502
  its(:exitstatus) { is_expected.to eq(0) }
503
+
496
504
  its(:stdout) do
497
505
  is_expected.to eq(
498
506
  [
@@ -615,6 +623,7 @@ describe PuppetLint::Bin do
615
623
  end
616
624
 
617
625
  its(:exitstatus) { is_expected.to eq(0) }
626
+
618
627
  its(:stdout) do
619
628
  is_expected.to eq('WARNING: variable contains a dash on line 3 (check: variable_contains_dash)')
620
629
  end
@@ -629,6 +638,7 @@ describe PuppetLint::Bin do
629
638
  end
630
639
 
631
640
  its(:exitstatus) { is_expected.to eq(0) }
641
+
632
642
  its(:stdout) do
633
643
  is_expected.to eq('WARNING: variable contains an uppercase letter on line 4 (check: variable_is_lowercase)')
634
644
  end
@@ -14,11 +14,11 @@ describe PuppetLint::Configuration do
14
14
 
15
15
  config.disable_foo
16
16
  expect(config.settings['foo_disabled']).to be_truthy
17
- expect(config.foo_enabled?).to be_falsey
17
+ expect(config).not_to be_foo_enabled
18
18
 
19
19
  config.enable_foo
20
20
  expect(config.settings['foo_disabled']).to be_falsey
21
- expect(config.foo_enabled?).to be_truthy
21
+ expect(config).to be_foo_enabled
22
22
  end
23
23
 
24
24
  it 'knows what checks have been added' do
@@ -41,7 +41,7 @@ describe PuppetLint::Configuration do
41
41
  end
42
42
 
43
43
  it 'is able to add options on the fly' do
44
- expect(config.test_option).to eq(nil)
44
+ expect(config.test_option).to be_nil
45
45
 
46
46
  config.test_option = 'test'
47
47
 
@@ -55,18 +55,18 @@ describe PuppetLint::Configuration do
55
55
  end
56
56
 
57
57
  expect(config.settings).to eq(
58
- 'with_filename' => false,
59
- 'fail_on_warnings' => false,
58
+ 'with_filename' => false,
59
+ 'fail_on_warnings' => false,
60
60
  'codeclimate_report_file' => nil,
61
- 'error_level' => :all,
62
- 'log_format' => '',
63
- 'sarif' => false,
64
- 'with_context' => false,
65
- 'fix' => false,
66
- 'github_actions' => false,
67
- 'show_ignored' => false,
68
- 'json' => false,
69
- 'ignore_paths' => ['vendor/**/*.pp'],
61
+ 'error_level' => :all,
62
+ 'log_format' => '',
63
+ 'sarif' => false,
64
+ 'with_context' => false,
65
+ 'fix' => false,
66
+ 'github_actions' => false,
67
+ 'show_ignored' => false,
68
+ 'json' => false,
69
+ 'ignore_paths' => ['vendor/**/*.pp'],
70
70
  )
71
71
  end
72
72
 
@@ -1,5 +1,3 @@
1
- # encoding: utf-8
2
-
3
1
  require 'spec_helper'
4
2
 
5
3
  describe PuppetLint::Lexer::StringSlurper do
@@ -452,13 +450,13 @@ describe PuppetLint::Lexer::StringSlurper do
452
450
  end
453
451
 
454
452
  describe '#consumed_chars' do
455
- subject { described_class.new(string).tap(&:parse).consumed_chars }
453
+ subject(:consumed_chars) { described_class.new(string).tap(&:parse).consumed_chars }
456
454
 
457
455
  context 'when slurping a string containing multibyte characters' do
458
456
  let(:string) { 'accentués"' }
459
457
 
460
458
  it 'counts the multibyte character as a single consumed character' do
461
- is_expected.to eq(10)
459
+ expect(consumed_chars).to eq(10)
462
460
  end
463
461
  end
464
462
 
@@ -466,7 +464,7 @@ describe PuppetLint::Lexer::StringSlurper do
466
464
  let(:string) { '"' }
467
465
 
468
466
  it 'consumes only the closing quote' do
469
- is_expected.to eq(1)
467
+ expect(consumed_chars).to eq(1)
470
468
  end
471
469
  end
472
470
  end