thiagopradi/octopus

View on GitHub
lib/octopus/proxy.rb

Summary

Maintainability
C
1 day
Test Coverage

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

  class Proxy
    attr_accessor :proxy_config

    delegate :current_model, :current_model=,
             :current_shard, :current_shard=,
Severity: Minor
Found in lib/octopus/proxy.rb - About 6 hrs to fix

    File proxy.rb has 273 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'set'
    require 'octopus/slave_group'
    require 'octopus/load_balancing/round_robin'
    
    module Octopus
    Severity: Minor
    Found in lib/octopus/proxy.rb - About 2 hrs to fix

      Method with_each_healthy_shard has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def with_each_healthy_shard
            shards.each do |shard_name, v|
              begin
                yield(v)
              rescue => e
      Severity: Minor
      Found in lib/octopus/proxy.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 insert has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])
      Severity: Minor
      Found in lib/octopus/proxy.rb - About 45 mins to fix

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

            def legacy_method_missing_logic(method, *args, &block)
              if should_clean_connection_proxy?(method)
                conn = select_connection
                clean_connection_proxy
                conn.send(method, *args, &block)
        Severity: Minor
        Found in lib/octopus/proxy.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

        There are no issues that match your filters.

        Category
        Status