lib/octopus/proxy_config.rb
Class ProxyConfig
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ProxyConfig
CURRENT_MODEL_KEY = 'octopus.current_model'.freeze
CURRENT_SHARD_KEY = 'octopus.current_shard'.freeze
CURRENT_GROUP_KEY = 'octopus.current_group'.freeze
CURRENT_SLAVE_GROUP_KEY = 'octopus.current_slave_group'.freeze
Method current_shard=
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
def current_shard=(shard_symbol)
if shard_symbol.is_a?(Array)
self.current_slave_group = nil
shard_symbol.each { |symbol| fail "Nonexistent Shard Name: #{symbol}" if shards[symbol].nil? }
elsif shard_symbol.is_a?(Hash)
- 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 initialize_shards
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
Open
def initialize_shards(config)
@original_config = config
self.shards = HashWithIndifferentAccess.new
self.shards_slave_groups = HashWithIndifferentAccess.new
- 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 initialize_shards
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize_shards(config)
@original_config = config
self.shards = HashWithIndifferentAccess.new
self.shards_slave_groups = HashWithIndifferentAccess.new
Method current_shard=
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def current_shard=(shard_symbol)
if shard_symbol.is_a?(Array)
self.current_slave_group = nil
shard_symbol.each { |symbol| fail "Nonexistent Shard Name: #{symbol}" if shards[symbol].nil? }
elsif shard_symbol.is_a?(Hash)