getsentry/raven-ruby

View on GitHub
sentry-opentelemetry/lib/sentry/opentelemetry/span_processor.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method from_sentry_sdk? has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def from_sentry_sdk?(otel_span)
        dsn = Sentry.configuration.dsn
        return false unless dsn

        if otel_span.name.start_with?("HTTP")
Severity: Minor
Found in sentry-opentelemetry/lib/sentry/opentelemetry/span_processor.rb - About 1 hr to fix

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_start has a Cognitive Complexity of 9 (exceeds 5 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)

Severity: Minor
Found in sentry-opentelemetry/lib/sentry/opentelemetry/span_processor.rb - About 55 mins to fix

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 setup_event_processor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def setup_event_processor
        Sentry.add_global_event_processor do |event, _hint|
          span_context = ::OpenTelemetry::Trace.current_span.context
          next event unless span_context.valid?

Severity: Minor
Found in sentry-opentelemetry/lib/sentry/opentelemetry/span_processor.rb - About 55 mins to fix

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)
Severity: Minor
Found in sentry-opentelemetry/lib/sentry/opentelemetry/span_processor.rb - About 55 mins to fix

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 parse_span_description has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_span_description(otel_span)
        op = otel_span.name
        description = otel_span.name

        if (http_method = otel_span.attributes[SEMANTIC_CONVENTIONS::HTTP_METHOD])
Severity: Minor
Found in sentry-opentelemetry/lib/sentry/opentelemetry/span_processor.rb - About 45 mins to fix

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

There are no issues that match your filters.

Category
Status