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/other | |
| 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/other')
| -rwxr-xr-x | test/other/puppet.rb | 4 | ||||
| -rwxr-xr-x | test/other/relationships.rb | 4 | ||||
| -rwxr-xr-x | test/other/report.rb | 4 | ||||
| -rwxr-xr-x | test/other/transactions.rb | 20 |
4 files changed, 16 insertions, 16 deletions
diff --git a/test/other/puppet.rb b/test/other/puppet.rb index 1f81bb781..7caba8996 100755 --- a/test/other/puppet.rb +++ b/test/other/puppet.rb @@ -61,8 +61,8 @@ class TestPuppetModule < Test::Unit::TestCase $LOAD_PATH.delete(dir) unless oldlibs.include?(dir) end end - one = tempfile() - two = tempfile() + one = tempfile + two = tempfile Dir.mkdir(one) Dir.mkdir(two) diff --git a/test/other/relationships.rb b/test/other/relationships.rb index 3ca944670..c270be75e 100755 --- a/test/other/relationships.rb +++ b/test/other/relationships.rb @@ -13,7 +13,7 @@ class TestRelationships < Test::Unit::TestCase end def newfile - assert_nothing_raised() { + assert_nothing_raised { return Puppet::Type.type(:file).new( @@ -57,7 +57,7 @@ class TestRelationships < Test::Unit::TestCase def test_autorequire # We know that execs autorequire their cwd, so we'll use that - path = tempfile() + path = tempfile file = Puppet::Type.type(:file).new( diff --git a/test/other/report.rb b/test/other/report.rb index d15fb5505..862e50672 100755 --- a/test/other/report.rb +++ b/test/other/report.rb @@ -16,7 +16,7 @@ class TestReports < Test::Unit::TestCase # First do some work objects = [] 6.times do |i| - file = tempfile() + file = tempfile # Make every third file File.open(file, "w") { |f| f.puts "" } if i % 3 == 0 @@ -50,7 +50,7 @@ class TestReports < Test::Unit::TestCase } # Now make a file for testing logging - file = Puppet::Type.type(:file).new(:path => tempfile(), :ensure => "file") + file = Puppet::Type.type(:file).new(:path => tempfile, :ensure => "file") file.finish log = nil diff --git a/test/other/transactions.rb b/test/other/transactions.rb index dd5348e33..26fc0b642 100755 --- a/test/other/transactions.rb +++ b/test/other/transactions.rb @@ -13,7 +13,7 @@ class TestTransactions < Test::Unit::TestCase include PuppetTest::Support::Resources include PuppetTest::Support::Utils class Fakeprop <Puppet::Property - initvars() + initvars attr_accessor :path, :is, :should, :name def should_to_s(value) @@ -56,7 +56,7 @@ class TestTransactions < Test::Unit::TestCase # Create a new type that generates instances with shorter names. def mkreducer(&block) - type = mkgenerator() do + type = mkgenerator do def eval_generate ret = [] if title.length > 1 @@ -105,7 +105,7 @@ class TestTransactions < Test::Unit::TestCase assert_equal({inst.title => inst}, $prefetched, "type prefetch was not called") - # Now make sure it gets called from within evaluate() + # Now make sure it gets called from within evaluate $prefetched = false assert_nothing_raised do trans.evaluate @@ -117,7 +117,7 @@ class TestTransactions < Test::Unit::TestCase # We need to generate resources before we prefetch them, else generated # resources that require prefetching don't work. def test_generate_before_prefetch - config = mk_catalog() + config = mk_catalog trans = Puppet::Transaction.new(config) generate = nil @@ -127,7 +127,7 @@ class TestTransactions < Test::Unit::TestCase trans.prepare return - resource = Puppet::Type.type(:file).new :ensure => :present, :path => tempfile() + resource = Puppet::Type.type(:file).new :ensure => :present, :path => tempfile other_resource = mock 'generated' def resource.generate [other_resource] @@ -186,8 +186,8 @@ class TestTransactions < Test::Unit::TestCase # Make sure changes in contained files still generate callback events. def test_generated_callbacks - dir = tempfile() - maker = tempfile() + dir = tempfile + maker = tempfile Dir.mkdir(dir) file = File.join(dir, "file") File.open(file, "w") { |f| f.puts "" } @@ -203,7 +203,7 @@ class TestTransactions < Test::Unit::TestCase assert(FileTest.exists?(maker), "Did not make callback file") end - # Testing #401 -- transactions are calling refresh() on classes that don't support it. + # Testing #401 -- transactions are calling refresh on classes that don't support it. def test_callback_availability $called = [] klass = Puppet::Type.newtype(:norefresh) do @@ -217,7 +217,7 @@ class TestTransactions < Test::Unit::TestCase Puppet::Type.rmtype(:norefresh) end - file = Puppet::Type.type(:file).new :path => tempfile(), :content => "yay" + file = Puppet::Type.type(:file).new :path => tempfile, :content => "yay" one = klass.new :name => "one", :subscribe => file assert_apply(file, one) @@ -291,7 +291,7 @@ class TestTransactions < Test::Unit::TestCase rels = {} # Now add the explicit relationship # Now files - d = tempfile() + d = tempfile f = File.join(d, "file") file = Puppet::Type.type(:file).new(:path => f, :content => "yay") dir = Puppet::Type.type(:file).new(:path => d, :ensure => :directory, :require => file) |
