getsentry/raven-ruby

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

Summary

Maintainability
D
1 day
Test Coverage

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

  class Configuration
    include CustomInspection
    include LoggingHelper
    include ArgumentCheckingHelper

Severity: Minor
Found in sentry-ruby/lib/sentry/configuration.rb - About 6 hrs to fix

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

    require "concurrent/utility/processor_counter"
    
    require "sentry/utils/exception_cause_chain"
    require "sentry/utils/custom_inspection"
    require "sentry/utils/env_helper"
    Severity: Minor
    Found in sentry-ruby/lib/sentry/configuration.rb - About 4 hrs to fix

      Method initialize has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize
            self.app_dirs_pattern = APP_DIRS_PATTERN
            self.debug = Sentry::Utils::EnvHelper.env_to_bool(ENV["SENTRY_DEBUG"])
            self.background_worker_threads = (processor_count / 2.0).ceil
            self.background_worker_max_queue = BackgroundWorker::DEFAULT_MAX_QUEUE
      Severity: Minor
      Found in sentry-ruby/lib/sentry/configuration.rb - About 1 hr to fix

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

            def csp_report_uri
              if dsn && dsn.valid?
                uri = dsn.csp_report_uri
                uri += "&sentry_release=#{CGI.escape(release)}" if release && !release.empty?
                uri += "&sentry_environment=#{CGI.escape(environment)}" if environment && !environment.empty?
        Severity: Minor
        Found in sentry-ruby/lib/sentry/configuration.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