getsentry/raven-ruby

View on GitHub

Showing 22 of 22 total issues

Class Configuration has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Configuration
    # Directories to be recognized as part of your app. e.g. if you
    # have an `engines` dir at the root of your project, you may want
    # to set this to something like /(app|config|engines|lib)/
    attr_accessor :app_dirs_pattern
Severity: Minor
Found in lib/raven/configuration.rb - About 3 hrs to fix

    Method process has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def process(value, key = nil)
          case value
          when Hash
            !value.frozen? ? value.merge!(value) { |k, v| process v, k } : value.merge(value) { |k, v| process v, k }
          when Array
    Severity: Minor
    Found in lib/raven/processor/sanitizedata.rb - About 2 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 format_headers_for_sentry has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def format_headers_for_sentry(env_hash)
          env_hash.each_with_object({}) do |(key, value), memo|
            begin
              key = key.to_s # rack env can contain symbols
              value = value.to_s
    Severity: Minor
    Found in lib/raven/integrations/rack.rb - About 2 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

    File configuration.rb has 272 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'uri'
    
    module Raven
      class Configuration
        # Directories to be recognized as part of your app. e.g. if you
    Severity: Minor
    Found in lib/raven/configuration.rb - About 2 hrs to fix

      Class Event has 23 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
      
      
      Severity: Minor
      Found in lib/raven/event.rb - About 2 hrs to fix

        Method process has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def process(value)
              case value
              when Hash
                !value.frozen? ? value.merge!(value) { |_, v| process v } : value.merge(value) { |_, v| process v }
              when Array
        Severity: Minor
        Found in lib/raven/processor/utf8conversion.rb - About 2 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 test has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.test(dsn = nil, silent = false, config = nil) # rubocop:disable all
              config ||= Raven.configuration
        
              config.logger = if silent
                                ::Logger.new(nil)
        Severity: Minor
        Found in lib/raven/cli.rb - About 2 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 test has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def self.test(dsn = nil, silent = false, config = nil) # rubocop:disable all
              config ||= Raven.configuration
        
              config.logger = if silent
                                ::Logger.new(nil)
        Severity: Minor
        Found in lib/raven/cli.rb - About 1 hr to fix

          Method process has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def process(value, visited = [])
                return "(...)" if visited.include?(value.__id__)
                visited << value.__id__ if value.is_a?(Array) || value.is_a?(Hash)
          
                case value
          Severity: Minor
          Found in lib/raven/processor/removecircularreferences.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 capture_type has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def capture_type(obj, options = {})
                unless configuration.capture_allowed?(obj)
                  logger.debug("#{obj} excluded from capture: #{configuration.error_messages}")
                  return false
                end
          Severity: Minor
          Found in lib/raven/instance.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 stacktrace_interface_from has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def stacktrace_interface_from(backtrace)
                Backtrace.parse(backtrace).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 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 initialize has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def initialize
                self.async = false
                self.context_lines = 3
                self.current_environment = current_environment_from_env
                self.encoding = 'gzip'
          Severity: Minor
          Found in lib/raven/configuration.rb - About 1 hr to fix

            Method filename has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def filename
                    return if abs_path.nil?
                    return @filename if instance_variable_defined?(:@filename)
            
                    prefix =
            Severity: Minor
            Found in lib/raven/interfaces/stack_trace.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 to_hash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def to_hash(*args)
                    data = super(*args)
                    data[:filename] = filename
                    data.delete(:vars) unless vars && !vars.empty?
                    data.delete(:pre_context) unless pre_context && !pre_context.empty?
            Severity: Minor
            Found in lib/raven/interfaces/stack_trace.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 add_breadcrumb has a Cognitive Complexity of 9 (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 == ""
            
            
            Severity: Minor
            Found in lib/raven/breadcrumbs/logger.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 exception_chain_to_array has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def exception_chain_to_array(exc)
                  if exc.respond_to?(:cause) && exc.cause
                    exceptions = [exc]
                    while exc.cause
                      exc = exc.cause
            Severity: Minor
            Found in lib/raven/event.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 from_exception has a Cognitive Complexity of 8 (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 lib/raven/event.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

            Method add has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    def add(name, started, _finished, _unique_id, data)
            Severity: Minor
            Found in lib/raven/breadcrumbs/activesupport.rb - About 35 mins to fix

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

                  def valid?
                    return true if %w(server host path public_key secret_key project_id).all? { |k| public_send(k) }
                    if server
                      %w(server host path public_key secret_key project_id).map do |key|
                        @errors << "No #{key} specified" unless public_send(key)
              Severity: Minor
              Found in lib/raven/configuration.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 send_event has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def send_event(auth_header, data, options = {})
                      unless configuration.sending_allowed?
                        logger.debug("Event not sent: #{configuration.error_messages}")
                      end
              
              
              Severity: Minor
              Found in lib/raven/transports/http.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

              Severity
              Category
              Status
              Source
              Language