diff options
| author | Markus Roberts <Markus@reality.com> | 2010-07-09 18:06:33 -0700 |
|---|---|---|
| committer | Markus Roberts <Markus@reality.com> | 2010-07-09 18:06:33 -0700 |
| commit | 8d1fbe4586c91682cdda0cb271649e918fd9778b (patch) | |
| tree | 314508ca21830874d9e4ec6e27880fede14193bd /lib/puppet/util | |
| parent | 889158ad57e33df083613d6f7d136b2e11aaa16a (diff) | |
Code smell: Avoid explicit returns
Replaced 583 occurances of
(DEF)
(LINES)
return (.*)
end
with
3 Examples:
The code:
def consolidate_failures(failed)
filters = Hash.new { |h,k| h[k] = [] }
failed.each do |spec, failed_trace|
if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) }
filters[f] << spec
break
end
end
return filters
end
becomes:
def consolidate_failures(failed)
filters = Hash.new { |h,k| h[k] = [] }
failed.each do |spec, failed_trace|
if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) }
filters[f] << spec
break
end
end
filters
end
The code:
def retrieve
return_value = super
return_value = return_value[0] if return_value && return_value.is_a?(Array)
return return_value
end
becomes:
def retrieve
return_value = super
return_value = return_value[0] if return_value && return_value.is_a?(Array)
return_value
end
The code:
def fake_fstab
os = Facter['operatingsystem']
if os == "Solaris"
name = "solaris.fstab"
elsif os == "FreeBSD"
name = "freebsd.fstab"
else
# Catchall for other fstabs
name = "linux.fstab"
end
oldpath = @provider_class.default_target
return fakefile(File::join("data/types/mount", name))
end
becomes:
def fake_fstab
os = Facter['operatingsystem']
if os == "Solaris"
name = "solaris.fstab"
elsif os == "FreeBSD"
name = "freebsd.fstab"
else
# Catchall for other fstabs
name = "linux.fstab"
end
oldpath = @provider_class.default_target
fakefile(File::join("data/types/mount", name))
end
Diffstat (limited to 'lib/puppet/util')
30 files changed, 89 insertions, 89 deletions
diff --git a/lib/puppet/util/autoload/file_cache.rb b/lib/puppet/util/autoload/file_cache.rb index 44d988969..7303c9a1c 100644 --- a/lib/puppet/util/autoload/file_cache.rb +++ b/lib/puppet/util/autoload/file_cache.rb @@ -59,7 +59,7 @@ module Puppet::Util::Autoload::FileCache end def missing_file?(path) - return !!(time = missing_files[path] and ! data_expired?(time)) + !!(time = missing_files[path] and ! data_expired?(time)) end def missing_file(path) diff --git a/lib/puppet/util/cacher.rb b/lib/puppet/util/cacher.rb index bcd4c1bc1..d229c40ca 100644 --- a/lib/puppet/util/cacher.rb +++ b/lib/puppet/util/cacher.rb @@ -12,7 +12,7 @@ module Puppet::Util::Cacher def dependent_data_expired?(ts) return false unless timestamp - return timestamp > ts + timestamp > ts end end @@ -108,7 +108,7 @@ module Puppet::Util::Cacher if expirer.nil? return true unless self.class.attr_ttl(name) end - return expirer.dependent_data_expired?(cache_timestamp) + expirer.dependent_data_expired?(cache_timestamp) end def expired_by_ttl?(name) @@ -118,7 +118,7 @@ module Puppet::Util::Cacher @ttl_timestamps ||= {} @ttl_timestamps[name] ||= Time.now - return (Time.now - @ttl_timestamps[name]) > ttl + (Time.now - @ttl_timestamps[name]) > ttl end def value_cache diff --git a/lib/puppet/util/checksums.rb b/lib/puppet/util/checksums.rb index 7b3ef6e15..a05cc0e4f 100644 --- a/lib/puppet/util/checksums.rb +++ b/lib/puppet/util/checksums.rb @@ -8,12 +8,12 @@ module Puppet::Util::Checksums # Strip the checksum type from an existing checksum def sumdata(checksum) - return checksum =~ /^\{(\w+)\}(.+)/ ? $2 : nil + checksum =~ /^\{(\w+)\}(.+)/ ? $2 : nil end # Strip the checksum type from an existing checksum def sumtype(checksum) - return checksum =~ /^\{(\w+)\}/ ? $1 : nil + checksum =~ /^\{(\w+)\}/ ? $1 : nil end # Calculate a checksum using Digest::MD5. @@ -32,7 +32,7 @@ module Puppet::Util::Checksums require 'digest/md5' digest = Digest::MD5.new() - return checksum_file(digest, filename, lite) + checksum_file(digest, filename, lite) end # Calculate a checksum of the first 500 chars of a file's content using Digest::MD5. @@ -44,7 +44,7 @@ module Puppet::Util::Checksums require 'digest/md5' digest = Digest::MD5.new() yield digest - return digest.hexdigest + digest.hexdigest end alias :md5lite_stream :md5_stream @@ -77,7 +77,7 @@ module Puppet::Util::Checksums require 'digest/sha1' digest = Digest::SHA1.new() - return checksum_file(digest, filename, lite) + checksum_file(digest, filename, lite) end # Calculate a checksum of the first 500 chars of a file's content using Digest::SHA1. @@ -89,7 +89,7 @@ module Puppet::Util::Checksums require 'digest/sha1' digest = Digest::SHA1.new() yield digest - return digest.hexdigest + digest.hexdigest end alias :sha1lite_stream :sha1_stream @@ -120,6 +120,6 @@ module Puppet::Util::Checksums end end - return digest.hexdigest + digest.hexdigest end end diff --git a/lib/puppet/util/classgen.rb b/lib/puppet/util/classgen.rb index d4c693e1e..92fcc6724 100644 --- a/lib/puppet/util/classgen.rb +++ b/lib/puppet/util/classgen.rb @@ -63,7 +63,7 @@ module Puppet::Util::ClassGen end # Let them know whether we did actually delete a subclass. - return retval + retval end private @@ -75,7 +75,7 @@ module Puppet::Util::ClassGen const = prefix + name2const(name) end - return const + const end # This does the actual work of creating our class or module. It's just a @@ -121,7 +121,7 @@ module Puppet::Util::ClassGen # Store the class in hashes or arrays or whatever. storeclass(klass, name, options) - return klass + klass end # Handle the setting and/or removing of the associated constant. @@ -139,7 +139,7 @@ module Puppet::Util::ClassGen end const_set(const, klass) - return const + const end # Perform the initializations on the class. diff --git a/lib/puppet/util/errors.rb b/lib/puppet/util/errors.rb index 3aa65d06c..6fa14d3df 100644 --- a/lib/puppet/util/errors.rb +++ b/lib/puppet/util/errors.rb @@ -12,7 +12,7 @@ module Puppet::Util::Errors error.set_backtrace other.backtrace if other and other.respond_to?(:backtrace) - return error + error end def error_context @@ -44,7 +44,7 @@ module Puppet::Util::Errors raise adderrorcontext(error, detail) end - return retval + retval end # Throw an error, defaulting to a Puppet::Error. diff --git a/lib/puppet/util/feature.rb b/lib/puppet/util/feature.rb index 8e2f81fa4..99587a06b 100644 --- a/lib/puppet/util/feature.rb +++ b/lib/puppet/util/feature.rb @@ -48,7 +48,7 @@ class Puppet::Util::Feature feature = method.to_s.sub(/\?$/, '') @loader.load(feature) - return respond_to?(method) && self.send(method) + respond_to?(method) && self.send(method) end # Actually test whether the feature is present. We only want to test when @@ -63,7 +63,7 @@ class Puppet::Util::Feature end # We loaded all of the required libraries - return true + true end private @@ -79,6 +79,6 @@ class Puppet::Util::Feature Puppet.debug "Failed to load library '#{lib}' for feature '#{name}'" return false end - return true + true end end diff --git a/lib/puppet/util/fileparsing.rb b/lib/puppet/util/fileparsing.rb index c8ab53d6a..a5d7ca4ab 100644 --- a/lib/puppet/util/fileparsing.rb +++ b/lib/puppet/util/fileparsing.rb @@ -137,7 +137,7 @@ module Puppet::Util::FileParsing # Try to match a specific text line. def handle_text_line(line, record) - return line =~ record.match ? {:record_type => record.name, :line => line} : nil + line =~ record.match ? {:record_type => record.name, :line => line} : nil end # Try to match a record. @@ -248,7 +248,7 @@ module Puppet::Util::FileParsing end end - return nil + nil end # Define a new type of record. These lines get split into hashes. Valid @@ -295,7 +295,7 @@ module Puppet::Util::FileParsing text += line_separator if trailing_separator - return text + text end # Convert our parsed record into a text record. @@ -362,7 +362,7 @@ module Puppet::Util::FileParsing @record_types[record.name] = record @record_order << record - return record + record end # Retrieve the record object. diff --git a/lib/puppet/util/inifile.rb b/lib/puppet/util/inifile.rb index 3488ce54d..276f741c5 100644 --- a/lib/puppet/util/inifile.rb +++ b/lib/puppet/util/inifile.rb @@ -71,7 +71,7 @@ module Puppet::Util::IniConfig text << entry end end - return text + text end private @@ -79,7 +79,7 @@ module Puppet::Util::IniConfig @entries.each do |entry| return entry if entry.is_a?(Array) && entry[0] == key end - return nil + nil end end @@ -182,12 +182,12 @@ module Puppet::Util::IniConfig each_section do |section| return section if section.name == name end - return nil + nil end # Return true if the file contains a section with name NAME def include?(name) - return ! self[name].nil? + ! self[name].nil? end # Add a section to be stored in FILE when store is called @@ -196,7 +196,7 @@ module Puppet::Util::IniConfig result = Section.new(name, file) @files[file] ||= [] @files[file] << result - return result + result end end end diff --git a/lib/puppet/util/ldap/generator.rb b/lib/puppet/util/ldap/generator.rb index 2a868b0d9..fb4915100 100644 --- a/lib/puppet/util/ldap/generator.rb +++ b/lib/puppet/util/ldap/generator.rb @@ -7,7 +7,7 @@ class Puppet::Util::Ldap::Generator # Declare the attribute we'll use to generate the value. def from(source) @source = source - return self + self end # Actually do the generation. @@ -40,6 +40,6 @@ class Puppet::Util::Ldap::Generator # Provide the code that does the generation. def with(&block) @generator = block - return self + self end end diff --git a/lib/puppet/util/ldap/manager.rb b/lib/puppet/util/ldap/manager.rb index 93e8baac3..b1048a1a3 100644 --- a/lib/puppet/util/ldap/manager.rb +++ b/lib/puppet/util/ldap/manager.rb @@ -9,13 +9,13 @@ class Puppet::Util::Ldap::Manager # A null-op that just returns the config. def and - return self + self end # Set the offset from the search base and return the config. def at(location) @location = location - return self + self end # The basic search base. @@ -69,7 +69,7 @@ class Puppet::Util::Ldap::Manager ensure @connection.close end - return nil + nil end # Convert the name to a dn, then pass the args along to @@ -160,7 +160,7 @@ class Puppet::Util::Ldap::Manager # Specify what classes this provider models. def manages(*classes) @objectclasses = classes - return self + self end # Specify the attribute map. Assumes the keys are the puppet @@ -173,7 +173,7 @@ class Puppet::Util::Ldap::Manager # and the ldap attributes as the keys. @ldap2puppet = attributes.inject({}) { |map, ary| map[ary[1]] = ary[0]; map } - return self + self end # Return the ldap name for a puppet attribute. diff --git a/lib/puppet/util/loadedfile.rb b/lib/puppet/util/loadedfile.rb index 3dd8151a4..22d8928e7 100755 --- a/lib/puppet/util/loadedfile.rb +++ b/lib/puppet/util/loadedfile.rb @@ -54,7 +54,7 @@ module Puppet @stamp = Time.now end end - return @stamp + @stamp end def to_s diff --git a/lib/puppet/util/log.rb b/lib/puppet/util/log.rb index 16a4eb239..e841c7add 100644 --- a/lib/puppet/util/log.rb +++ b/lib/puppet/util/log.rb @@ -26,7 +26,7 @@ class Puppet::Util::Log ) dest.match(dest.name) - return dest + dest end require 'puppet/util/log/destination' @@ -71,7 +71,7 @@ class Puppet::Util::Log def Log.create(hash) raise Puppet::DevError, "Logs require a level" unless hash.include?(:level) raise Puppet::DevError, "Invalid log level #{hash[:level]}" unless @levels.index(hash[:level]) - return @levels.index(hash[:level]) >= @loglevel ? Puppet::Util::Log.new(hash) : nil + @levels.index(hash[:level]) >= @loglevel ? Puppet::Util::Log.new(hash) : nil end def Log.destinations @@ -85,7 +85,7 @@ class Puppet::Util::Log # Return the current log level. def Log.level - return @levels[@loglevel] + @levels[@loglevel] end # Set the current log level. diff --git a/lib/puppet/util/log/destination.rb b/lib/puppet/util/log/destination.rb index 81baa9301..35565b4a8 100644 --- a/lib/puppet/util/log/destination.rb +++ b/lib/puppet/util/log/destination.rb @@ -25,7 +25,7 @@ class Puppet::Util::Log::Destination # Search for direct matches or class matches return true if thing === obj or thing == obj.class.to_s end - return false + false end def name diff --git a/lib/puppet/util/log_paths.rb b/lib/puppet/util/log_paths.rb index 3132238e2..a7ad18906 100644 --- a/lib/puppet/util/log_paths.rb +++ b/lib/puppet/util/log_paths.rb @@ -7,7 +7,7 @@ module Puppet::Util::LogPaths def path @path = pathbuilder unless defined?(@path) - return "/" + @path.join("/") + "/" + @path.join("/") end def source_descriptors @@ -20,7 +20,7 @@ module Puppet::Util::LogPaths descriptors[param] = value end - return descriptors + descriptors end end diff --git a/lib/puppet/util/logging.rb b/lib/puppet/util/logging.rb index fa50efa0a..e514affd0 100644 --- a/lib/puppet/util/logging.rb +++ b/lib/puppet/util/logging.rb @@ -35,6 +35,6 @@ module Puppet::Util::Logging def log_source # We need to guard the existence of the constants, since this module is used by the base Puppet module. (is_resource? or is_resource_parameter?) and respond_to?(:path) and return path.to_s - return to_s + to_s end end diff --git a/lib/puppet/util/metric.rb b/lib/puppet/util/metric.rb index 6f5b2cf9b..eb25d7746 100644 --- a/lib/puppet/util/metric.rb +++ b/lib/puppet/util/metric.rb @@ -105,7 +105,7 @@ class Puppet::Util::Metric end def path - return File.join(self.basedir, @name + ".rrd") + File.join(self.basedir, @name + ".rrd") end def newvalue(name,value,label = nil) diff --git a/lib/puppet/util/package.rb b/lib/puppet/util/package.rb index 24df1c727..ecac77806 100644 --- a/lib/puppet/util/package.rb +++ b/lib/puppet/util/package.rb @@ -24,7 +24,7 @@ module Puppet::Util::Package return a.upcase <=> b.upcase end end - return version_a <=> version_b; + version_a <=> version_b; end module_function :versioncmp diff --git a/lib/puppet/util/posix.rb b/lib/puppet/util/posix.rb index c71a846d9..6bb94b01f 100755 --- a/lib/puppet/util/posix.rb +++ b/lib/puppet/util/posix.rb @@ -55,7 +55,7 @@ module Puppet::Util::POSIX when :passwd; Etc.send(:endpwent) when :group; Etc.send(:endgrent) end - return nil + nil end # Determine what the field name is for users and groups. diff --git a/lib/puppet/util/provider_features.rb b/lib/puppet/util/provider_features.rb index 37f11aa12..e0f90aebe 100644 --- a/lib/puppet/util/provider_features.rb +++ b/lib/puppet/util/provider_features.rb @@ -42,7 +42,7 @@ module Puppet::Util::ProviderFeatures return false unless obj.respond_to?(m) end end - return true + true end end diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index cc767fa05..c79adf671 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -69,7 +69,7 @@ class Parser container = find_object_named(container, name) container = prev_container.add_class(PuppetClass, name, nil) unless container end - return [container, final_name] + [container, final_name] end # split_module tries to find if +path+ belongs to the module path @@ -105,7 +105,7 @@ class Parser end # we are under a global manifests Puppet.debug "rdoc: global manifests" - return "<site>" + "<site>" end # create documentation for the top level +container+ diff --git a/lib/puppet/util/reference.rb b/lib/puppet/util/reference.rb index 314f9c136..24da1e5d7 100644 --- a/lib/puppet/util/reference.rb +++ b/lib/puppet/util/reference.rb @@ -116,7 +116,7 @@ class Puppet::Util::Reference end def h(name, level) - return "#{name}\n#{HEADER_LEVELS[level] * name.to_s.length}\n\n" + "#{name}\n#{HEADER_LEVELS[level] * name.to_s.length}\n\n" end def initialize(name, options = {}, &block) @@ -136,7 +136,7 @@ class Puppet::Util::Reference # Indent every line in the chunk except those which begin with '..'. def indent(text, tab) - return text.gsub(/(^|\A)/, tab).gsub(/^ +\.\./, "..") + text.gsub(/(^|\A)/, tab).gsub(/^ +\.\./, "..") end def option(name, value) @@ -152,7 +152,7 @@ class Puppet::Util::Reference #str += text.gsub(/\n/, "\n ") str += "\n\n" - return str + str end # Remove all trac links. @@ -176,7 +176,7 @@ class Puppet::Util::Reference text += self.class.footer if withcontents - return text + text end def to_text(withcontents = true) diff --git a/lib/puppet/util/selinux.rb b/lib/puppet/util/selinux.rb index 7c6177f81..ab7e12d29 100644 --- a/lib/puppet/util/selinux.rb +++ b/lib/puppet/util/selinux.rb @@ -18,7 +18,7 @@ module Puppet::Util::SELinux if Selinux.is_selinux_enabled == 1 return true end - return false + false end # Retrieve and return the full context of the file. If we don't have @@ -29,7 +29,7 @@ module Puppet::Util::SELinux if retval == -1 return nil end - return retval[1] + retval[1] end # Retrieve and return the default context of the file. If we don't have @@ -51,7 +51,7 @@ module Puppet::Util::SELinux if retval == -1 return nil end - return retval[1] + retval[1] end # Take the full SELinux context returned from the tools and parse it @@ -70,7 +70,7 @@ module Puppet::Util::SELinux :seltype => $3, :selrange => $4, } - return ret[component] + ret[component] end # This updates the actual SELinux label on the file. You can update @@ -133,7 +133,7 @@ module Puppet::Util::SELinux set_selinux_context(file, new_context) return new_context end - return nil + nil end # Internal helper function to read and parse /proc/mounts @@ -168,7 +168,7 @@ module Puppet::Util::SELinux next if params[2] == 'rootfs' mntpoint[params[1]] = params[2] end - return mntpoint + mntpoint end def realpath(path) @@ -199,7 +199,7 @@ module Puppet::Util::SELinux return mnts[path] if mnts.has_key?(path) path = parent_directory(path) end - return mnts['/'] + mnts['/'] end # Check filesystem a path resides on for SELinux support against @@ -210,7 +210,7 @@ module Puppet::Util::SELinux fstype = find_fs(file) return false if fstype.nil? filesystems = ['ext2', 'ext3', 'ext4', 'gfs', 'gfs2', 'xfs', 'jfs'] - return filesystems.include?(fstype) + filesystems.include?(fstype) end end diff --git a/lib/puppet/util/settings.rb b/lib/puppet/util/settings.rb index 055492c84..7c70dfa8f 100644 --- a/lib/puppet/util/settings.rb +++ b/lib/puppet/util/settings.rb @@ -37,7 +37,7 @@ class Puppet::Util::Settings setting.getopt_args.each { |args| options << args } } - return options + options end # Generate the list of valid arguments, in a format that OptionParser can @@ -48,13 +48,13 @@ class Puppet::Util::Settings options << setting.optparse_args } - return options + options end # Is our parameter a boolean parameter? def boolean?(param) param = param.to_sym - return !!(@config.include?(param) and @config[param].kind_of? BooleanSetting) + !!(@config.include?(param) and @config[param].kind_of? BooleanSetting) end # Remove all set values, potentially skipping cli values. @@ -98,7 +98,7 @@ class Puppet::Util::Settings end end - return newval + newval end # Return a value's description. @@ -247,11 +247,11 @@ class Puppet::Util::Settings def print_configs return print_config_options if value(:configprint) != "" return generate_config if value(:genconfig) - return generate_manifest if value(:genmanifest) + generate_manifest if value(:genmanifest) end def print_configs? - return (value(:configprint) != "" || value(:genconfig) || value(:genmanifest)) && true + (value(:configprint) != "" || value(:genconfig) || value(:genmanifest)) && true end # Return a given object's file metadata. @@ -392,7 +392,7 @@ class Puppet::Util::Settings hash[:settings] = self setting = klass.new(hash) - return setting + setting end # This has to be private, because it doesn't add the settings to @config @@ -463,7 +463,7 @@ class Puppet::Util::Settings user = Puppet::Type.type(:user).new :name => self[:user], :audit => :ensure - return @service_user_available = user.exists? + @service_user_available = user.exists? end def legacy_to_mode(type, param) @@ -481,7 +481,7 @@ class Puppet::Util::Settings Puppet.warning "You have configuration parameter $#{param} specified in [#{type}], which is a deprecated section. I'm assuming you meant [#{new_type}]" return new_type end - return type + type end def set_value(param, value, type, options = {}) @@ -515,7 +515,7 @@ class Puppet::Util::Settings Puppet::Node::Environment.clear if defined?(Puppet::Node) and defined?(Puppet::Node::Environment) end - return value + value end # Set a bunch of defaults in a given section. The sections are actually pretty @@ -675,7 +675,7 @@ if @config.include?(:run_mode) # If we didn't get a value, use the default val = @config[param].default if val.nil? - return val + val end # Find the correct value using our search path. Optionally accept an environment @@ -709,7 +709,7 @@ if @config.include?(:run_mode) # And cache it @cache[environment||"none"][param] = val - return val + val end # Open a file with the appropriate user, group, and mode @@ -786,7 +786,7 @@ if @config.include?(:run_mode) raise ArgumentError, "Default #{default} is not a file" unless obj.is_a? FileSetting - return obj + obj end # Create the transportable objects for users and groups. @@ -845,7 +845,7 @@ if @config.include?(:run_mode) '' end result[:value] = value.sub(/\s*$/, '') - return result + result end # Convert arguments into booleans, integers, or whatever. @@ -916,7 +916,7 @@ if @config.include?(:run_mode) end } - return result + result end # Read the file in. diff --git a/lib/puppet/util/settings/file_setting.rb b/lib/puppet/util/settings/file_setting.rb index bbb388bd6..351a1ae81 100644 --- a/lib/puppet/util/settings/file_setting.rb +++ b/lib/puppet/util/settings/file_setting.rb @@ -57,7 +57,7 @@ class Puppet::Util::Settings::FileSetting < Puppet::Util::Settings::Setting @type = :directory return value.sub(/\/$/, '') end - return value + value end # Return the appropriate type. diff --git a/lib/puppet/util/settings/setting.rb b/lib/puppet/util/settings/setting.rb index 848c7780e..ba7e4b526 100644 --- a/lib/puppet/util/settings/setting.rb +++ b/lib/puppet/util/settings/setting.rb @@ -50,11 +50,11 @@ class Puppet::Util::Settings::Setting end def iscreated? - return defined?(@iscreated) && @iscreated + defined?(@iscreated) && @iscreated end def set? - return !!(defined?(@value) and ! @value.nil?) + !!(defined?(@value) and ! @value.nil?) end # short name for the celement diff --git a/lib/puppet/util/storage.rb b/lib/puppet/util/storage.rb index 8ca1881ed..f821c8fd7 100644 --- a/lib/puppet/util/storage.rb +++ b/lib/puppet/util/storage.rb @@ -9,7 +9,7 @@ class Puppet::Util::Storage include Puppet::Util def self.state - return @@state + @@state end def initialize @@ -28,7 +28,7 @@ class Puppet::Util::Storage name = object.to_s end - return @@state[name] ||= {} + @@state[name] ||= {} end def self.clear diff --git a/lib/puppet/util/subclass_loader.rb b/lib/puppet/util/subclass_loader.rb index 02d4af159..6f861439a 100644 --- a/lib/puppet/util/subclass_loader.rb +++ b/lib/puppet/util/subclass_loader.rb @@ -63,14 +63,14 @@ module Puppet::Util::SubclassLoader super end return nil unless defined?(@subclassname) - return self.send(@subclassname, method) || nil + self.send(@subclassname, method) || nil end # Retrieve or calculate a name. def name(dummy_argument=:work_arround_for_ruby_GC_bug) @name = self.to_s.sub(/.+::/, '').intern unless defined?(@name) - return @name + @name end # Provide a list of all subclasses. diff --git a/lib/puppet/util/suidmanager.rb b/lib/puppet/util/suidmanager.rb index c6b5e3c89..0fea99e8b 100644 --- a/lib/puppet/util/suidmanager.rb +++ b/lib/puppet/util/suidmanager.rb @@ -24,7 +24,7 @@ module Puppet::Util::SUIDManager # But 'macosx_productversion_major' requires it. Facter.loadfacts @osx_maj_ver = Facter.value('macosx_productversion_major') - return @osx_maj_ver + @osx_maj_ver end module_function :osx_maj_ver @@ -76,7 +76,7 @@ module Puppet::Util::SUIDManager if ret == nil raise Puppet::Error, "Invalid #{map[type]}: #{id}" end - return ret + ret end module_function :convert_xid diff --git a/lib/puppet/util/user_attr.rb b/lib/puppet/util/user_attr.rb index db8fb81b9..c26c4911a 100644 --- a/lib/puppet/util/user_attr.rb +++ b/lib/puppet/util/user_attr.rb @@ -16,6 +16,6 @@ class UserAttr break end end - return attributes + attributes end end diff --git a/lib/puppet/util/warnings.rb b/lib/puppet/util/warnings.rb index a63d91359..3156b412c 100644 --- a/lib/puppet/util/warnings.rb +++ b/lib/puppet/util/warnings.rb @@ -13,7 +13,7 @@ module Puppet::Util::Warnings def clear_warnings() @stampwarnings = {} - return nil + nil end protected @@ -24,6 +24,6 @@ module Puppet::Util::Warnings return nil if @stampwarnings[klass].include? message yield @stampwarnings[klass] << message - return nil + nil end end |
