summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/functions
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:07:15 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:07:15 -0700
commit543225970225de5697734bfaf0a6eee996802c04 (patch)
treeecc6f639c43cf1812e64f9c6ce7eacc0922b57ff /lib/puppet/parser/functions
parent8f15707251cdb58d53e82c4bbd332a38c2d31b4c (diff)
downloadpuppet-543225970225de5697734bfaf0a6eee996802c04.tar.gz
puppet-543225970225de5697734bfaf0a6eee996802c04.tar.xz
puppet-543225970225de5697734bfaf0a6eee996802c04.zip
Code smell: Avoid needless decorations
* Replaced 704 occurances of (.*)\b([a-z_]+)\(\) with \1\2 3 Examples: The code: ctx = OpenSSL::SSL::SSLContext.new() becomes: ctx = OpenSSL::SSL::SSLContext.new The code: skip() becomes: skip The code: path = tempfile() becomes: path = tempfile * Replaced 31 occurances of ^( *)end *#.* with \1end 3 Examples: The code: becomes: The code: end # Dir.foreach becomes: end The code: end # def becomes: end
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r--lib/puppet/parser/functions/shellquote.rb6
-rw-r--r--lib/puppet/parser/functions/sprintf.rb4
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/puppet/parser/functions/shellquote.rb b/lib/puppet/parser/functions/shellquote.rb
index 96feaa1ee..888b9769d 100644
--- a/lib/puppet/parser/functions/shellquote.rb
+++ b/lib/puppet/parser/functions/shellquote.rb
@@ -10,7 +10,7 @@ module Puppet::Parser::Functions
with spaces. If an argument is an array, the elements of that
array is interpolated within the rest of the arguments; this makes
it possible to have an array of arguments and pass that array to
- shellquote() instead of having to specify each argument
+ shellquote instead of having to specify each argument
individually in the call.
") \
do |args|
@@ -25,9 +25,9 @@ module Puppet::Parser::Functions
result << ("'" + word + "'")
else
r = '"'
- word.each_byte() do |c|
+ word.each_byte do |c|
r += "\\" if Dangerous.include?(c)
- r += c.chr()
+ r += c.chr
end
r += '"'
result << r
diff --git a/lib/puppet/parser/functions/sprintf.rb b/lib/puppet/parser/functions/sprintf.rb
index 4a3916c89..af0a7213e 100644
--- a/lib/puppet/parser/functions/sprintf.rb
+++ b/lib/puppet/parser/functions/sprintf.rb
@@ -5,9 +5,9 @@ module Puppet::Parser::Functions
:doc => "Perform printf-style formatting of text.
- The first parameter is format string describing how the rest of the parameters should be formatted. See the documentation for the ``Kernel::sprintf()`` function in Ruby for all the details.") do |args|
+ The first parameter is format string describing how the rest of the parameters should be formatted. See the documentation for the ``Kernel::sprintf`` function in Ruby for all the details.") do |args|
raise Puppet::ParseError, 'sprintf() needs at least one argument' if args.length < 1
- fmt = args.shift()
+ fmt = args.shift
return sprintf(fmt, *args)
end
end