activesupport/lib/active_support/notifications/fanout.rb

Summary

Maintainability
C
7 hrs
Test Coverage

File fanout.rb has 350 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "concurrent/map"
require "set"
require "active_support/core_ext/object/try"

module ActiveSupport
Severity: Minor
Found in activesupport/lib/active_support/notifications/fanout.rb - About 4 hrs to fix

    Method iterate_guarding_exceptions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

            def iterate_guarding_exceptions(collection)
              exceptions = nil
    
              collection.each do |s|
                yield s
    Severity: Minor
    Found in activesupport/lib/active_support/notifications/fanout.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 new has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

            def self.new(pattern, listener, monotonic)
              subscriber_class = monotonic ? MonotonicTimed : Timed
    
              if listener.respond_to?(:start) && listener.respond_to?(:finish)
                subscriber_class = Evented
    Severity: Minor
    Found in activesupport/lib/active_support/notifications/fanout.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 groups_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def groups_for(name) # :nodoc:
            groups = @groups_for.compute_if_absent(name) do
              all_listeners_for(name).reject(&:silenceable).group_by(&:group_class).transform_values do |s|
                s.map(&:delegate)
              end
    Severity: Minor
    Found in activesupport/lib/active_support/notifications/fanout.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 unsubscribe has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def unsubscribe(subscriber_or_name)
            @mutex.synchronize do
              case subscriber_or_name
              when String
                @string_subscribers[subscriber_or_name].clear
    Severity: Minor
    Found in activesupport/lib/active_support/notifications/fanout.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