Class Transaction
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
class Transaction
HTTP_REQUEST = "http_request".freeze
BACKGROUND_JOB = "background_job".freeze
ACTION_CABLE = "action_cable".freeze
FRONTEND = "frontend".freeze
File transaction.rb
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "json"
module Appsignal
class Transaction
HTTP_REQUEST = "http_request".freeze
Method http_queue_start
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def http_queue_start
env = environment
return unless env
env_var = env["HTTP_X_QUEUE_START".freeze] || env["HTTP_X_REQUEST_START".freeze]
return unless env_var
- 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 set_sample_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_sample_data(key, data)
return unless key && data && (data.is_a?(Array) || data.is_a?(Hash))
@ext.set_sample_data(
key.to_s,
Appsignal::Utils::Data.generate(data)
- 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 set_error
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_error(error)
unless error.is_a?(Exception)
Appsignal.logger.error "Appsignal::Transaction#set_error: Cannot set error. " \
"The given value is not an exception: #{error.inspect}"
return
- 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 record_event
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def record_event(name, title, body, duration, body_format = Appsignal::EventFormatter::DEFAULT)