summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:06:58 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:06:58 -0700
commit8f15707251cdb58d53e82c4bbd332a38c2d31b4c (patch)
treeb4a5df05fb8121c498cd33b67516d69af3d9853b /lib/puppet
parentc3e2353afb7fc2fb12efd1eb2bc5c342c792fb3b (diff)
downloadpuppet-8f15707251cdb58d53e82c4bbd332a38c2d31b4c.tar.gz
puppet-8f15707251cdb58d53e82c4bbd332a38c2d31b4c.tar.xz
puppet-8f15707251cdb58d53e82c4bbd332a38c2d31b4c.zip
Code smell: Don't restate results directly after assignment
Replaced 33 occurances of ([$@]?\w+)( +[|&+-]{0,2}= .+) \1 end with 3 Examples: The code: @sync ||= Sync.new @sync end becomes: @sync ||= Sync.new end The code: str += "\n" str end becomes: str += "\n" end The code: @indirection = Puppet::Indirector::Indirection.new(self, indirection, options) @indirection end becomes: @indirection = Puppet::Indirector::Indirection.new(self, indirection, options) end
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/agent.rb1
-rwxr-xr-xlib/puppet/external/nagios/base.rb1
-rw-r--r--lib/puppet/indirector.rb1
-rw-r--r--lib/puppet/indirector/indirection.rb1
-rw-r--r--lib/puppet/indirector/node/ldap.rb1
-rw-r--r--lib/puppet/indirector/request.rb1
-rw-r--r--lib/puppet/network/authconfig.rb1
-rw-r--r--lib/puppet/network/client.rb3
-rw-r--r--lib/puppet/network/xmlrpc/client.rb1
-rw-r--r--lib/puppet/property.rb1
-rw-r--r--lib/puppet/provider.rb1
-rw-r--r--lib/puppet/provider/confine/variable.rb1
-rw-r--r--lib/puppet/provider/confiner.rb1
-rw-r--r--lib/puppet/provider/group/ldap.rb1
-rw-r--r--lib/puppet/provider/mcx/mcxcontent.rb1
-rwxr-xr-xlib/puppet/provider/parsedfile.rb1
-rw-r--r--lib/puppet/provider/service/freebsd.rb1
-rw-r--r--lib/puppet/reports/rrdgraph.rb1
-rw-r--r--lib/puppet/simple_graph.rb1
-rw-r--r--lib/puppet/ssl/certificate_authority.rb1
-rw-r--r--lib/puppet/util/cacher.rb2
-rwxr-xr-xlib/puppet/util/filetype.rb1
-rw-r--r--lib/puppet/util/inline_docs.rb1
-rw-r--r--lib/puppet/util/rdoc/generators/puppet_generator.rb1
-rw-r--r--lib/puppet/util/reference.rb1
-rw-r--r--lib/puppet/util/suidmanager.rb1
26 files changed, 0 insertions, 29 deletions
diff --git a/lib/puppet/agent.rb b/lib/puppet/agent.rb
index 58bf5cd42..8d131fbc8 100644
--- a/lib/puppet/agent.rb
+++ b/lib/puppet/agent.rb
@@ -82,7 +82,6 @@ class Puppet::Agent
def sync
@sync ||= Sync.new
- @sync
end
private
diff --git a/lib/puppet/external/nagios/base.rb b/lib/puppet/external/nagios/base.rb
index b526a805a..6e3b0038d 100755
--- a/lib/puppet/external/nagios/base.rb
+++ b/lib/puppet/external/nagios/base.rb
@@ -293,7 +293,6 @@ class Nagios::Base
str += ldapname + ": #{value}\n"
}
str += "\n"
- str
end
def to_s
diff --git a/lib/puppet/indirector.rb b/lib/puppet/indirector.rb
index 125445d23..1caad6c4b 100644
--- a/lib/puppet/indirector.rb
+++ b/lib/puppet/indirector.rb
@@ -28,7 +28,6 @@ module Puppet::Indirector
# instantiate the actual Terminus for that type and this name (:ldap, w/ args :node)
# & hook the instantiated Terminus into this class (Node: @indirection = terminus)
@indirection = Puppet::Indirector::Indirection.new(self, indirection, options)
- @indirection
end
module ClassMethods
diff --git a/lib/puppet/indirector/indirection.rb b/lib/puppet/indirector/indirection.rb
index 282762889..3a59f3ec5 100644
--- a/lib/puppet/indirector/indirection.rb
+++ b/lib/puppet/indirector/indirection.rb
@@ -65,7 +65,6 @@ class Puppet::Indirector::Indirection
# Default to the runinterval for the ttl.
def ttl
@ttl ||= Puppet[:runinterval].to_i
- @ttl
end
# Calculate the expiration date for a returned instance.
diff --git a/lib/puppet/indirector/node/ldap.rb b/lib/puppet/indirector/node/ldap.rb
index c6f17d0bf..93da5a831 100644
--- a/lib/puppet/indirector/node/ldap.rb
+++ b/lib/puppet/indirector/node/ldap.rb
@@ -43,7 +43,6 @@ class Puppet::Node::Ldap < Puppet::Indirector::Ldap
end
info = name2hash('default',name_env,'parent')
- info
end
# Look for our node in ldap.
diff --git a/lib/puppet/indirector/request.rb b/lib/puppet/indirector/request.rb
index faf9a1398..ffc2d3189 100644
--- a/lib/puppet/indirector/request.rb
+++ b/lib/puppet/indirector/request.rb
@@ -22,7 +22,6 @@ class Puppet::Indirector::Request
def environment
@environment ||= Puppet::Node::Environment.new()
- @environment
end
def environment=(env)
diff --git a/lib/puppet/network/authconfig.rb b/lib/puppet/network/authconfig.rb
index b058012f5..932d6da6d 100644
--- a/lib/puppet/network/authconfig.rb
+++ b/lib/puppet/network/authconfig.rb
@@ -7,7 +7,6 @@ module Puppet
def self.main
@main ||= self.new()
- @main
end
# Just proxy the setting methods to our rights stuff
diff --git a/lib/puppet/network/client.rb b/lib/puppet/network/client.rb
index 1d720ccdb..f9c50cd60 100644
--- a/lib/puppet/network/client.rb
+++ b/lib/puppet/network/client.rb
@@ -49,19 +49,16 @@ class Puppet::Network::Client
# client/server stuff. E.g., you could call Client::CA.new(:CA => ca).
def self.drivername
@drivername ||= self.name
- @drivername
end
# Figure out the handler for our client.
def self.handler
@handler ||= Puppet::Network::Handler.handler(self.name)
- @handler
end
# The class that handles xmlrpc interaction for us.
def self.xmlrpc_client
@xmlrpc_client ||= Puppet::Network::XMLRPCClient.handler_class(self.handler)
- @xmlrpc_client
end
# Create our client.
diff --git a/lib/puppet/network/xmlrpc/client.rb b/lib/puppet/network/xmlrpc/client.rb
index 5bcd5fbc9..3afd1dcc7 100644
--- a/lib/puppet/network/xmlrpc/client.rb
+++ b/lib/puppet/network/xmlrpc/client.rb
@@ -151,7 +151,6 @@ module Puppet::Network
def http
@http ||= Puppet::Network::HttpPool.http_instance(host, port, true)
- @http
end
attr_reader :host, :port
diff --git a/lib/puppet/property.rb b/lib/puppet/property.rb
index ba4c2693e..d86c1fdc0 100644
--- a/lib/puppet/property.rb
+++ b/lib/puppet/property.rb
@@ -22,7 +22,6 @@ class Puppet::Property < Puppet::Parameter
# the first value.
def array_matching
@array_matching ||= :first
- @array_matching
end
# Set whether properties should match all values or just the first one.
diff --git a/lib/puppet/provider.rb b/lib/puppet/provider.rb
index 937f114d6..67d008956 100644
--- a/lib/puppet/provider.rb
+++ b/lib/puppet/provider.rb
@@ -175,7 +175,6 @@ class Puppet::Provider
# Retrieve the data source. Defaults to the provider name.
def self.source
@source ||= self.name
- @source
end
# Does this provider support the specified parameter?
diff --git a/lib/puppet/provider/confine/variable.rb b/lib/puppet/provider/confine/variable.rb
index 9dde40aab..84f7e4044 100644
--- a/lib/puppet/provider/confine/variable.rb
+++ b/lib/puppet/provider/confine/variable.rb
@@ -19,7 +19,6 @@ class Puppet::Provider::Confine::Variable < Puppet::Provider::Confine
# Retrieve the value from facter
def facter_value
@facter_value ||= ::Facter.value(name).to_s.downcase
- @facter_value
end
def initialize(values)
diff --git a/lib/puppet/provider/confiner.rb b/lib/puppet/provider/confiner.rb
index 012eaa888..d776b689d 100644
--- a/lib/puppet/provider/confiner.rb
+++ b/lib/puppet/provider/confiner.rb
@@ -7,7 +7,6 @@ module Puppet::Provider::Confiner
def confine_collection
@confine_collection ||= Puppet::Provider::ConfineCollection.new(self.to_s)
- @confine_collection
end
# Check whether this implementation is suitable for our platform.
diff --git a/lib/puppet/provider/group/ldap.rb b/lib/puppet/provider/group/ldap.rb
index a4baa6ec1..d0eca0d50 100644
--- a/lib/puppet/provider/group/ldap.rb
+++ b/lib/puppet/provider/group/ldap.rb
@@ -43,6 +43,5 @@ Puppet::Type.type(:group).provide :ldap, :parent => Puppet::Provider::Ldap do
# Only use the first result.
group = result[0]
gid = group[:gid][0]
- gid
end
end
diff --git a/lib/puppet/provider/mcx/mcxcontent.rb b/lib/puppet/provider/mcx/mcxcontent.rb
index 4711413f8..ba9ca31dd 100644
--- a/lib/puppet/provider/mcx/mcxcontent.rb
+++ b/lib/puppet/provider/mcx/mcxcontent.rb
@@ -178,7 +178,6 @@ Puppet::Type.type(:mcx).provide :mcxcontent, :parent => Puppet::Provider do
return false
end
has_mcx = ! mcx.empty?
- has_mcx
end
def content
diff --git a/lib/puppet/provider/parsedfile.rb b/lib/puppet/provider/parsedfile.rb
index 53585b191..6104c0c8e 100755
--- a/lib/puppet/provider/parsedfile.rb
+++ b/lib/puppet/provider/parsedfile.rb
@@ -35,7 +35,6 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
def self.filetype
@filetype ||= Puppet::Util::FileType.filetype(:flat)
- @filetype
end
def self.filetype=(type)
diff --git a/lib/puppet/provider/service/freebsd.rb b/lib/puppet/provider/service/freebsd.rb
index 3ff81fdfb..f491d70a2 100644
--- a/lib/puppet/provider/service/freebsd.rb
+++ b/lib/puppet/provider/service/freebsd.rb
@@ -18,7 +18,6 @@ Puppet::Type.type(:service).provide :freebsd, :parent => :init do
def rcvar
rcvar = execute([self.initscript, :rcvar], :failonfail => true, :squelch => false)
rcvar = rcvar.split("\n")
- rcvar
end
# Extract service name
diff --git a/lib/puppet/reports/rrdgraph.rb b/lib/puppet/reports/rrdgraph.rb
index c93f13e02..b152faaab 100644
--- a/lib/puppet/reports/rrdgraph.rb
+++ b/lib/puppet/reports/rrdgraph.rb
@@ -23,7 +23,6 @@ Puppet::Reports.register_report(:rrdgraph) do
def hostdir
@hostdir ||= File.join(Puppet[:rrddir], self.host)
- @hostdir
end
def htmlfile(type, graphs, field)
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb
index 027b0fb92..c8ffef529 100644
--- a/lib/puppet/simple_graph.rb
+++ b/lib/puppet/simple_graph.rb
@@ -135,7 +135,6 @@ class Puppet::SimpleGraph
def leaves(vertex, direction = :out)
tree = tree_from_vertex(vertex, direction)
l = tree.keys.find_all { |c| adjacent(c, :direction => direction).empty? }
- l
end
# Collect all of the edges that the passed events match. Returns
diff --git a/lib/puppet/ssl/certificate_authority.rb b/lib/puppet/ssl/certificate_authority.rb
index 00dbf60a1..be74c2fac 100644
--- a/lib/puppet/ssl/certificate_authority.rb
+++ b/lib/puppet/ssl/certificate_authority.rb
@@ -149,7 +149,6 @@ class Puppet::SSL::CertificateAuthority
# Retrieve (or create, if necessary) our inventory manager.
def inventory
@inventory ||= Puppet::SSL::Inventory.new
- @inventory
end
# Generate a new password for the CA.
diff --git a/lib/puppet/util/cacher.rb b/lib/puppet/util/cacher.rb
index df8c28a7d..c87661a3a 100644
--- a/lib/puppet/util/cacher.rb
+++ b/lib/puppet/util/cacher.rb
@@ -89,7 +89,6 @@ module Puppet::Util::Cacher
def cache_timestamp
@cache_timestamp ||= Time.now
- @cache_timestamp
end
def cached_value(name)
@@ -123,7 +122,6 @@ module Puppet::Util::Cacher
def value_cache
@value_cache ||= {}
- @value_cache
end
end
end
diff --git a/lib/puppet/util/filetype.rb b/lib/puppet/util/filetype.rb
index 98aaf8cc1..554ac0566 100755
--- a/lib/puppet/util/filetype.rb
+++ b/lib/puppet/util/filetype.rb
@@ -73,7 +73,6 @@ class Puppet::Util::FileType
# Pick or create a filebucket to use.
def bucket
@bucket ||= Puppet::Type.type(:filebucket).mkdefaultbucket.bucket
- @bucket
end
def initialize(path)
diff --git a/lib/puppet/util/inline_docs.rb b/lib/puppet/util/inline_docs.rb
index 95a8c2ac0..1e5450696 100644
--- a/lib/puppet/util/inline_docs.rb
+++ b/lib/puppet/util/inline_docs.rb
@@ -16,7 +16,6 @@ module Puppet::Util::InlineDocs
def doc
@doc ||= ""
- @doc
end
# don't fetch lexer comment by default
diff --git a/lib/puppet/util/rdoc/generators/puppet_generator.rb b/lib/puppet/util/rdoc/generators/puppet_generator.rb
index a956241a0..24579d6d9 100644
--- a/lib/puppet/util/rdoc/generators/puppet_generator.rb
+++ b/lib/puppet/util/rdoc/generators/puppet_generator.rb
@@ -874,7 +874,6 @@ module Generators
def find_symbol(symbol, method=nil)
res = @context.parent.find_symbol(symbol, method)
res &&= res.viewer
- res
end
end
diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb
index 24da1e5d7..fb4b84f7c 100644
--- a/lib/puppet/util/reference.rb
+++ b/lib/puppet/util/reference.rb
@@ -152,7 +152,6 @@ class Puppet::Util::Reference
#str += text.gsub(/\n/, "\n ")
str += "\n\n"
- str
end
# Remove all trac links.
diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb
index 0fea99e8b..981564646 100644
--- a/lib/puppet/util/suidmanager.rb
+++ b/lib/puppet/util/suidmanager.rb
@@ -24,7 +24,6 @@ module Puppet::Util::SUIDManager
# But 'macosx_productversion_major' requires it.
Facter.loadfacts
@osx_maj_ver = Facter.value('macosx_productversion_major')
- @osx_maj_ver
end
module_function :osx_maj_ver