diff options
| author | Markus Roberts <Markus@reality.com> | 2010-07-09 18:07:15 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-07-09 18:07:15 -0700 |
| commit | 543225970225de5697734bfaf0a6eee996802c04 (patch) | |
| tree | ecc6f639c43cf1812e64f9c6ce7eacc0922b57ff /test/lib | |
| parent | 8f15707251cdb58d53e82c4bbd332a38c2d31b4c (diff) | |
| download | puppet-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 'test/lib')
| -rwxr-xr-x | test/lib/puppettest.rb | 14 | ||||
| -rw-r--r-- | test/lib/puppettest/certificates.rb | 2 | ||||
| -rw-r--r-- | test/lib/puppettest/exetest.rb | 4 | ||||
| -rw-r--r-- | test/lib/puppettest/parsertesting.rb | 22 | ||||
| -rw-r--r-- | test/lib/puppettest/servertest.rb | 6 |
5 files changed, 24 insertions, 24 deletions
diff --git a/test/lib/puppettest.rb b/test/lib/puppettest.rb index 46d557341..c8a76267e 100755 --- a/test/lib/puppettest.rb +++ b/test/lib/puppettest.rb @@ -181,8 +181,8 @@ module PuppetTest ) unless defined? $user and $group - $user = nonrootuser().uid.to_s - $group = nonrootgroup().gid.to_s + $user = nonrootuser.uid.to_s + $group = nonrootgroup.gid.to_s end Puppet.settings.clear @@ -194,7 +194,7 @@ module PuppetTest Dir.mkdir(@configpath) unless File.exists?(@configpath) - @@tmpfiles << @configpath << tmpdir() + @@tmpfiles << @configpath << tmpdir @@tmppids = [] @@cleaners = [] @@ -216,7 +216,7 @@ module PuppetTest #else # Puppet::Util::Log.close # Puppet::Util::Log.newdestination(@logs) - # Puppet[:httplog] = tempfile() + # Puppet[:httplog] = tempfile #end Puppet[:ignoreschedules] = true @@ -234,7 +234,7 @@ module PuppetTest @@tmpfilenum = 1 end - f = File.join(self.tmpdir(), "tempfile_" + @@tmpfilenum.to_s) + f = File.join(self.tmpdir, "tempfile_" + @@tmpfilenum.to_s) @@tmpfiles ||= [] @@tmpfiles << f f @@ -245,7 +245,7 @@ module PuppetTest end def tstdir - dir = tempfile() + dir = tempfile Dir.mkdir(dir) dir end @@ -287,7 +287,7 @@ module PuppetTest def teardown #@stop = Time.now #File.open("/tmp/test_times.log", ::File::WRONLY|::File::CREAT|::File::APPEND) { |f| f.puts "%0.4f %s %s" % [@stop - @start, @method_name, self.class] } - @@cleaners.each { |cleaner| cleaner.call() } + @@cleaners.each { |cleaner| cleaner.call } remove_tmp_files diff --git a/test/lib/puppettest/certificates.rb b/test/lib/puppettest/certificates.rb index 9ab64d762..501e36a0f 100644 --- a/test/lib/puppettest/certificates.rb +++ b/test/lib/puppettest/certificates.rb @@ -19,7 +19,7 @@ module PuppetTest::Certificates def mkCA ca = nil assert_nothing_raised { - ca = Puppet::SSLCertificates::CA.new() + ca = Puppet::SSLCertificates::CA.new } ca diff --git a/test/lib/puppettest/exetest.rb b/test/lib/puppettest/exetest.rb index 105ebc11c..67b4b818c 100644 --- a/test/lib/puppettest/exetest.rb +++ b/test/lib/puppettest/exetest.rb @@ -36,7 +36,7 @@ module PuppetTest::ExeTest cmd = cmd.unshift(@ruby).join(" ") out = nil - Dir.chdir(bindir()) { + Dir.chdir(bindir) { out = %x{#{@ruby} #{cmd}} } out @@ -45,7 +45,7 @@ module PuppetTest::ExeTest def startmasterd(args = "") output = nil - manifest = mktestmanifest() + manifest = mktestmanifest args += " --manifest #{manifest}" args += " --confdir #{Puppet[:confdir]}" args += " --rundir #{File.join(Puppet[:vardir], "run")}" diff --git a/test/lib/puppettest/parsertesting.rb b/test/lib/puppettest/parsertesting.rb index 3935322e6..fe85fe95e 100644 --- a/test/lib/puppettest/parsertesting.rb +++ b/test/lib/puppettest/parsertesting.rb @@ -29,11 +29,11 @@ module PuppetTest::ParserTesting end def safeevaluate(*args) - evaluate() + evaluate end def evaluate_match(othervalue, scope, options={}) - value = evaluate() + value = evaluate othervalue == value end end @@ -154,7 +154,7 @@ module PuppetTest::ParserTesting return AST::Name.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :value => name @@ -167,7 +167,7 @@ module PuppetTest::ParserTesting return AST::Type.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :value => name @@ -180,7 +180,7 @@ module PuppetTest::ParserTesting return AST::NodeDef.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :names => nameobj(name), @@ -205,7 +205,7 @@ module PuppetTest::ParserTesting return AST::ResourceInstance.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :children => params @@ -220,7 +220,7 @@ module PuppetTest::ParserTesting return AST::ResourceParam.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :param => param, @@ -233,7 +233,7 @@ module PuppetTest::ParserTesting AST::String.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :value => value @@ -246,7 +246,7 @@ module PuppetTest::ParserTesting return AST::VarDef.new( - :file => tempfile(), + :file => tempfile, :line => rand(100), :name => nameobj(name), @@ -383,7 +383,7 @@ module PuppetTest::ParserTesting bucket = top - file = tempfile() + file = tempfile depth.times do |i| resources = [] width.times do |j| @@ -419,7 +419,7 @@ module PuppetTest::ParserTesting trans = nil scope = nil assert_nothing_raised { - scope = Puppet::Parser::Scope.new() + scope = Puppet::Parser::Scope.new trans = scope.evaluate(:ast => top) } diff --git a/test/lib/puppettest/servertest.rb b/test/lib/puppettest/servertest.rb index df78159c8..4efcedddf 100644 --- a/test/lib/puppettest/servertest.rb +++ b/test/lib/puppettest/servertest.rb @@ -16,9 +16,9 @@ module PuppetTest::ServerTest # create a simple manifest that just creates a file def mktestmanifest file = File.join(Puppet[:confdir], "#{(self.class.to_s + "test")}site.pp") - #@createdfile = File.join(tmpdir(), self.class.to_s + "manifesttesting" + + #@createdfile = File.join(tmpdir, self.class.to_s + "manifesttesting" + # "_#{@method_name}") - @createdfile = tempfile() + @createdfile = tempfile File.open(file, "w") { |f| f.puts "file { \"%s\": ensure => file, mode => 755 }\n" % @createdfile @@ -38,7 +38,7 @@ module PuppetTest::ServerTest handlers = { :CA => {}, # so that certs autogenerate :Master => { - :Manifest => mktestmanifest(), + :Manifest => mktestmanifest, :UseNodes => false }, } |
