File xmpp_server_order.rb
has 436 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'net/ssh'
require 'net/sftp'
module SocialStream
Class XmppServerOrder
has 39 methods (exceeds 20 allowed). Consider refactoring. Open
class XmppServerOrder
class << self
##################
Method executeRemoteCommands
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def executeRemoteCommands(commands)
if commands.empty?
return "No command received";
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 executeRemoteCommands
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def executeRemoteCommands(commands)
if commands.empty?
return "No command received";
end
Method generateRSAKeys
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generateRSAKeys(keysPath)
unless File.directory?(keysPath)
return "Keys path not exists"
end
Method authorization
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authorization(params)
case SocialStream::Presence.secure_rest_api
when true
#Authorization using asymmetric RSA keys
begin
Method setRosterForBidirectionalTie
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def setRosterForBidirectionalTie(userASid,userBSid,userANick,userBNick,groupForA,groupForB)
Method authorization
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def authorization(params)
case SocialStream::Presence.secure_rest_api
when true
#Authorization using asymmetric RSA keys
begin
- 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 addBuddyToRoster
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def addBuddyToRoster(userSid,buddySid,buddyNick,buddyGroup,subscription_type)
Avoid too many return
statements within this method. Open
return ( params[:password] and params[:password] == SocialStream::Presence.xmpp_server_password )
Method recursiveCopyFolder
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def recursiveCopyFolder(localPath,remotePath,sftp)
#Check if localPath is a file
if File.file?(localPath) and File.file?(remotePath)
puts "Copy files..."
- 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"