Showing 491 of 491 total issues
Method ev_delete
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def ev_delete(s)
if s.length < 2
@log.error("delete:wrong number of arguments(#{s})")
return send_data("CLIENT_ERROR Wrong number of arguments.\r\n")
end
- 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 async_process_loop
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def async_process_loop
loop do
while msg = @@async_queue.pop
if send("asyncev_#{msg.event}", msg.args)
msg.callback.call(msg, true) if msg.callback
- 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 async_process_loop_for_latency
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def async_process_loop_for_latency
loop do
while msg = @@async_queue_latency.pop
if send("asyncev_#{msg.event}", msg.args)
msg.callback.call(msg, true) if msg.callback
- 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 leave
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def leave(nid)
unless @enabled_failover
return
end
return unless @rd.nodes.include?(nid)
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ret.instance_of? Array
flg, expt, value, count, msg = ret
ret = @storages[ctx.params.hash_name].set(ctx.params.vn,
ctx.params.key,
ctx.params.digest,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 104.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def ev_alist_last(s)
hname, k, d, vn, nodes = calc_hash(s[1])
return forward1(nodes[0], s) if nodes[0] != @nid
ddata = @storages[hname].get(vn, k, d)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 104.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
if ret.instance_of? Array
flg, expt, value, count, msg = ret
ret = @storages[ctx.params.hash_name].set(ctx.params.vn,
ctx.params.key,
ctx.params.digest,
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 104.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def ev_alist_first(s)
hname, k, d, vn, nodes = calc_hash(s[1])
return forward1(nodes[0], s) if nodes[0] != @nid
ddata = @storages[hname].get(vn, k, d)
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 104.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method ev_alist_to_json
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def ev_alist_to_json(s)
hname, k, d, vn, nodes = calc_hash(s[1])
return forward1(nodes[0], s) if nodes[0] != @nid
ddata = @storages[hname].get(vn, k, 0)
- 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 ev_alist_join_with_time
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def ev_alist_join_with_time(s)
hname, k, d, vn, nodes = calc_hash(s[1])
data = read_bytes(s[2].to_i)
read_bytes(2)
return forward1(nodes[0], s, data) if nodes[0] != @nid
- 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 ev_alist_gets_with_time
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def ev_alist_gets_with_time(s)
hname, k, d, vn, nodes = calc_hash(s[1])
return forward1(nodes[0], s) if nodes[0] != @nid
ddata = @storages[hname].get(vn, k, 0)
- 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 ev_alist_gets
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def ev_alist_gets(s)
hname, k, d, vn, nodes = calc_hash(s[1])
return forward1(nodes[0], s) if nodes[0] != @nid
ddata = @storages[hname].get(vn, k, 0)
- 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 ev_alist_join
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def ev_alist_join(s)
hname, k, d, vn, nodes = calc_hash(s[1])
data = read_bytes(s[2].to_i)
read_bytes(2)
return forward1(nodes[0], s, data) if nodes[0] != @nid
- 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 storage_cachecleaning_process
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def storage_cachecleaning_process(hname, dn)
count = 0
rcount = 0
st = @storages[hname]
- 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 def_write_command_with_key_value
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def def_write_command_with_key_value(cmd, idx_of_val_len, forward = :one_line, &block)
define_method "ev_#{cmd}" do |s|
return send_data("CLIENT_ERROR does not find key\r\n") if s.length < 2
begin
params = CommandParams.new
Class Handler
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Handler < EventMachine::Connection
@@ev_list={}
def self.ev_list; @@ev_list; end
@@system_commands={}
def self.system_commands; @@system_commands; end
File write_behind.rb
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'thread'
require 'roma/stats'
require 'socket'
require 'roma/messaging/con_pool'
require 'timeout'
Method def_write_command_with_key
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def def_write_command_with_key(cmd, forward = :one_line, &block)
define_method "ev_#{cmd}" do |s|
return send_data("CLIENT_ERROR does not find key\r\n") if s.length < 2
begin
params = CommandParams.new
Method upload_data2
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def upload_data2(hname, nid, keys)
con = Roma::Messaging::ConPool.instance.get_connection(nid)
cmd = "#{@pushv_cmd} #{hname} 0\r\n"
con.write(cmd)
- 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 ev_spushv
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ev_spushv(s)
if s.length != 3
@log.error("#{__method__}:wrong number of arguments(#{s})")
return send_data("CLIENT_ERROR Wrong number of arguments.\r\n")
end