connectbot/sshlib

View on GitHub

Showing 412 of 412 total issues

Similar blocks of code found in 8 locations. Consider refactoring.
Open

    static int[] SP6 = { 0x20000010, 0x20400000, 0x00004000, 0x20404010, 0x20400000, 0x00000010, 0x20404010,
            0x00400000, 0x20004000, 0x00404010, 0x00400000, 0x20000010, 0x00400010, 0x20004000, 0x20000000, 0x00004010,
            0x00000000, 0x00400010, 0x20004010, 0x00004000, 0x00404000, 0x20004010, 0x00000010, 0x20400010, 0x20400010,
            0x00000000, 0x00404010, 0x20404000, 0x00004010, 0x00404000, 0x20404000, 0x20000000, 0x20004000, 0x00000010,
            0x20400010, 0x00404000, 0x20404010, 0x00400000, 0x00004010, 0x20000010, 0x00400000, 0x20004000, 0x20000000,
Severity: Major
Found in src/main/java/com/trilead/ssh2/crypto/cipher/DES.java and 7 other locations - About 2 hrs to fix
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 112..119
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 121..128
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 130..137
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 139..146
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 148..155
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 166..173
src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 175..182

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 134.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open


package com.trilead.ssh2.packets;

/**
 * PacketGlobalForwardRequest.
src/main/java/com/trilead/ssh2/packets/PacketGlobalCancelForwardRequest.java on lines 1..42

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 134.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open


package com.trilead.ssh2.packets;

/**
 * PacketGlobalCancelForwardRequest.
src/main/java/com/trilead/ssh2/packets/PacketGlobalForwardRequest.java on lines 1..41

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 134.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        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

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                            public PacketUserauthFailure(byte payload[], int off, int len) throws IOException
                            {
                                this.payload = new byte[len];
                                System.arraycopy(payload, off, this.payload, 0, len);
                        
                        
                        src/main/java/com/trilead/ssh2/packets/PacketChannelWindowAdjust.java on lines 24..43
                        src/main/java/com/trilead/ssh2/packets/PacketKexDhGexGroup.java on lines 20..39

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 124.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                            public PacketKexDhGexGroup(byte payload[], int off, int len) throws IOException
                            {
                                this.payload = new byte[len];
                                System.arraycopy(payload, off, this.payload, 0, len);
                        
                        
                        src/main/java/com/trilead/ssh2/packets/PacketChannelWindowAdjust.java on lines 24..43
                        src/main/java/com/trilead/ssh2/packets/PacketUserauthFailure.java on lines 25..42

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 124.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        Further Reading

                        Similar blocks of code found in 3 locations. Consider refactoring.
                        Open

                            public PacketChannelWindowAdjust(byte payload[], int off, int len) throws IOException
                            {
                                this.payload = new byte[len];
                                System.arraycopy(payload, off, this.payload, 0, len);
                        
                        
                        src/main/java/com/trilead/ssh2/packets/PacketKexDhGexGroup.java on lines 20..39
                        src/main/java/com/trilead/ssh2/packets/PacketUserauthFailure.java on lines 25..42

                        Duplicated Code

                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                        Tuning

                        This issue has a mass of 124.

                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                        Refactorings

                        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

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                                      while (true)
                                      {
                                          int c = is.read();
                                          if (c < 0)
                                              throw new IOException("Remote scp terminated unexpectedly.");
                          Severity: Major
                          Found in src/main/java/com/trilead/ssh2/SCPClient.java and 1 other location - About 1 hr to fix
                          src/main/java/com/trilead/ssh2/SCPClient.java on lines 257..282

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 122.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Severity
                          Category
                          Status
                          Source
                          Language