getsentry/raven-ruby

View on GitHub
sentry-ruby/lib/sentry/client.rb

Summary

Maintainability
D
1 day
Test Coverage

Method capture_event has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def capture_event(event, scope, hint = {})
      return unless configuration.sending_allowed?

      if event.is_a?(ErrorEvent) && !configuration.sample_allowed?
        transport.record_lost_event(:sample_rate, "error")
Severity: Minor
Found in sentry-ruby/lib/sentry/client.rb - About 5 hrs 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 send_event has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

    def send_event(event, hint = nil)
      event_type = event.is_a?(Event) ? event.type : event["type"]
      data_category = Envelope::Item.data_category(event_type)
      spans_before = event.is_a?(TransactionEvent) ? event.spans.size : 0

Severity: Minor
Found in sentry-ruby/lib/sentry/client.rb - About 5 hrs 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 capture_event has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def capture_event(event, scope, hint = {})
      return unless configuration.sending_allowed?

      if event.is_a?(ErrorEvent) && !configuration.sample_allowed?
        transport.record_lost_event(:sample_rate, "error")
Severity: Minor
Found in sentry-ruby/lib/sentry/client.rb - About 1 hr to fix

    Method send_event has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def send_event(event, hint = nil)
          event_type = event.is_a?(Event) ? event.type : event["type"]
          data_category = Envelope::Item.data_category(event_type)
          spans_before = event.is_a?(TransactionEvent) ? event.spans.size : 0
    
    
    Severity: Minor
    Found in sentry-ruby/lib/sentry/client.rb - About 1 hr to fix

      Method dispatch_async_event has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def dispatch_async_event(async_block, event, hint)
            # We have to convert to a JSON-like hash, because background job
            # processors (esp ActiveJob) may not like weird types in the event hash
      
            event_hash =
      Severity: Minor
      Found in sentry-ruby/lib/sentry/client.rb - About 25 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