Showing 119 of 209 total issues
Method protocol_execute_commands
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def protocol_execute_commands(commands)
trace :debug, "[#{@element['name']}] Received command is: #{commands.inspect}"
# fallback to array if it's a single command
- 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 push
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def push
# only the DB is authorized to send PUSH commands
unless from_db?(@request[:headers])
trace :warn, "HACK ALERT: #{@request[:peer]} is trying to send PUSH [#{@request[:uri]}] commands!!!"
return method_not_allowed
- 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 timeout
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def timeout(delta = 7200)
trace :debug, "Session Manager timing out entries..." if @sessions.length > 0
# save the size of the hash before deletion
size = @sessions.length
# search for timed out sessions
- 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 compact
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compact(instance)
# sanity check
path = REPO_DIR + '/' + instance
return unless File.exist?(path)
- 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 print_section
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def print_section(section)
puts "Last 5 #{section.to_s} statistics:"
table_width = 0
@stats[:total].each_key do |k|
- 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 new_conf?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def new_conf?(bid)
# check if we have the config in the cache
# probably and old one not yet sent
return true if DBCache.new_conf? bid
# cannot reach the db, return false
- 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 purge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def purge(instance, options = {force: false, timeout: false})
# forced deletion
if options[:force]
FileUtils.rm_rf(REPO_DIR + '/' + instance)
- 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 'symbian', '.sisx' if user_agent['Symbian']
Avoid too many return
statements within this method. Open
return not_found if os == 'cydia' and not File.file?(file_path)
Avoid too many return
statements within this method. Open
return enc_msg, 'application/octet-stream', cookie
Avoid too many return
statements within this method. Open
return stream_file(File.realdirpath(file_path), proc {delete_after_serve(File.realdirpath(file_path), os) if delete})
Avoid too many return
statements within this method. Open
return 'linux', '.bin' if user_agent['Linux'] or user_agent['X11']
Avoid too many return
statements within this method. Open
return 'unknown', ''
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return
Avoid too many return
statements within this method. Open
return message, 'application/octet-stream', cookie
Avoid too many return
statements within this method. Open
return true
Avoid too many return
statements within this method. Open
return 'blackberry', "_" + version + '.jad'
Avoid too many return
statements within this method. Open
return 'cydia', '.deb' if user_agent['Telesphoreo']
Avoid too many return
statements within this method. Open
return 'android', "." + version + '.apk'