Showing 30 of 45 total issues
Method run
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
if config[:url]
uri = URI.parse(config[:url])
config[:host] = uri.host
config[:port] = uri.port
Method run
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
found = false
attempts = 0
until found || attempts >= 10
attempts += 1
Method run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run
merge_s3_config
url = config[:url]
threshold = config[:threshold]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run
if config[:url]
uri = URI.parse(config[:url])
config[:host] = uri.host
config[:port] = uri.port
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run
if config[:url]
uri = URI.parse(config[:url])
config[:host] = uri.host
config[:path] = uri.path
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run
if config[:url]
uri = URI.parse(config[:url])
config[:host] = uri.host
config[:path] = uri.path
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method deep_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def deep_value(hash, scheme = '')
hash.each do |key, value|
ekey = key.gsub(/\s/, '_')
if value.is_a?(Hash)
deep_value(value, "#{scheme}.#{ekey}")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
ok("#{res.code}, #{size} bytes" + body) unless config[:response_code]
Avoid deeply nested control flow statements. Open
if config[:redirectto] == res['Location'] # rubocop:disable Metrics/BlockNesting
ok "#{res.code} found redirect to #{res['Location']}" + body
else
critical "Expected redirect to #{config[:redirectto]} instead redirected to #{res['Location']}" + body
end
Avoid deeply nested control flow statements. Open
if Digest::SHA256.hexdigest(res.body).eql? config[:sha256checksum]
ok "#{res.code}, checksum match #{config[:sha256checksum]} in #{size} bytes" + body
else
critical "#{res.code}, checksum did not match #{config[:sha256checksum]} in #{size} bytes: #{res.body[0...200]}..."
end