redis-store/redis-activesupport

View on GitHub

Showing 5 of 7 total issues

Class RedisStore has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

    class RedisStore < Store

      ERRORS_TO_RESCUE = [
        Errno::ECONNREFUSED,
        Errno::EHOSTUNREACH,
Severity: Minor
Found in lib/active_support/cache/redis_store.rb - About 2 hrs to fix

    Method initialize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def initialize(*addresses)
            @options = addresses.extract_options!
            addresses = addresses.compact.map(&:dup)
    
            @data = if @options[:pool]
    Severity: Minor
    Found in lib/active_support/cache/redis_store.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 read_multi has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def read_multi(*names)
            options = names.extract_options!
            return {} if names == []
    
            keys = names.map{|name| normalize_key(name, options)}
    Severity: Minor
    Found in lib/active_support/cache/redis_store.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 write has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def write(name, value, options = nil)
            options = merged_options(options.to_h.symbolize_keys)
            instrument(:write, name, options) do |_payload|
              if options[:expires_in].present? && options[:race_condition_ttl].present? && options[:raw].blank?
                options[:expires_in] = options[:expires_in].to_f + options[:race_condition_ttl].to_f
    Severity: Minor
    Found in lib/active_support/cache/redis_store.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 read_entry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

            def read_entry(key, options)
              failsafe(:read_entry) do
                entry = with { |c| c.get key, options }
                return unless entry
                entry.is_a?(Entry) ? entry : Entry.new(entry)
    Severity: Minor
    Found in lib/active_support/cache/redis_store.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