summaryrefslogtreecommitdiffstats
path: root/lib/puppet/sslcertificates.rb
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2010-07-09 18:06:33 -0700
committerMarkus Roberts <Markus@reality.com>2010-07-09 18:06:33 -0700
commit8d1fbe4586c91682cdda0cb271649e918fd9778b (patch)
tree314508ca21830874d9e4ec6e27880fede14193bd /lib/puppet/sslcertificates.rb
parent889158ad57e33df083613d6f7d136b2e11aaa16a (diff)
downloadpuppet-8d1fbe4586c91682cdda0cb271649e918fd9778b.tar.gz
puppet-8d1fbe4586c91682cdda0cb271649e918fd9778b.tar.xz
puppet-8d1fbe4586c91682cdda0cb271649e918fd9778b.zip
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/sslcertificates.rb')
-rwxr-xr-xlib/puppet/sslcertificates.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/puppet/sslcertificates.rb b/lib/puppet/sslcertificates.rb
index 2ce782293..02cb9fe03 100755
--- a/lib/puppet/sslcertificates.rb
+++ b/lib/puppet/sslcertificates.rb
@@ -106,7 +106,7 @@ module Puppet::SSLCertificates
# for some reason this _must_ be the last extension added
ex << ef.create_extension("authorityKeyIdentifier", "keyid:always,issuer:always") if hash[:type] == :ca
- return cert
+ cert
end
def self.mkhash(dir, cert, certfile)
@@ -137,7 +137,7 @@ module Puppet::SSLCertificates
}
- return hashpath
+ hashpath
end
require 'puppet/sslcertificates/certificate'
require 'puppet/sslcertificates/inventory'