Skip to content

Commit 03d4b82

Browse files
DavidSCiaran McCrisken
authored andcommitted
Apply remaining rubocop fixes
1 parent a3e8271 commit 03d4b82

File tree

8 files changed

+85
-76
lines changed

8 files changed

+85
-76
lines changed

.rubocop.yml

Lines changed: 51 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ AllCops:
1818
- "**/Puppetfile"
1919
- "**/Vagrantfile"
2020
- "**/Guardfile"
21+
inherit_from: ".rubocop_todo.yml"
2122
Layout/LineLength:
2223
Description: People have wide screens, use them.
2324
Max: 200
@@ -82,66 +83,26 @@ Performance/BigDecimalWithNumericArgument:
8283
Enabled: true
8384
Performance/BlockGivenWithExplicitBlock:
8485
Enabled: true
85-
Performance/Caller:
86-
Enabled: true
8786
Performance/CaseWhenSplat:
8887
Enabled: true
89-
Performance/Casecmp:
90-
Enabled: true
91-
Performance/CollectionLiteralInLoop:
92-
Enabled: true
93-
Performance/CompareWithBlock:
94-
Enabled: true
9588
Performance/ConstantRegexp:
9689
Enabled: true
97-
Performance/Count:
98-
Enabled: true
99-
Performance/Detect:
100-
Enabled: true
101-
Performance/DoubleStartEndWith:
102-
Enabled: true
103-
Performance/EndWith:
104-
Enabled: true
105-
Performance/FixedSize:
106-
Enabled: true
107-
Performance/FlatMap:
108-
Enabled: true
10990
Performance/MethodObjectAsBlock:
11091
Enabled: true
111-
Performance/RangeInclude:
112-
Enabled: true
113-
Performance/RedundantBlockCall:
114-
Enabled: true
115-
Performance/RedundantMatch:
116-
Enabled: true
117-
Performance/RedundantMerge:
118-
Enabled: true
11992
Performance/RedundantSortBlock:
12093
Enabled: true
12194
Performance/RedundantStringChars:
12295
Enabled: true
123-
Performance/RegexpMatch:
124-
Enabled: true
125-
Performance/ReverseEach:
126-
Enabled: true
12796
Performance/ReverseFirst:
12897
Enabled: true
129-
Performance/Size:
130-
Enabled: true
13198
Performance/SortReverse:
13299
Enabled: true
133100
Performance/Squeeze:
134101
Enabled: true
135-
Performance/StartWith:
136-
Enabled: true
137102
Performance/StringInclude:
138103
Enabled: true
139-
Performance/StringReplacement:
140-
Enabled: true
141104
Performance/Sum:
142105
Enabled: true
143-
Performance/TimesMap:
144-
Enabled: true
145106
Style/CollectionMethods:
146107
Enabled: true
147108
Style/MethodCalledOnDoEndBlock:
@@ -198,20 +159,12 @@ Lint/DeprecatedOpenSSLConstant:
198159
Enabled: false
199160
Lint/DisjunctiveAssignmentInConstructor:
200161
Enabled: false
201-
Lint/DuplicateBranch:
202-
Enabled: false
203162
Lint/DuplicateElsifCondition:
204163
Enabled: false
205-
Lint/DuplicateRegexpCharacterClassElement:
206-
Enabled: false
207164
Lint/DuplicateRequire:
208165
Enabled: false
209166
Lint/DuplicateRescueException:
210167
Enabled: false
211-
Lint/EmptyBlock:
212-
Enabled: false
213-
Lint/EmptyClass:
214-
Enabled: false
215168
Lint/EmptyConditionalBody:
216169
Enabled: false
217170
Lint/EmptyFile:
@@ -232,8 +185,6 @@ Lint/MixedRegexpCaptureTypes:
232185
Enabled: false
233186
Lint/NestedPercentLiteral:
234187
Enabled: false
235-
Lint/NoReturnInBeginEndBlocks:
236-
Enabled: false
237188
Lint/NonDeterministicRequireOrder:
238189
Enabled: false
239190
Lint/OrderedMagicComments:
@@ -268,18 +219,12 @@ Lint/ShadowedArgument:
268219
Enabled: false
269220
Lint/StructNewOverride:
270221
Enabled: false
271-
Lint/ToEnumArguments:
272-
Enabled: false
273222
Lint/ToJSON:
274223
Enabled: false
275224
Lint/TopLevelReturnWithArgument:
276225
Enabled: false
277226
Lint/TrailingCommaInAttributeDeclaration:
278227
Enabled: false
279-
Lint/UnexpectedBlockArity:
280-
Enabled: false
281-
Lint/UnmodifiedReduceAccumulator:
282-
Enabled: false
283228
Lint/UnreachableLoop:
284229
Enabled: false
285230
Lint/UriEscapeUnescape:
@@ -294,6 +239,8 @@ Metrics/AbcSize:
294239
Enabled: false
295240
Metrics/BlockLength:
296241
Enabled: false
242+
Metrics/BlockNesting:
243+
Enabled: false
297244
Metrics/ClassLength:
298245
Enabled: false
299246
Metrics/CyclomaticComplexity:
@@ -308,6 +255,8 @@ Metrics/PerceivedComplexity:
308255
Enabled: false
309256
Migration/DepartmentName:
310257
Enabled: false
258+
Naming/AccessorMethodName:
259+
Enabled: false
311260
Naming/BlockParameterName:
312261
Enabled: false
313262
Naming/HeredocDelimiterCase:
@@ -320,6 +269,20 @@ Naming/MethodParameterName:
320269
Enabled: false
321270
Naming/RescuedExceptionsVariableName:
322271
Enabled: false
272+
Naming/VariableNumber:
273+
Enabled: false
274+
Performance/BindCall:
275+
Enabled: false
276+
Performance/DeletePrefix:
277+
Enabled: false
278+
Performance/DeleteSuffix:
279+
Enabled: false
280+
Performance/InefficientHashSearch:
281+
Enabled: false
282+
Performance/UnfreezeString:
283+
Enabled: false
284+
Performance/UriDefaultParser:
285+
Enabled: false
323286
RSpec/Be:
324287
Enabled: false
325288
RSpec/Capybara/CurrentPathExpectation:
@@ -408,8 +371,6 @@ Style/AccessModifierDeclarations:
408371
Enabled: false
409372
Style/AccessorGrouping:
410373
Enabled: false
411-
Style/ArgumentsForwarding:
412-
Enabled: false
413374
Style/AsciiComments:
414375
Enabled: false
415376
Style/BisectedAttrAccessor:
@@ -418,8 +379,6 @@ Style/CaseLikeIf:
418379
Enabled: false
419380
Style/ClassEqualityComparison:
420381
Enabled: false
421-
Style/CollectionCompact:
422-
Enabled: false
423382
Style/ColonMethodDefinition:
424383
Enabled: false
425384
Style/CombinableLoops:
@@ -428,8 +387,6 @@ Style/CommentedKeyword:
428387
Enabled: false
429388
Style/Dir:
430389
Enabled: false
431-
Style/DocumentDynamicEvalDefinition:
432-
Enabled: false
433390
Style/DoubleCopDisableDirective:
434391
Enabled: false
435392
Style/EmptyBlockParameter:
@@ -468,12 +425,8 @@ Style/MixinUsage:
468425
Enabled: false
469426
Style/MultilineWhenThen:
470427
Enabled: false
471-
Style/NegatedIfElseCondition:
472-
Enabled: false
473428
Style/NegatedUnless:
474429
Enabled: false
475-
Style/NilLambda:
476-
Enabled: false
477430
Style/NumericPredicate:
478431
Enabled: false
479432
Style/OptionalBooleanParameter:
@@ -482,8 +435,6 @@ Style/OrAssignment:
482435
Enabled: false
483436
Style/RandomWithOffset:
484437
Enabled: false
485-
Style/RedundantArgument:
486-
Enabled: false
487438
Style/RedundantAssignment:
488439
Enabled: false
489440
Style/RedundantCondition:
@@ -516,8 +467,6 @@ Style/StringConcatenation:
516467
Enabled: false
517468
Style/Strip:
518469
Enabled: false
519-
Style/SwapValues:
520-
Enabled: false
521470
Style/SymbolProc:
522471
Enabled: false
523472
Style/TrailingBodyOnClass:
@@ -532,3 +481,35 @@ Style/TrailingMethodEndStatement:
532481
Enabled: false
533482
Style/UnpackFirst:
534483
Enabled: false
484+
Lint/DuplicateBranch:
485+
Enabled: false
486+
Lint/DuplicateRegexpCharacterClassElement:
487+
Enabled: false
488+
Lint/EmptyBlock:
489+
Enabled: false
490+
Lint/EmptyClass:
491+
Enabled: false
492+
Lint/NoReturnInBeginEndBlocks:
493+
Enabled: false
494+
Lint/ToEnumArguments:
495+
Enabled: false
496+
Lint/UnexpectedBlockArity:
497+
Enabled: false
498+
Lint/UnmodifiedReduceAccumulator:
499+
Enabled: false
500+
Performance/CollectionLiteralInLoop:
501+
Enabled: false
502+
Style/ArgumentsForwarding:
503+
Enabled: false
504+
Style/CollectionCompact:
505+
Enabled: false
506+
Style/DocumentDynamicEvalDefinition:
507+
Enabled: false
508+
Style/NegatedIfElseCondition:
509+
Enabled: false
510+
Style/NilLambda:
511+
Enabled: false
512+
Style/RedundantArgument:
513+
Enabled: false
514+
Style/SwapValues:
515+
Enabled: false

.rubocop_todo.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# This configuration was generated by
2+
# `rubocop --auto-gen-config`
3+
# on 2020-12-17 20:35:36 UTC using RuboCop version 1.6.1.
4+
# The point is for the user to remove these configuration records
5+
# one by one as the offenses are removed from the code base.
6+
# Note that changes in the inspected code, or installation of new
7+
# versions of RuboCop, may require this file to be generated again.
8+
9+
# Offense count: 6
10+
# Configuration parameters: AllowComments.
11+
Lint/SuppressedException:
12+
Exclude:
13+
- 'lib/facter/facter_dot_d.rb'
14+
- 'lib/puppet/functions/merge.rb'
15+
- 'lib/puppet/parser/functions/getvar.rb'
16+
- 'lib/puppet/parser/functions/has_interface_with.rb'
17+
18+
# Offense count: 62
19+
# Configuration parameters: IgnoreSharedExamples.
20+
RSpec/NamedSubject:
21+
Enabled: false
22+
23+
# Offense count: 2
24+
RSpec/SubjectStub:
25+
Exclude:
26+
- 'spec/unit/facter/facter_dot_d_spec.rb'

.sync.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
".gitlab-ci.yml":
33
delete: true
4+
".rubocop.yml":
5+
include_todos: true
46
".travis.yml":
57
global_env:
68
- HONEYCOMB_WRITEKEY="7f3c63a70eecc61d635917de46bea4e6",HONEYCOMB_DATASET="litmus tests"

lib/facter/root_home.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def returnt_root_home
4040
root_home = nil
4141
setcode do
4242
str = Facter::Util::Resolution.exec('lsuser -c -a home root')
43-
str && str.split("\n").each do |line|
43+
str&.split("\n")&.each do |line|
4444
next if %r{^#}.match?(line)
4545
root_home = line.split(%r{:})[1]
4646
end

lib/puppet/functions/is_a.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
param 'Type', :type
3838
end
3939

40-
def is_a(value, type) # rubocop:disable Style/PredicateName : Used in to many other places to rename at this time, attempting to refactor caused Rubocop to crash.
40+
def is_a(value, type) # rubocop:disable Naming/PredicateName : Used in to many other places to rename at this time, attempting to refactor caused Rubocop to crash.
4141
# See puppet's lib/puppet/pops/evaluator/evaluator_impl.rb eval_MatchExpression
4242
Puppet::Pops::Types::TypeCalculator.instance?(type, value)
4343
end

lib/puppet/parser/functions/assert_private.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module Puppet::Parser::Functions
1919
scope = self
2020
if scope.lookupvar('module_name') != scope.lookupvar('caller_module_name')
2121
message = nil
22-
if args[0] && args[0].is_a?(String)
22+
if args[0]&.is_a?(String)
2323
message = args[0]
2424
else
2525
manifest_name = scope.source.name

lib/puppet/parser/functions/getparam.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
) do |vals|
4949
reference, param = vals
5050
raise(ArgumentError, 'Must specify a reference') unless reference
51-
raise(ArgumentError, 'Must specify name of a parameter') unless param && param.instance_of?(String)
51+
raise(ArgumentError, 'Must specify name of a parameter') unless param&.instance_of?(String)
5252

5353
return '' if param.empty?
5454

lib/puppet/provider/file_line/ruby.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,13 @@ def new_match_regex
9494
end
9595

9696
def count_matches(regex)
97-
lines.select { |line|
97+
lines.count do |line|
9898
if resource[:replace_all_matches_not_matching_line].to_s == 'true'
9999
line.match(regex) unless line.chomp == resource[:line]
100100
else
101101
line.match(regex)
102102
end
103-
}.size
103+
end
104104
end
105105

106106
def handle_create_with_match

0 commit comments

Comments
 (0)