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 /spec/unit/parser | |
| 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 'spec/unit/parser')
33 files changed, 47 insertions, 47 deletions
diff --git a/spec/unit/parser/ast/arithmetic_operator_spec.rb b/spec/unit/parser/ast/arithmetic_operator_spec.rb index ad8d9947b..3ebd2691e 100755 --- a/spec/unit/parser/ast/arithmetic_operator_spec.rb +++ b/spec/unit/parser/ast/arithmetic_operator_spec.rb @@ -7,7 +7,7 @@ describe Puppet::Parser::AST::ArithmeticOperator do ast = Puppet::Parser::AST before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @one = stub 'lval', :safeevaluate => 1 @two = stub 'rval', :safeevaluate => 2 end diff --git a/spec/unit/parser/ast/astarray_spec.rb b/spec/unit/parser/ast/astarray_spec.rb index 1791c711c..b9453c967 100755 --- a/spec/unit/parser/ast/astarray_spec.rb +++ b/spec/unit/parser/ast/astarray_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::ASTArray do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should have a [] accessor" do diff --git a/spec/unit/parser/ast/asthash_spec.rb b/spec/unit/parser/ast/asthash_spec.rb index fc8e1c7ea..be3199b8a 100644 --- a/spec/unit/parser/ast/asthash_spec.rb +++ b/spec/unit/parser/ast/asthash_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::ASTHash do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should have a merge functionality" do diff --git a/spec/unit/parser/ast/boolean_operator_spec.rb b/spec/unit/parser/ast/boolean_operator_spec.rb index d8e9603e8..23073159a 100755 --- a/spec/unit/parser/ast/boolean_operator_spec.rb +++ b/spec/unit/parser/ast/boolean_operator_spec.rb @@ -7,7 +7,7 @@ describe Puppet::Parser::AST::BooleanOperator do ast = Puppet::Parser::AST before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @true_ast = ast::Boolean.new( :value => true) @false_ast = ast::Boolean.new( :value => false) end diff --git a/spec/unit/parser/ast/casestatement_spec.rb b/spec/unit/parser/ast/casestatement_spec.rb index 187dd5822..dca8e5adb 100755 --- a/spec/unit/parser/ast/casestatement_spec.rb +++ b/spec/unit/parser/ast/casestatement_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::CaseStatement do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating" do @@ -150,7 +150,7 @@ describe Puppet::Parser::AST::CaseStatement do tests.each do |should, values| values.each do |value| - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @scope.setvar("testparam", value) result = ast.evaluate(@scope) diff --git a/spec/unit/parser/ast/collexpr_spec.rb b/spec/unit/parser/ast/collexpr_spec.rb index 4dfc1e97a..2aefe2f9d 100755 --- a/spec/unit/parser/ast/collexpr_spec.rb +++ b/spec/unit/parser/ast/collexpr_spec.rb @@ -7,7 +7,7 @@ describe Puppet::Parser::AST::CollExpr do ast = Puppet::Parser::AST before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating with two operands" do diff --git a/spec/unit/parser/ast/comparison_operator_spec.rb b/spec/unit/parser/ast/comparison_operator_spec.rb index 51f4cc516..0ef9117af 100755 --- a/spec/unit/parser/ast/comparison_operator_spec.rb +++ b/spec/unit/parser/ast/comparison_operator_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::ComparisonOperator do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @one = stub 'one', :safeevaluate => "1" @two = stub 'two', :safeevaluate => "2" end diff --git a/spec/unit/parser/ast/ifstatement_spec.rb b/spec/unit/parser/ast/ifstatement_spec.rb index 83121cddd..c1f3305ea 100755 --- a/spec/unit/parser/ast/ifstatement_spec.rb +++ b/spec/unit/parser/ast/ifstatement_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::IfStatement do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating" do diff --git a/spec/unit/parser/ast/in_operator_spec.rb b/spec/unit/parser/ast/in_operator_spec.rb index 9d3cab712..15128d894 100644 --- a/spec/unit/parser/ast/in_operator_spec.rb +++ b/spec/unit/parser/ast/in_operator_spec.rb @@ -6,7 +6,7 @@ require 'puppet/parser/ast/in_operator' describe Puppet::Parser::AST::InOperator do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @lval = stub 'lval' @lval.stubs(:safeevaluate).with(@scope).returns("left") diff --git a/spec/unit/parser/ast/match_operator_spec.rb b/spec/unit/parser/ast/match_operator_spec.rb index 985cf60d5..e76d076a9 100755 --- a/spec/unit/parser/ast/match_operator_spec.rb +++ b/spec/unit/parser/ast/match_operator_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::MatchOperator do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @lval = stub 'lval' @lval.stubs(:safeevaluate).with(@scope).returns("this is a string") diff --git a/spec/unit/parser/ast/minus_spec.rb b/spec/unit/parser/ast/minus_spec.rb index 782fd3e0c..a2c5a785b 100755 --- a/spec/unit/parser/ast/minus_spec.rb +++ b/spec/unit/parser/ast/minus_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::Minus do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should evaluate its argument" do diff --git a/spec/unit/parser/ast/not_spec.rb b/spec/unit/parser/ast/not_spec.rb index a3bf0b85d..3e8b36183 100755 --- a/spec/unit/parser/ast/not_spec.rb +++ b/spec/unit/parser/ast/not_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::Not do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @true_ast = Puppet::Parser::AST::Boolean.new( :value => true) @false_ast = Puppet::Parser::AST::Boolean.new( :value => false) end diff --git a/spec/unit/parser/ast/resource_reference_spec.rb b/spec/unit/parser/ast/resource_reference_spec.rb index ee42694b9..a2a11e270 100755 --- a/spec/unit/parser/ast/resource_reference_spec.rb +++ b/spec/unit/parser/ast/resource_reference_spec.rb @@ -7,7 +7,7 @@ describe Puppet::Parser::AST::ResourceReference do ast = Puppet::Parser::AST before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end def newref(type, title) diff --git a/spec/unit/parser/ast/selector_spec.rb b/spec/unit/parser/ast/selector_spec.rb index f32310b92..e10849c4c 100755 --- a/spec/unit/parser/ast/selector_spec.rb +++ b/spec/unit/parser/ast/selector_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::Selector do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating" do diff --git a/spec/unit/parser/ast/vardef_spec.rb b/spec/unit/parser/ast/vardef_spec.rb index 369a9f847..e133b675e 100755 --- a/spec/unit/parser/ast/vardef_spec.rb +++ b/spec/unit/parser/ast/vardef_spec.rb @@ -4,7 +4,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe Puppet::Parser::AST::VarDef do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end describe "when evaluating" do diff --git a/spec/unit/parser/collector_spec.rb b/spec/unit/parser/collector_spec.rb index de5fc8015..c414207fa 100755 --- a/spec/unit/parser/collector_spec.rb +++ b/spec/unit/parser/collector_spec.rb @@ -337,7 +337,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should convert all found resources into parser resources" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) one = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :ref => "one" @@ -358,7 +358,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should override all exported collected resources if collector has an override" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) one = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :ref => "one" @@ -387,7 +387,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should store converted resources in the compile's resource list" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) one = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :ref => "one" @@ -409,7 +409,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do # This way one host doesn't store another host's resources as exported. it "should mark resources collected from the database as not exported" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) one = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :ref => "one" @@ -430,7 +430,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should fail if an equivalent resource already exists in the compile" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) rails = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :id => 1, :ref => "yay" @@ -449,7 +449,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources" do end it "should ignore exported resources that match already-collected resources" do - stub_rails() + stub_rails Puppet::Rails::Host.stubs(:find_by_name).returns(nil) rails = stub 'one', :restype => "Mytype", :title => "one", :virtual? => true, :exported? => true, :id => 1, :ref => "yay" diff --git a/spec/unit/parser/functions/fqdn_rand_spec.rb b/spec/unit/parser/functions/fqdn_rand_spec.rb index cde899eef..07390ed42 100644 --- a/spec/unit/parser/functions/fqdn_rand_spec.rb +++ b/spec/unit/parser/functions/fqdn_rand_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the fqdn_rand function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/generate_spec.rb b/spec/unit/parser/functions/generate_spec.rb index 75a5d6dac..27a11aabf 100755 --- a/spec/unit/parser/functions/generate_spec.rb +++ b/spec/unit/parser/functions/generate_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the generate function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/inline_template_spec.rb b/spec/unit/parser/functions/inline_template_spec.rb index 19e1a3b2a..1da85513a 100755 --- a/spec/unit/parser/functions/inline_template_spec.rb +++ b/spec/unit/parser/functions/inline_template_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the inline_template function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/realize_spec.rb b/spec/unit/parser/functions/realize_spec.rb index d9c94b143..4a55ad417 100755 --- a/spec/unit/parser/functions/realize_spec.rb +++ b/spec/unit/parser/functions/realize_spec.rb @@ -6,7 +6,7 @@ describe "the realize function" do before :each do @collector = stub_everything 'collector' - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @compiler = stub 'compiler' @compiler.stubs(:add_collection).with(@collector) @scope.stubs(:compiler).returns(@compiler) diff --git a/spec/unit/parser/functions/regsubst_spec.rb b/spec/unit/parser/functions/regsubst_spec.rb index 6ff619f8d..d87b4d9ab 100755 --- a/spec/unit/parser/functions/regsubst_spec.rb +++ b/spec/unit/parser/functions/regsubst_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the regsubst function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/require_spec.rb b/spec/unit/parser/functions/require_spec.rb index 45769ccbe..48769d16c 100755 --- a/spec/unit/parser/functions/require_spec.rb +++ b/spec/unit/parser/functions/require_spec.rb @@ -8,7 +8,7 @@ describe "the require function" do @catalog = stub 'catalog' @compiler = stub 'compiler', :catalog => @catalog - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @scope.stubs(:findresource) @scope.stubs(:compiler).returns(@compiler) @klass = stub 'class', :name => "myclass" diff --git a/spec/unit/parser/functions/shellquote_spec.rb b/spec/unit/parser/functions/shellquote_spec.rb index 8286be32e..e4eeaeba8 100755 --- a/spec/unit/parser/functions/shellquote_spec.rb +++ b/spec/unit/parser/functions/shellquote_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the shellquote function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/split_spec.rb b/spec/unit/parser/functions/split_spec.rb index 3d0240af4..d76c253b0 100755 --- a/spec/unit/parser/functions/split_spec.rb +++ b/spec/unit/parser/functions/split_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the split function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/sprintf_spec.rb b/spec/unit/parser/functions/sprintf_spec.rb index 71921e0e0..3795479e4 100755 --- a/spec/unit/parser/functions/sprintf_spec.rb +++ b/spec/unit/parser/functions/sprintf_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the sprintf function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/tag_spec.rb b/spec/unit/parser/functions/tag_spec.rb index 5fb467e59..4f08afedf 100755 --- a/spec/unit/parser/functions/tag_spec.rb +++ b/spec/unit/parser/functions/tag_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the 'tag' function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/template_spec.rb b/spec/unit/parser/functions/template_spec.rb index 8fc64d0c3..87c7d5d24 100755 --- a/spec/unit/parser/functions/template_spec.rb +++ b/spec/unit/parser/functions/template_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the template function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions/versioncmp_spec.rb b/spec/unit/parser/functions/versioncmp_spec.rb index 0595f8711..d57ea57ad 100755 --- a/spec/unit/parser/functions/versioncmp_spec.rb +++ b/spec/unit/parser/functions/versioncmp_spec.rb @@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../../../spec_helper' describe "the versioncmp function" do before :each do - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new end it "should exist" do diff --git a/spec/unit/parser/functions_spec.rb b/spec/unit/parser/functions_spec.rb index f605052b5..ee551a147 100644 --- a/spec/unit/parser/functions_spec.rb +++ b/spec/unit/parser/functions_spec.rb @@ -25,7 +25,7 @@ describe Puppet::Parser::Functions do end it "should use the current default environment if no environment is provided" do - Puppet::Parser::Functions.environment_module().should be_instance_of(Module) + Puppet::Parser::Functions.environment_module.should be_instance_of(Module) end describe "when calling newfunction" do diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb index d583d4938..c31b1b275 100755 --- a/spec/unit/parser/lexer_spec.rb +++ b/spec/unit/parser/lexer_spec.rb @@ -134,7 +134,7 @@ end describe Puppet::Parser::Lexer::TOKENS do before do - @lexer = Puppet::Parser::Lexer.new() + @lexer = Puppet::Parser::Lexer.new end { @@ -562,7 +562,7 @@ describe "Puppet::Parser::Lexer in the old tests" do end it "should fail if the string is not set" do - lambda { @lexer.fullscan() }.should raise_error(Puppet::LexError) + lambda { @lexer.fullscan }.should raise_error(Puppet::LexError) end it "should correctly identify keywords" do @@ -630,11 +630,11 @@ require 'puppettest/support/utils' describe "Puppet::Parser::Lexer in the old tests when lexing example files" do extend PuppetTest extend PuppetTest::Support::Utils - textfiles() do |file| + textfiles do |file| it "should correctly lex #{file}" do - lexer = Puppet::Parser::Lexer.new() + lexer = Puppet::Parser::Lexer.new lexer.file = file - lambda { lexer.fullscan() }.should_not raise_error + lambda { lexer.fullscan }.should_not raise_error end end end diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb index 53a16e62a..42d515d29 100755 --- a/spec/unit/parser/parser_spec.rb +++ b/spec/unit/parser/parser_spec.rb @@ -254,7 +254,7 @@ describe Puppet::Parser do end it "should not include the docs by default" do - @parser.ast_context()[:doc].should be_nil + @parser.ast_context[:doc].should be_nil end end diff --git a/spec/unit/parser/scope_spec.rb b/spec/unit/parser/scope_spec.rb index ed965af14..035d49c84 100755 --- a/spec/unit/parser/scope_spec.rb +++ b/spec/unit/parser/scope_spec.rb @@ -4,10 +4,10 @@ require File.dirname(__FILE__) + '/../../spec_helper' describe Puppet::Parser::Scope do before :each do - @topscope = Puppet::Parser::Scope.new() + @topscope = Puppet::Parser::Scope.new # This is necessary so we don't try to use the compiler to discover our parent. @topscope.parent = nil - @scope = Puppet::Parser::Scope.new() + @scope = Puppet::Parser::Scope.new @scope.compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("foo")) @scope.parent = @topscope end @@ -72,7 +72,7 @@ describe Puppet::Parser::Scope do Puppet::Parser::Functions.expects(:environment_module).with(nil).returns mod - Puppet::Parser::Scope.new().singleton_class.ancestors.should be_include(mod) + Puppet::Parser::Scope.new.singleton_class.ancestors.should be_include(mod) end end diff --git a/spec/unit/parser/templatewrapper_spec.rb b/spec/unit/parser/templatewrapper_spec.rb index 9a16666fd..a684727de 100755 --- a/spec/unit/parser/templatewrapper_spec.rb +++ b/spec/unit/parser/templatewrapper_spec.rb @@ -96,20 +96,20 @@ describe Puppet::Parser::TemplateWrapper do catalog = mock 'catalog', :classes => ["class1", "class2"] @scope.expects(:catalog).returns( catalog ) tw = Puppet::Parser::TemplateWrapper.new(@scope) - tw.classes().should == ["class1", "class2"] + tw.classes.should == ["class1", "class2"] end it "should allow you to retrieve all the tags with all_tags" do catalog = mock 'catalog', :tags => ["tag1", "tag2"] @scope.expects(:catalog).returns( catalog ) tw = Puppet::Parser::TemplateWrapper.new(@scope) - tw.all_tags().should == ["tag1","tag2"] + tw.all_tags.should == ["tag1","tag2"] end it "should allow you to retrieve the tags defined in the current scope" do @scope.expects(:tags).returns( ["tag1", "tag2"] ) tw = Puppet::Parser::TemplateWrapper.new(@scope) - tw.tags().should == ["tag1","tag2"] + tw.tags.should == ["tag1","tag2"] end it "should set all of the scope's variables as instance variables" do |
