getsentry/raven-ruby

View on GitHub

Showing 108 of 143 total issues

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

      def call(ex, context, sidekiq_config = nil)
        return unless Sentry.initialized?

        context_filter = Sentry::Sidekiq::ContextFilter.new(context)

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

      def retry_limit(context, sidekiq_config)
        limit = context.dig(:job, "retry")

        case limit
        when Integer
Severity: Minor
Found in sentry-sidekiq/lib/sentry/sidekiq/error_handler.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 detect_release has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def detect_release
      return unless sending_allowed?

      @release ||= ReleaseDetector.detect_release(project_root: project_root, running_on_heroku: running_on_heroku?)

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

    def capture_exception(exception, **options, &block)
      if RUBY_PLATFORM == "java"
        check_argument_type!(exception, ::Exception, ::Java::JavaLang::Throwable)
      else
        check_argument_type!(exception, ::Exception)
Severity: Minor
Found in sentry-ruby/lib/sentry/hub.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 init has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def init(&block)
      config = Configuration.new
      yield(config) if block_given?
      config.detect_release
      apply_patches(config)
Severity: Minor
Found in sentry-ruby/lib/sentry-ruby.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 send_event has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def send_event(event, hint = nil)
      return false unless configuration.sending_allowed?(event)

      event = configuration.before_send.call(event, hint) if configuration.before_send
      if event.nil?
Severity: Minor
Found in sentry-raven/lib/raven/client.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 compute_filename has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def compute_filename
        return if abs_path.nil?

        prefix =
          if under_project_root? && in_app
Severity: Minor
Found in sentry-ruby/lib/sentry/interfaces/stacktrace.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 is_rate_limited? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def is_rate_limited?(data_category)
      # check category-specific limit
      category_delay = @rate_limits[data_category]
      # check universal limit if not category limit
      universal_delay = @rate_limits[nil]
Severity: Minor
Found in sentry-ruby/lib/sentry/transport.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 register_patch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def register_patch(key, patch = nil, target = nil, &block)
      if patch && block
        raise ArgumentError.new("Please provide either a patch and its target OR a block, but not both")
      end

Severity: Minor
Found in sentry-ruby/lib/sentry-ruby.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 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

Method finish has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def finish(hub: nil, end_timestamp: nil)
      if hub
        log_warn(
          <<~MSG
            Specifying a different hub in `Transaction#finish` will be deprecated in version 5.0.
Severity: Minor
Found in sentry-ruby/lib/sentry/transaction.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 sentry-raven/lib/raven/breadcrumbs/active_support_logger.rb - About 35 mins to fix

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

              def add(name, started, _finished, _unique_id, data)
    Severity: Minor
    Found in sentry-rails/lib/sentry/rails/breadcrumb/active_support_logger.rb - About 35 mins to fix

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

            def initialize(file, number, method, module_name, in_app_pattern)
      Severity: Minor
      Found in sentry-ruby/lib/sentry/backtrace.rb - About 35 mins to fix

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

                  def add(name, started, _finished, _unique_id, data)

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

                def new_job(name, interval_type, config, schedule, options)
          Severity: Minor
          Found in sentry-sidekiq/lib/sentry/sidekiq-scheduler/scheduler.rb - About 35 mins to fix

            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 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?
                      configuration.logger.debug("Event not sent: #{configuration.error_messages}")
                      return
                    end
            Severity: Minor
            Found in sentry-raven/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

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

                def rack_env=(env)
                  unless request || env.empty?
                    add_request_interface(env)
            
                    if @send_default_pii
            Severity: Minor
            Found in sentry-ruby/lib/sentry/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 valid? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def valid?
                  return true if %w(server host path public_key project_id).all? { |k| public_send(k) }
            
                  if server
                    %w(server host path public_key project_id).map do |key|
            Severity: Minor
            Found in sentry-raven/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

            Severity
            Category
            Status
            Source
            Language