ging/social_stream

View on GitHub
presence/lib/social_stream/presence/xmpp_server_order.rb

Summary

Maintainability
D
2 days
Test Coverage

File xmpp_server_order.rb has 436 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'net/ssh'
require 'net/sftp'


module SocialStream
Severity: Minor
Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 6 hrs to fix

    Class XmppServerOrder has 39 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class XmppServerOrder
          
          class << self
              
              ##################
    Severity: Minor
    Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 5 hrs to fix

      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
                  
      Severity: Minor
      Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 1 hr to fix

      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
                  
      Severity: Minor
      Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 1 hr to fix

        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
        Severity: Minor
        Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 1 hr to fix

          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
          Severity: Minor
          Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 1 hr to fix

            Method setRosterForBidirectionalTie has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                      def setRosterForBidirectionalTie(userASid,userBSid,userANick,userBNick,groupForA,groupForB)
            Severity: Minor
            Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 45 mins to fix

              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
              Severity: Minor
              Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 45 mins to fix

              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)
              Severity: Minor
              Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 35 mins to fix

                Avoid too many return statements within this method.
                Open

                              return ( params[:password] and params[:password] == SocialStream::Presence.xmpp_server_password )
                Severity: Major
                Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 30 mins to fix

                  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..."
                  Severity: Minor
                  Found in presence/lib/social_stream/presence/xmpp_server_order.rb - About 25 mins to fix

                  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

                  There are no issues that match your filters.

                  Category
                  Status