Skip to content

Commit

Permalink
replace needed return lines
Browse files Browse the repository at this point in the history
  • Loading branch information
bmos committed Feb 27, 2024
1 parent b3cc1a3 commit 55756ff
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/feedcheck.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
AV_DIR = 'hackergotchi'

def check_avatar(avatar, av_dir, faraday)
['_ ', false] unless avatar
return ['_ ', false] unless avatar

[check_url(avatar, faraday)] if avatar.include? '//'
["✗\nAvatar not found: hackergotchi/#{avatar} ", true] unless File.file?("#{av_dir}/#{avatar}")
Expand All @@ -24,14 +24,14 @@ def check_url(url, faraday)
begin
res = faraday.get(URI(url))
rescue Faraday::ConnectionFailed
["#{error_message}Connection Failure when trying to access '#{url}' ", true]
return ["#{error_message}Connection Failure when trying to access '#{url}' ", true]
rescue Faraday::SSLError
["#{error_message}SSL Error when trying to access '#{url}' ", true]
return ["#{error_message}SSL Error when trying to access '#{url}' ", true]
end

error = "#{error_message}Non successful status code #{res.status} when trying to access '#{url}' "
if res.status.to_i.between?(300, 399) && res.headers.key?('location')
["#{error}\nTry using '#{res.headers['location']}' instead", true]
return ["#{error}\nTry using '#{res.headers['location']}' instead", true]
end

[error, true] unless res.status.to_i == 200
Expand Down

0 comments on commit 55756ff

Please sign in to comment.