Skip to content

Commit

Permalink
Fixes #19895 - Fix Style/RedundantReturn cop
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoll authored and dLobatog committed Apr 2, 2018
1 parent 7386f11 commit 5f5b13a
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 18 deletions.
6 changes: 0 additions & 6 deletions .rubocop_todo.yml
Expand Up @@ -621,12 +621,6 @@ Style/RaiseArgs:
Style/RedundantParentheses:
Enabled: false

# Offense count: 12
# Cop supports --auto-correct.
# Configuration parameters: AllowMultipleReturnValues.
Style/RedundantReturn:
Enabled: false

# Offense count: 648
# Cop supports --auto-correct.
Style/RedundantSelf:
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/hosts_controller.rb
Expand Up @@ -740,13 +740,13 @@ def find_multiple
return false
end

return @hosts
@hosts
rescue => error
message = _("Something went wrong while selecting hosts - %s") % error
error(message)
Foreman::Logging.exception(message, error)
redirect_to hosts_path
return false
false
end

def toggle_hostmode(mode = true)
Expand Down
2 changes: 1 addition & 1 deletion app/models/external_usergroup.rb
Expand Up @@ -39,7 +39,7 @@ def users
auth_source.users_in_group(name)
rescue Net::LDAP::Error, Net::LDAP::LdapError => e
errors.add :auth_source_id, _("LDAP error - %{message}") % { :message => e.message }
return false
false
end

private
Expand Down
2 changes: 1 addition & 1 deletion app/models/filter.rb
Expand Up @@ -89,7 +89,7 @@ def self.get_resource_class(resource_type)
resource_type.constantize
rescue NameError => e
Foreman::Logging.exception("unknown class #{resource_type}, ignoring", e)
return nil
nil
end

def unlimited?
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20150612135546_create_host_status.rb
Expand Up @@ -69,7 +69,7 @@ def update_statuses(host)
def update_sub_status(status)
if status.relevant?
status.refresh!
return true
true
end
rescue => e
# if the status is not ready to be saved because of missing migration
Expand Down
4 changes: 2 additions & 2 deletions lib/foreman/util.rb
Expand Up @@ -11,10 +11,10 @@ def which(bin, *path)
dest = File.join(dir, bin)
return dest if FileTest.file?(dest) && FileTest.executable?(dest)
end
return false
false
rescue StandardError => e
logger.warn e
return false
false
end

# Generates a URL-safe token for use with Rails for signing cookies
Expand Down
2 changes: 1 addition & 1 deletion lib/middleware/catch_json_parse_errors.rb
Expand Up @@ -10,7 +10,7 @@ def call(env)
if env['HTTP_ACCEPT'] =~ /application\/json/ || env['CONTENT_TYPE'] =~ /application\/json/
error_output = "There was a problem in the JSON you submitted: #{error}"
Rails.logger.debug(error_output)
return [
[
400, { "Content-Type" => "application/json" },
[{ :status => 400, :error => error_output }.to_json]
]
Expand Down
2 changes: 1 addition & 1 deletion lib/proxy_api/dns.rb
Expand Up @@ -22,7 +22,7 @@ def delete(key)
parse(super(key.to_s))
rescue RestClient::ResourceNotFound
# entry doesn't exists anyway
return true
true
rescue => e
raise ProxyException.new(url, e, N_("Unable to delete DNS entry"))
end
Expand Down
2 changes: 1 addition & 1 deletion lib/proxy_api/template.rb
Expand Up @@ -8,7 +8,7 @@ def initialize(args)
# returns the Template URL for this proxy
def template_url
if (response = parse(get("templateServer"))) && response["templateServer"].present?
return response["templateServer"]
response["templateServer"]
end
rescue SocketError, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET,
EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError,
Expand Down
4 changes: 2 additions & 2 deletions lib/ws_proxy.rb
Expand Up @@ -26,9 +26,9 @@ def self.start(attributes)
def free_port?(port)
socket = Socket.new :INET, :STREAM
socket.bind(Socket.pack_sockaddr_in(port, '127.0.0.1'))
return true
true
rescue Errno::EADDRINUSE
return false
false
ensure
socket.close unless socket.nil?
end
Expand Down

0 comments on commit 5f5b13a

Please sign in to comment.