Showing 119 of 156 total issues
Method stacktrace_interface_from
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def stacktrace_interface_from(backtrace)
Backtrace.parse(backtrace, { configuration: configuration }).lines.reverse.each_with_object([]) do |line, memo|
frame = StacktraceInterface::Frame.new
frame.abs_path = line.file if line.file
frame.function = line.method if line.method
- 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 add
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def add(type,
key,
value,
unit: "none",
tags: {},
- 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 handle_rate_limited_response
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def handle_rate_limited_response(headers)
rate_limits =
if rate_limits = headers[RATE_LIMIT_HEADER]
parse_rate_limit_header(rate_limits)
elsif retry_after = headers[RETRY_AFTER_HEADER]
- 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 build_with_stacktrace
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.build_with_stacktrace(exception:, stacktrace_builder:, mechanism:)
stacktrace = stacktrace_builder.build(backtrace: exception.backtrace)
if locals = exception.instance_variable_get(:@sentry_locals)
locals.each do |k, v|
- 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 envelope_from_event
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def envelope_from_event(event)
# Convert to hash
event_payload = event.to_hash
event_id = event_payload[:event_id] || event_payload["event_id"]
item_type = event_payload[:type] || event_payload["type"]
Method send_data
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_data(data)
encoding = ""
if should_compress?(data)
data = Zlib.gzip(data)
Method record
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def record(queue, worker, payload, &block)
Sentry.with_scope do |scope|
begin
contexts = generate_contexts(queue, worker, payload)
scope.set_contexts(**contexts)
Method record
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def record(job, &block)
Sentry.with_scope do |scope|
begin
scope.set_transaction_name(job.class.name, source: :task)
transaction =
Method test
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.test(dsn = nil, silent = false, config = nil)
config ||= Raven.configuration
config.logger = if silent
::Logger.new(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 add_breadcrumb
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def add_breadcrumb(severity, message = nil, progname = nil)
message = progname if message.nil? # see Ruby's Logger docs for why
return if ignored_logger?(progname)
return if message.nil? || message == ""
- 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 stop
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def stop
return unless @sampled
return unless @started
@result = ::Vernier.stop_profile
- 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 request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def request(req, body = nil, &block)
return super unless started? && Sentry.initialized?
return super if from_sentry_sdk?
Sentry.with_child_span(op: OP_NAME, start_timestamp: Sentry.utc_now.to_f, origin: SPAN_ORIGIN) do |sentry_span|
- 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 new_job
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def new_job(name, interval_type, config, schedule, options)
# Schedule the job upstream first
# SidekiqScheduler does not validate schedules
# It will fail with an error if the schedule in the config is invalid.
# If this errors out, let it fall through.
- 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 compute_filename
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def compute_filename
return if abs_path.nil?
return abs_path unless @strip_backtrace_load_path
prefix =
- 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 capture
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def capture(connection, transaction_name:, extra_context: nil, &block)
return block.call unless Sentry.initialized?
# ActionCable's ConnectionStub (for testing) doesn't implement the exact same interfaces as Connection::Base.
# One thing that's missing is `env`. So calling `connection.env` direclty will fail in test environments when `stub_connection` is used.
# See https://github.com/getsentry/sentry-ruby/pull/1684 for more information.
- 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 initialize
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(configuration)
@shutdown_timeout = 1
@number_of_threads = configuration.background_worker_threads
@max_queue = configuration.background_worker_max_queue
@logger = configuration.logger
Method on_start
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def on_start(otel_span, parent_context)
return unless Sentry.initialized? && Sentry.configuration.instrumenter == :otel
return unless otel_span.context.valid?
return if from_sentry_sdk?(otel_span)
Method apply_to_event
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def apply_to_event(event, hint = nil)
unless event.is_a?(CheckInEvent)
event.tags = tags.merge(event.tags)
event.user = user.merge(event.user)
event.extra = extra.merge(event.extra)
Method from_sentry_trace
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def self.from_sentry_trace(sentry_trace, baggage: nil, hub: Sentry.get_current_hub, **options)
return unless hub.configuration.tracing_enabled?
return unless sentry_trace
sentry_trace_data = extract_sentry_trace(sentry_trace)
- 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 on_finish
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def on_finish(otel_span)
return unless Sentry.initialized? && Sentry.configuration.instrumenter == :otel
return unless otel_span.context.valid?
sentry_span = @span_map.delete(otel_span.context.hex_span_id)
- 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"