getsentry/raven-ruby

View on GitHub
sentry-raven/lib/raven/event.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Class Event has 21 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Event
    # See Sentry server default limits at
    # https://github.com/getsentry/sentry/blob/master/src/sentry/conf/server.py
    MAX_MESSAGE_SIZE_IN_BYTES = 1024 * 8
    REQUIRED_OPTION_KEYS = [:configuration, :context, :breadcrumbs].freeze
Severity: Minor
Found in sentry-raven/lib/raven/event.rb - About 2 hrs to fix

    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
    Severity: Minor
    Found in sentry-raven/lib/raven/event.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 from_exception has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def self.from_exception(exc, options = {}, &block)
          exception_context = if exc.instance_variable_defined?(:@__raven_context)
                                exc.instance_variable_get(:@__raven_context)
                              elsif exc.respond_to?(:raven_context)
                                exc.raven_context
    Severity: Minor
    Found in sentry-raven/lib/raven/event.rb - About 35 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def initialize(options)
          # Set some simple default values
          self.id            = SecureRandom.uuid.delete("-")
          self.timestamp     = Time.now.utc
          self.level         = :error
    Severity: Minor
    Found in sentry-raven/lib/raven/event.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