lib/octopus/proxy.rb
Class Proxy
has 44 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Proxy
attr_accessor :proxy_config
delegate :current_model, :current_model=,
:current_shard, :current_shard=,
File proxy.rb
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
require 'set'
require 'octopus/slave_group'
require 'octopus/load_balancing/round_robin'
module Octopus
Method with_each_healthy_shard
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
def with_each_healthy_shard
shards.each do |shard_name, v|
begin
yield(v)
rescue => e
- 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 insert
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])
Method legacy_method_missing_logic
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
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)
- 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"