Skip to content

Commit 3d8d1e2

Browse files
committed
rubocop fixes
1 parent dc97fe3 commit 3d8d1e2

File tree

272 files changed

+4570
-5218
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

272 files changed

+4570
-5218
lines changed

lib/puppet/functions/stdlib/abs.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,7 @@
4040
repeated_param 'Any', :arguments
4141
end
4242

43-
4443
def default_impl(*arguments)
45-
46-
4744
raise(Puppet::ParseError, "abs(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
4845

4946
value = arguments[0]
@@ -62,7 +59,6 @@ def default_impl(*arguments)
6259
# We have numeric value to handle ...
6360
result = value.abs
6461

65-
return result
66-
62+
result
6763
end
6864
end

lib/puppet/functions/stdlib/any2array.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@
5757
repeated_param 'Any', :arguments
5858
end
5959

60-
6160
def default_impl(*arguments)
62-
63-
6461
if arguments.empty?
6562
return []
6663
end
@@ -75,7 +72,6 @@ def default_impl(*arguments)
7572
end
7673
return result
7774
end
78-
return arguments
79-
75+
arguments
8076
end
8177
end

lib/puppet/functions/stdlib/any2bool.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@
4343
repeated_param 'Any', :arguments
4444
end
4545

46-
4746
def default_impl(*arguments)
48-
49-
5047
raise(Puppet::ParseError, "any2bool(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
5148

5249
# If argument is already Boolean, return it
@@ -79,7 +76,6 @@ def default_impl(*arguments)
7976
return function_str2bool([arguments[0]])
8077
end
8178

82-
return true
83-
79+
true
8480
end
8581
end

lib/puppet/functions/stdlib/assert_private.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@
3535
repeated_param 'Any', :args
3636
end
3737

38-
3938
def default_impl(*args)
40-
41-
4239
raise(Puppet::ParseError, "assert_private(): Wrong number of arguments given (#{args.size}}) for 0 or 1)") if args.size > 1
4340

4441
scope = self
@@ -54,6 +51,5 @@ def default_impl(*args)
5451
end
5552
raise(Puppet::ParseError, message)
5653
end
57-
5854
end
5955
end

lib/puppet/functions/stdlib/base64.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@
5656
repeated_param 'Any', :args
5757
end
5858

59-
6059
def default_impl(*args)
61-
62-
6360
require 'base64'
6461

6562
raise Puppet::ParseError, "base64(): Wrong number of arguments (#{args.length}; must be >= 2)" unless args.length >= 2
@@ -107,7 +104,6 @@ def default_impl(*args)
107104
end
108105
end
109106

110-
return result
111-
107+
result
112108
end
113109
end

lib/puppet/functions/stdlib/basename.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,7 @@
3232
repeated_param 'Any', :arguments
3333
end
3434

35-
3635
def default_impl(*arguments)
37-
38-
3936
raise(Puppet::ParseError, 'basename(): No arguments given') if arguments.empty?
4037
raise(Puppet::ParseError, "basename(): Too many arguments given (#{arguments.size})") if arguments.size > 2
4138
raise(Puppet::ParseError, 'basename(): Requires string as first argument') unless arguments[0].is_a?(String)
@@ -46,7 +43,6 @@ def default_impl(*arguments)
4643
rv = File.basename(arguments[0], arguments[1])
4744
end
4845

49-
return rv
50-
46+
rv
5147
end
5248
end

lib/puppet/functions/stdlib/bool2num.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,14 @@
5151
repeated_param 'Any', :arguments
5252
end
5353

54-
5554
def default_impl(*arguments)
56-
57-
5855
raise(Puppet::ParseError, "bool2num(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
5956

6057
value = function_str2bool([arguments[0]])
6158

6259
# We have real boolean values as well ...
6360
result = value ? 1 : 0
6461

65-
return result
66-
62+
result
6763
end
6864
end

lib/puppet/functions/stdlib/bool2str.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,7 @@
6060
repeated_param 'Any', :arguments
6161
end
6262

63-
6463
def default_impl(*arguments)
65-
66-
6764
unless arguments.size == 1 || arguments.size == 3
6865
raise(Puppet::ParseError, "bool2str(): Wrong number of arguments given (#{arguments.size} for 3)")
6966
end
@@ -82,7 +79,6 @@ def default_impl(*arguments)
8279
raise(Puppet::ParseError, 'bool2str(): Requires strings to convert to')
8380
end
8481

85-
return value ? true_string : false_string
86-
82+
value ? true_string : false_string
8783
end
8884
end

lib/puppet/functions/stdlib/camelcase.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@
3939
repeated_param 'Any', :arguments
4040
end
4141

42-
4342
def default_impl(*arguments)
44-
45-
4643
raise(Puppet::ParseError, "camelcase(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
4744

4845
value = arguments[0]
@@ -59,7 +56,6 @@ def default_impl(*arguments)
5956
value.split('_').map { |e| e.capitalize }.join
6057
end
6158

62-
return result
63-
59+
result
6460
end
6561
end

lib/puppet/functions/stdlib/capitalize.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@
4141
repeated_param 'Any', :arguments
4242
end
4343

44-
4544
def default_impl(*arguments)
46-
47-
4845
raise(Puppet::ParseError, "capitalize(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
4946

5047
value = arguments[0]
@@ -60,7 +57,6 @@ def default_impl(*arguments)
6057
value.capitalize
6158
end
6259

63-
return result
64-
60+
result
6561
end
6662
end

lib/puppet/functions/stdlib/ceiling.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@
3737
repeated_param 'Any', :arguments
3838
end
3939

40-
4140
def default_impl(*arguments)
42-
43-
4441
raise(Puppet::ParseError, "ceiling(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.size != 1
4542

4643
begin
@@ -52,6 +49,5 @@ def default_impl(*arguments)
5249
raise(Puppet::ParseError, "ceiling(): Wrong argument type given (#{arg.class} for Numeric)") if arg.is_a?(Numeric) == false
5350

5451
arg.ceil
55-
5652
end
5753
end

lib/puppet/functions/stdlib/chomp.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# **Deprecated** Removes the record separator from the end of a string or an array of strings.
1717
#
1818
# For example `hello
19-
#` becomes `hello`.
19+
# ` becomes `hello`.
2020
# Requires a single string or array as an input.
2121
#
2222
# > *Note:*
@@ -41,10 +41,7 @@
4141
repeated_param 'Any', :arguments
4242
end
4343

44-
4544
def default_impl(*arguments)
46-
47-
4845
raise(Puppet::ParseError, "chomp(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
4946

5047
value = arguments[0]
@@ -60,7 +57,6 @@ def default_impl(*arguments)
6057
value.chomp
6158
end
6259

63-
return result
64-
60+
result
6561
end
6662
end

lib/puppet/functions/stdlib/chop.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# **Deprecated** Returns a new string with the last character removed.
1717
#
1818
# If the string ends with `
19-
#`, both characters are removed. Applying
19+
# `, both characters are removed. Applying
2020
# chop to an empty string returns an empty string. If you wish to merely
2121
# remove record separators then you should use the `chomp` function.
2222
# Requires a string or array of strings as input.
@@ -41,10 +41,7 @@
4141
repeated_param 'Any', :arguments
4242
end
4343

44-
4544
def default_impl(*arguments)
46-
47-
4845
raise(Puppet::ParseError, "chop(): Wrong number of arguments given (#{arguments.size} for 1)") if arguments.empty?
4946

5047
value = arguments[0]
@@ -60,7 +57,6 @@ def default_impl(*arguments)
6057
value.chop
6158
end
6259

63-
return result
64-
60+
result
6561
end
6662
end

lib/puppet/functions/stdlib/clamp.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,7 @@
4646
repeated_param 'Any', :args
4747
end
4848

49-
5049
def default_impl(*args)
51-
52-
5350
args.flatten!
5451

5552
raise(Puppet::ParseError, 'clamp(): Wrong number of arguments, need three to clamp') if args.size != 3
@@ -67,6 +64,5 @@ def default_impl(*args)
6764
# convert to numeric each element
6865
# then sort them and get a middle value
6966
args.map { |n| n.to_i }.sort[1]
70-
7167
end
7268
end

lib/puppet/functions/stdlib/concat.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@
4545
repeated_param 'Any', :arguments
4646
end
4747

48-
4948
def default_impl(*arguments)
50-
51-
5249
# Check that more than 2 arguments have been given ...
5350
raise(Puppet::ParseError, "concat(): Wrong number of arguments given (#{arguments.size} for < 2)") if arguments.size < 2
5451

@@ -66,7 +63,6 @@ def default_impl(*arguments)
6663
result += (x.is_a?(Array) ? x : [x])
6764
end
6865

69-
return result
70-
66+
result
7167
end
7268
end

lib/puppet/functions/stdlib/convert_base.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,7 @@
5050
repeated_param 'Any', :args
5151
end
5252

53-
5453
def default_impl(*args)
55-
56-
5754
raise Puppet::ParseError, 'convert_base(): First argument must be either a string or an integer' unless args[0].is_a?(Integer) || args[0].is_a?(String)
5855
raise Puppet::ParseError, 'convert_base(): Second argument must be either a string or an integer' unless args[1].is_a?(Integer) || args[1].is_a?(String)
5956

@@ -73,7 +70,6 @@ def default_impl(*args)
7370

7471
raise Puppet::ParseError, 'convert_base(): base must be at least 2 and must not be greater than 36' unless new_base >= 2 && new_base <= 36
7572

76-
return number_to_convert.to_s(new_base)
77-
73+
number_to_convert.to_s(new_base)
7874
end
7975
end

lib/puppet/functions/stdlib/count.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@
4848
repeated_param 'Any', :args
4949
end
5050

51-
5251
def default_impl(*args)
53-
54-
5552
if args.size > 2
5653
raise(ArgumentError, "count(): Wrong number of arguments given #{args.size} for 1 or 2.")
5754
end
@@ -63,6 +60,5 @@ def default_impl(*args)
6360
else
6461
collection.count { |obj| !obj.nil? && obj != :undef && obj != '' }
6562
end
66-
6763
end
6864
end

lib/puppet/functions/stdlib/deep_merge.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@
4545
repeated_param 'Any', :args
4646
end
4747

48-
4948
def default_impl(*args)
50-
51-
5249
if args.length < 2
5350
raise Puppet::ParseError, "deep_merge(): wrong number of arguments (#{args.length}; must be at least 2)"
5451
end
@@ -73,7 +70,6 @@ def default_impl(*args)
7370

7471
result = deep_merge.call(result, arg)
7572
end
76-
return(result)
77-
73+
result
7874
end
7975
end

0 commit comments

Comments
 (0)