Showing 13 of 13 total issues
Method process_checks
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
def self.process_checks(checks, called_from_middleware = false)
errors = ''
checks.each do |check|
case check
when 'and', 'site'
- 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 index
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def index
last_modified = Time.now.utc
max_age = HealthCheck.max_age
if max_age > 1
last_modified = Time.at((last_modified.to_f / max_age).floor * max_age).utc
- 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 call
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
(response_type, middleware_checks, full_stack_checks) = parse_env(env)
if response_type
if error_response = (ip_blocked(env) || not_authenticated(env))
return error_response
- 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 process_checks
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.process_checks(checks, called_from_middleware = false)
errors = ''
checks.each do |check|
case check
when 'and', 'site'
Method check
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def check
unless defined?(::Aws)
raise "Wrong configuration. Missing 'aws-sdk' or 'aws-sdk-s3' gem"
end
return create_error 's3', 'Could not connect to aws' if aws_s3_client.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 check_cache
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.check_cache
t = Time.now.to_i
value = "ok #{t}"
ret = ::Rails.cache.read('__health_check_cache_test__')
if ret.to_s =~ /^ok (\d+)$/
- 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 index
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
last_modified = Time.now.utc
max_age = HealthCheck.max_age
if max_age > 1
last_modified = Time.at((last_modified.to_f / max_age).floor * max_age).utc
Method call
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call(env)
(response_type, middleware_checks, full_stack_checks) = parse_env(env)
if response_type
if error_response = (ip_blocked(env) || not_authenticated(env))
return error_response
Method check_smtp
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.check_smtp(settings, timeout)
status = ''
begin
if @skip_external_checks
status = '250'
- 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 check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.check
unless defined?(::Sidekiq)
raise "Wrong configuration. Missing 'sidekiq' gem"
end
::Sidekiq.redis do |r|
- 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 check
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check
raise "Wrong configuration. Missing 'redis' gem" unless defined?(::Redis)
client.ping == 'PONG' ? '' : "Redis.ping returned #{res.inspect} instead of PONG"
rescue Exception => err
- 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 check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.check
unless defined?(::Elasticsearch)
raise "Wrong configuration. Missing 'elasticsearch' gem"
end
res = ::Elasticsearch::Client.new.ping
- 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 check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.check
unless defined?(::Resque)
raise "Wrong configuration. Missing 'resque' gem"
end
res = ::Resque.redis.ping
- 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"