sentry-ruby/lib/sentry/configuration.rb
Class Configuration
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Configuration
include CustomInspection
include LoggingHelper
include ArgumentCheckingHelper
File configuration.rb
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require "concurrent/utility/processor_counter"
require "sentry/utils/exception_cause_chain"
require "sentry/utils/custom_inspection"
require "sentry/utils/env_helper"
Method initialize
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
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
Method detect_release
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def detect_release
return unless sending_allowed?
@release ||= ReleaseDetector.detect_release(project_root: project_root, running_on_heroku: running_on_heroku?)
- Read upRead up
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
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?
- Read upRead up
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"