connectbot/sshlib

View on GitHub

Showing 244 of 412 total issues

Method decodeSignature has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private byte[] decodeSignature(byte[] sig) throws IOException
    {
        byte[] rsArray = null;

        if (sig.length == 40)
Severity: Minor
Found in src/main/java/com/trilead/ssh2/signature/DSASHA1Verify.java - About 2 hrs to fix

    Method hostnameMatches has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private final boolean hostnameMatches(String[] hostpatterns, String hostname)
        {
            boolean isMatch = false;
            boolean negate = false;
    
    
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 2 hrs to fix

      Method waitForCondition has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public int waitForCondition(Channel c, long timeout, int condition_mask)
          {
              long end_time = 0;
              boolean end_time_set = false;
      
      
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix

        Method verifyHostkey has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public int verifyHostkey(String hostname, String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException
            {
                PublicKey remoteKey = null;
        
                if (RSASHA1Verify.ID_SSH_RSA.equals(serverHostKeyAlgorithm) ||
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

          Method receiveFiles has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method receiveMessage has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public int receiveMessage(byte[] buffer, int off, int len) throws IOException
                {
                    final int packetLength;
                    final int payloadLength;
            
            
            Severity: Minor
            Found in src/main/java/com/trilead/ssh2/transport/TransportConnection.java - About 1 hr to fix

              Method scanDirectory has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private final Vector scanDirectory(byte[] handle) throws IOException
                  {
                      Vector files = new Vector();
              
                      while (true)
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

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

                        public void run()
                        {
                            byte[] buff = new byte[8192];
                
                            while (true)
                Severity: Minor
                Found in src/main/java/com/trilead/ssh2/StreamGobbler.java - About 1 hr to fix

                  Method removeDuplicates has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private String[] removeDuplicates(String[] list)
                      {
                          if ((list == null) || (list.length < 2))
                              return list;
                  
                  
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/Connection.java - 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 read has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public int read(SFTPv3FileHandle handle, long fileOffset, byte[] dst, int dstoff, int len) throws IOException
                      {
                          checkHandleValidAndOpen(handle);
                  
                          if ((len > 32768) || (len <= 0))
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

                    Method initialize has 46 lines of code (exceeds 25 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 1 hr to fix

                      Method msgChannelOpenFailure has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public void msgChannelOpenFailure(byte[] msg, int msglen) throws IOException
                          {
                              if (msglen < 5)
                                  throw new IOException("SSH_MSG_CHANNEL_OPEN_FAILURE message has wrong size (" + msglen + ")");
                      
                      
                      Severity: Minor
                      Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix

                        Method addHostkey has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public void addHostkey(String[] hostnames, String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException
                            {
                                if (hostnames == null)
                                    throw new IllegalArgumentException("hostnames may not be null");
                        
                        
                        Severity: Minor
                        Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

                          Method processSignRequest has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private void processSignRequest(TypesReader tr)
                              {
                                  try
                                  {
                                      if (failWhenLocked())
                          Severity: Minor
                          Found in src/main/java/com/trilead/ssh2/channel/AuthAgentForwardThread.java - 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 read has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public int read(SFTPv3FileHandle handle, long fileOffset, byte[] dst, int dstoff, int len) throws IOException
                              {
                                  checkHandleValidAndOpen(handle);
                          
                                  if ((len > 32768) || (len <= 0))
                          Severity: Minor
                          Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - 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 msgChannelOpen has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public void msgChannelOpen(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 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 verifyHostkey has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public int verifyHostkey(String hostname, String serverHostKeyAlgorithm, byte[] serverHostKey) throws IOException
                              {
                                  PublicKey remoteKey = null;
                          
                                  if (RSASHA1Verify.ID_SSH_RSA.equals(serverHostKeyAlgorithm) ||
                          Severity: Minor
                          Found in src/main/java/com/trilead/ssh2/KnownHosts.java - 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 run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public void run()
                              {
                                  try
                                  {
                                      cm.registerThread(this);
                          Severity: Minor
                          Found in src/main/java/com/trilead/ssh2/channel/LocalAcceptThread.java - 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 run has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public void run()
                              {
                                  try
                                  {
                                      c.cm.sendOpenConfirmation(c);
                          Severity: Minor
                          Found in src/main/java/com/trilead/ssh2/channel/RemoteAcceptThread.java - About 1 hr to fix

                            Consider simplifying this complex logical expression.
                            Open

                                        if (tr.readByte() != 0x30 || // ASN.1 sequence
                                            tr.readByte() != ENCODED_SIZE - 2 || // Expected size
                                            tr.readByte() != 0x02 || // ASN.1 Integer
                                            tr.readByte() != 1 || // length
                                            tr.readByte() != 0 || // v1
                            Severity: Critical
                            Found in src/main/java/com/trilead/ssh2/crypto/keys/Ed25519PrivateKey.java - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language