getsentry/raven-ruby

View on GitHub

Showing 119 of 156 total issues

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

                  def deserialize_tags(tags)
                    tags.inject({}) do |h, tag|
                      k, v = tag
                      old = h[k]
                      # make it an array if key repeats
            Severity: Minor
            Found in sentry-ruby/lib/sentry/metrics/local_aggregator.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 add_breadcrumb has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def add_breadcrumb(breadcrumb, hint: {})
                  return unless current_client
                  return unless configuration.enabled_in_current_env?
            
                  if before_breadcrumb = current_client.configuration.before_breadcrumb
            Severity: Minor
            Found in sentry-ruby/lib/sentry/hub.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 add_session has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def add_session(session)
                  return unless @release
            
                  return unless ensure_thread
            
            
            Severity: Minor
            Found in sentry-ruby/lib/sentry/session_flusher.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

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

                  def set_initial_sample_decision(transaction_sampled)
                    unless @profiling_enabled
                      @sampled = false
                      return
                    end
            Severity: Minor
            Found in sentry-ruby/lib/sentry/vernier/profiler.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 record has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                      def record(job, &block)
                        Sentry.with_scope do |scope|
                          begin
                            scope.set_transaction_name(job.class.name, source: :task)
                            transaction =
            Severity: Minor
            Found in sentry-rails/lib/sentry/rails/active_job.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 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 extract_request_info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def extract_request_info(req)
                    # IPv6 url could look like '::1/path', and that won't parse without
                    # wrapping it in square brackets.
                    hostname = address =~ Resolv::IPv6::Regex ? "[#{address}]" : address
                    uri = req.uri || URI.parse(URI::DEFAULT_PARSER.escape("#{use_ssl? ? 'https' : 'http'}://#{hostname}#{req.path}"))
            Severity: Minor
            Found in sentry-ruby/lib/sentry/net/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 set_initial_sample_decision has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def set_initial_sample_decision(transaction_sampled)
                  unless @profiling_enabled
                    @sampled = false
                    return
                  end
            Severity: Minor
            Found in sentry-ruby/lib/sentry/profiler.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 extract has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def extract(
                    carrier,
                    context: ::OpenTelemetry::Context.current,
                    getter: ::OpenTelemetry::Context::Propagation.text_map_getter
                  )
            Severity: Minor
            Found in sentry-opentelemetry/lib/sentry/opentelemetry/propagator.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 close has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def close
                  if @session_flusher
                    @session_flusher.flush
                    @session_flusher.kill
                    @session_flusher = nil
            Severity: Minor
            Found in sentry-ruby/lib/sentry-ruby.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

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

                  def flush(force: false)
                    flushable_buckets = get_flushable_buckets!(force)
                    code_locations = get_code_locations!
                    return if flushable_buckets.empty? && code_locations.empty?
            
            
            Severity: Minor
            Found in sentry-ruby/lib/sentry/metrics/aggregator.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

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

                def update_from_options(
                  contexts: nil,
                  extra: nil,
                  tags: nil,
                  user: nil,
            Severity: Minor
            Found in sentry-ruby/lib/sentry/scope.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

            Severity
            Category
            Status
            Source
            Language