Showing 76 of 84 total issues
Method send_report_to_appsignal?
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_report_to_appsignal?(options)
puts "\nDiagnostics report"
puts " Do you want to send this diagnostics report to AppSignal?"
puts " If you share this report you will be given a link to \n" \
" AppSignal.com to validate the report.\n" \
Method configure_rails_app_name
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure_rails_app_name(config)
loaded =
begin
load Appsignal::Utils::RailsHelper.application_config_path
true
Method patch_perform_action
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def patch_perform_action
ActionCable::Channel::Base.class_eval do
alias_method :original_perform_action, :perform_action
def perform_action(*args, &block)
Method http_client
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def http_client
client =
if config[:http_proxy]
Net::HTTP.new(uri.host, uri.port, proxy_addr, proxy_port)
else
- 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 get_payload_action
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_payload_action(request)
# Short-circut is there's no request object to obtain information from
return settings.name.to_s unless request
# Newer versions expose the action / controller on the request class.
- 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 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 path_stat
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def path_stat(path)
{
:path => path,
:exists => File.exist?(path)
}.tap do |info|
- 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 installed_frameworks
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def installed_frameworks
[].tap do |out|
if framework_available?("rails") &&
File.exist?(Appsignal::Utils::RailsHelper.application_config_path)
out << :rails
- 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 call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call
puma_stats = fetch_puma_stats
return unless puma_stats
stats = JSON.parse puma_stats, :symbolize_names => 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 record_event
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def record_event(name, title, body, body_format, duration, gc_duration_ms) # rubocop:disable Metrics/ParameterLists
Method agent_platform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.agent_platform
return MUSL_TARGET if force_musl_build?
host_os = RbConfig::CONFIG["host_os"].downcase
local_os =
- 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 extract_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.extract_value(object_or_hash, field, default_value = nil, convert_to_s = false)
value = nil
# Attempt to read value from hash
if object_or_hash.respond_to?(:[])
- 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 call
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def call(env)
# Ignore other paths than the error catching path.
return @app.call(env) unless error_cathing_endpoint?(env)
# Prevent raising a 404 not found when a non-active environment posts
- 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(argv = ARGV)
@options = {}
global = global_option_parser
commands = command_option_parser
global.order!(argv)
- 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)
Method finish_event
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def finish_event(name, title, body, body_format, gc_duration_ms)
Method start_logger
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def start_logger(path_arg = nil)
if path_arg
logger.info("Setting the path in start_logger has no effect anymore, set it in the config instead")
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 host_information
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def host_information
rbconfig = RbConfig::CONFIG
puts "Host information"
data_section :host do
puts_and_save :architecture, "Architecture", rbconfig["host_cpu"]
- 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"