Showing 30 of 45 total issues
Method handle_response
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
def handle_response(res, size, body)
case res.code
when /^2/
if config[:redirectto]
critical "Expected redirect to #{config[:redirectto]} but got #{res.code}" + body
- 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 acquire_resource
has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring. Open
def acquire_resource
http = Net::HTTP.new(config[:host], config[:port])
if config[:ssl]
http.use_ssl = true
- 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 acquire_resource
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def acquire_resource
http = nil
if config[:no_proxy]
http = Net::HTTP.new(config[:host], config[:port], nil, nil)
- 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 40 (exceeds 5 allowed). Consider refactoring. Open
def deep_value(data, desired_key, parent = '')
case data
when Array
data.each_with_index do |value, index|
arr_key = parent + '[' + index.to_s + ']'
- 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
File check-http.rb
has 338 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'sensu-plugins-http'
require 'sensu-plugin/check/cli'
require 'net/http'
require 'net/https'
require 'digest'
Method acquire_resource
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
def acquire_resource
http = nil
if config[:no_proxy]
http = Net::HTTP.new(config[:host], config[:port], nil, nil)
Method acquire_resource
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def acquire_resource
http = Net::HTTP.new(config[:host], config[:port])
if config[:ssl]
http.use_ssl = true
Method run
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def run
puts "args config: #{config}" if config[:debug]
scheme = config[:scheme].to_s
metric_pair_input = config[:metric].to_s
- 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 17 (exceeds 5 allowed). Consider refactoring. Open
def run
if config[:help]
puts usage_details
ok
end
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
def run
uri = URI.parse(config[:url])
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = if config[:insecure]
- 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 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
if config[:help]
puts usage_details
ok
end
Method handle_response
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_response(res, size, body)
case res.code
when /^2/
if config[:redirectto]
critical "Expected redirect to #{config[:redirectto]} but got #{res.code}" + body
Method run
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
puts "args config: #{config}" if config[:debug]
scheme = config[:scheme].to_s
metric_pair_input = config[:metric].to_s
Method follow_uri
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def follow_uri(uri, total_redirects, get_redirects, auth_count)
location = URI(uri)
http = Net::HTTP.new(location.host, location.port)
if location.port == 443
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def run
found = false
attempts = 0
until found || attempts >= 10
attempts += 1
- 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 follow_uri
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def follow_uri(uri, total_redirects, get_redirects, auth_count)
location = URI(uri)
http = Net::HTTP.new(location.host, location.port)
if location.port == 443
- 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 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
uri = URI.parse(config[:url])
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = if config[:insecure]
Method request_http
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def request_http
http = Net::HTTP.new(config[:host], config[:port])
if config[:ssl]
http.use_ssl = true
- 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 follow_uri
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def follow_uri(uri, total_redirects, get_redirects, auth_count)
location = URI(uri)
http = Net::HTTP.new(location.host, location.port)
if location.port == 443
Method follow_uri
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def follow_uri(uri, total_redirects, get_redirects, auth_count)
location = URI(uri)
http = Net::HTTP.new(location.host, location.port)
if location.port == 443