Showing 60 of 90 total issues
Method decode_content
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def decode_content(common_info, chunks)
stream = StringIO.new chunks.join
until stream.eof?
- 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 decode_content
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def decode_content(common_info, chunks)
stream = StringIO.new chunks.join
entries = []
- 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 chunkerize
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def chunkerize(data)
offset = 0
chunk_num = 0
loop do
- 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 task
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def task(name, &block)
if name.kind_of?(Hash)
name.each do |alias_name, task_name|
raise("Undefined task `#{task_name}'") unless @@tasks[task_name.to_s]
@@tasks[alias_name.to_s] = @@tasks[task_name.to_s]
- 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 service_failure
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def service_failure(service_name, reset = 0, action1 = "restart/60000", action2 = "restart/60000", action3 = "restart/60000")
Method decode_content
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def decode_content(common_info, chunks)
stream = StringIO.new chunks.join
output = stream.read
- 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 require_component
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def require_component(name, opts = {})
$invocation_directory = Dir.pwd
$invocation_directory = ENV['CWD'] if ENV['CWD']
init_script = caller[0].scan(/^(.+)\:\d+\:.+$/)[0][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 call
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.call(command, read: false)
command = "netsh advfirewall #{command.strip}"
unless exists?
raise "The Windows Firewall is missing. You cannot call the command #{command.inspect} on this OS."
- 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 rm_rf
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def rm_rf(path, allow: [], check: true)
if localhost?
FileUtils.rm_rf(unixpath(path))
else
request("ruby -e 'require \"fileutils\"; FileUtils.rm_rf(\"#{unixpath(path)}\");'", exec: 1)
- 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 decode_additional_header
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def decode_additional_header(data)
raise EvidenceDeserializeError.new("incomplete PHOTO") if data.nil? or data.bytesize == 0
binary = StringIO.new data
- 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 decode_content
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def decode_content(common_info, chunks)
stream = StringIO.new chunks.join
until stream.eof?
info = Hash[common_info]
- 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
Avoid too many return
statements within this method. Open
return false
Method mirror
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mirror(local_folder, remote_folder, opts = {})
opts[:trap] = true
result = mirror!(local_folder, remote_folder, opts)
changes = result.split("\n")[1..-3].reject { |x| x.empty? }
changed = changes.size > 0 && changes != ["./"]
- 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 decode_query
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decode_query(url)
query = []
query = url.scan(/(?:&?|^)q=([^&]*)(?:&|$)/).first if url['google']
query = url.scan(/(?:&?|^)p=([^&]*)(?:&|$)/).first if url['yahoo']
query = url.scan(/(?:&?|^)q=([^&]*)(?:&|$)/).first if url['bing']
- 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 decode_additional_header
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decode_additional_header(data)
raise EvidenceDeserializeError.new("incomplete CHAT MultiMedia") if data.nil? or data.bytesize == 0
stream = StringIO.new data
info = decode_from_to({}, stream)
- 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 decode_from_to
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def decode_from_to(common_info, stream)
tm = stream.read 36
info = Hash[common_info]
info[:da] = Time.gm(*(tm.unpack('L*')), 0)
info[:data] = Hash.new if info[:data].nil?
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(name = DEFAULT_NAME, options = {})
@name = name.to_s.downcase.strip
@name = DEFAULT_NAME if @name.empty?
@mongoid_session_name = options[:mongoid_session_name] || :default
@setup_on_write = options[:lazy].nil? ? true : options[:lazy]
- 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 read_utf16le_string
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_utf16le_string
# at least the null terminator
return '' if self.size < 2
# empty string by default
- 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 filesystem_stat_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.filesystem_stat_path
return @@filesystem_stat_path if @@filesystem_stat_path
pwd = Dir.pwd
- 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 private_ipv4?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def private_ipv4?
a,b,c,d = remote_addr.split(".").map(&:to_i)
return true if a==127 && b==0 && c==0 && d==1 # localhost
return true if a==192 && b==168 && c.between?(0,255) && d.between?(0,255) # 192.168.0.0/16
return true if a==172 && b.between?(16,31) && c.between?(0,255) && d.between?(0,255) # 172.16.0.0/12
- 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"