connectbot/sshlib

View on GitHub

Showing 244 of 412 total issues

Method run has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public void run()
    {
        try
        {
            while (true)
Severity: Minor
Found in src/main/java/com/trilead/ssh2/channel/StreamForwarder.java - About 2 hrs 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

File DES.java has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open


package com.trilead.ssh2.crypto.cipher;

/*
 * This file is based on the 3DES implementation from the Bouncy Castle Crypto package.
Severity: Minor
Found in src/main/java/com/trilead/ssh2/crypto/cipher/DES.java - About 2 hrs to fix

    Method close has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void close(Throwable cause, boolean useDisconnectPacket)
        {
            if (!useDisconnectPacket)
            {
                /* OK, hard shutdown - do not aquire the semaphore,
    Severity: Major
    Found in src/main/java/com/trilead/ssh2/transport/TransportManager.java - About 2 hrs to fix

      Method run has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void run()
          {
              try
              {
                  cm.registerThread(this);
      Severity: Major
      Found in src/main/java/com/trilead/ssh2/channel/LocalAcceptThread.java - About 2 hrs to fix

        Method msgChannelRequest has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public void msgChannelRequest(byte[] msg, int msglen) throws IOException
            {
                TypesReader tr = new TypesReader(msg, 0, msglen);
        
                tr.readByte(); // skip packet type
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 2 hrs 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 connect has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            public synchronized ConnectionInfo connect(ServerHostKeyVerifier verifier, int connectTimeout, int kexTimeout)
                    throws IOException
            {
                final class TimeoutState
                {
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/Connection.java - About 2 hrs 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 receiveFiles has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void receiveFiles(Session sess, String[] files, String target) throws IOException
            {
                byte[] buffer = new byte[8192];
        
                OutputStream os = new BufferedOutputStream(sess.getStdin(), 512);
        Severity: Major
        Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 2 hrs to fix

          KnownHosts has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

          public class KnownHosts
          {
              public static final int HOSTKEY_IS_OK = 0;
              public static final int HOSTKEY_IS_NEW = 1;
              public static final int HOSTKEY_HAS_CHANGED = 2;
          Severity: Minor
          Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 2 hrs to fix

            Method msgChannelRequest has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void msgChannelRequest(byte[] msg, int msglen) throws IOException
                {
                    TypesReader tr = new TypesReader(msg, 0, msglen);
            
                    tr.readByte(); // skip packet type
            Severity: Major
            Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 2 hrs to fix

              Method readAttrs has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  private SFTPv3FileAttributes readAttrs(TypesReader tr) throws IOException
                  {
                      /*
                       * uint32   flags
                       * uint64   size           present only if flag SSH_FILEXFER_ATTR_SIZE
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 2 hrs 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 initialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  public void initialize(CryptoWishList cwl, ServerHostKeyVerifier verifier, DHGexParameters dhgex,
                          int connectTimeout, SecureRandom rnd, ProxyData proxyData) throws IOException
                  {
                      /* First, establish the TCP connection to the SSH-2 server */
              
              
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/transport/TransportManager.java - About 2 hrs 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 sendFiles has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void sendFiles(Session sess, String[] files, String[] remoteFiles, String mode) throws IOException
                  {
                      byte[] buffer = new byte[8192];
              
                      OutputStream os = new BufferedOutputStream(sess.getStdin(), 40000);
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 2 hrs 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

              File TransportConnection.java has 257 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              
              package com.trilead.ssh2.transport;
              
              import java.io.IOException;
              import java.io.InputStream;
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/transport/TransportConnection.java - About 2 hrs to fix

                ECDSASHA2Verify has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                public abstract class ECDSASHA2Verify implements SSHSignature {
                    private static final Logger log = Logger.getLogger(ECDSASHA2Verify.class);
                
                    public static final String ECDSA_SHA2_PREFIX = "ecdsa-sha2-";
                
                
                Severity: Minor
                Found in src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java - About 2 hrs to fix

                  Method mergeKexParameters has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private NegotiatedParameters mergeKexParameters(KexParameters client, KexParameters server)
                      {
                          NegotiatedParameters np = new NegotiatedParameters();
                  
                          try
                  Severity: Major
                  Found in src/main/java/com/trilead/ssh2/transport/KexManager.java - About 2 hrs to fix

                    Method sendFiles has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private void sendFiles(Session sess, String[] files, String[] remoteFiles, String mode) throws IOException
                        {
                            byte[] buffer = new byte[8192];
                    
                            OutputStream os = new BufferedOutputStream(sess.getStdin(), 40000);
                    Severity: Major
                    Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 2 hrs to fix

                      Method sendData has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public void sendData(Channel c, byte[] buffer, int pos, int len) throws IOException
                          {
                              while (len > 0)
                              {
                                  int thislen = 0;
                      Severity: Major
                      Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 2 hrs to fix

                        Method processSignRequest has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private void processSignRequest(TypesReader tr)
                            {
                                try
                                {
                                    if (failWhenLocked())
                        Severity: Major
                        Found in src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java - About 2 hrs to fix

                          Consider simplifying this complex logical expression.
                          Open

                                      if (kxs.np.kex_algo.equals(Curve25519Exchange.NAME)
                                              || kxs.np.kex_algo.equals(Curve25519Exchange.ALT_NAME)
                                              || kxs.np.kex_algo.equals("ecdh-sha2-nistp521")
                                              || kxs.np.kex_algo.equals("ecdh-sha2-nistp384")
                                              || kxs.np.kex_algo.equals("ecdh-sha2-nistp256")
                          Severity: Critical
                          Found in src/main/java/com/trilead/ssh2/transport/KexManager.java - About 2 hrs to fix

                            Consider simplifying this complex logical expression.
                            Open

                                    if (kxs.np.kex_algo.equals("diffie-hellman-group1-sha1")
                                            || kxs.np.kex_algo.equals("diffie-hellman-group14-sha1")
                                            || kxs.np.kex_algo.equals("diffie-hellman-group14-sha256")
                                            || kxs.np.kex_algo.equals("diffie-hellman-group16-sha512")
                                            || kxs.np.kex_algo.equals("diffie-hellman-group18-sha512")
                            Severity: Critical
                            Found in src/main/java/com/trilead/ssh2/transport/KexManager.java - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language