connectbot/sshlib

View on GitHub

Showing 412 of 412 total issues

Method unRegisterX11Cookie has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void unRegisterX11Cookie(String hexFakeCookie, boolean killChannels)
    {
        if (hexFakeCookie == null)
            throw new IllegalStateException("hexFakeCookie may not be null");

Severity: Minor
Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix

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

            for (int i = 0; i < remoteFiles.length; i++)
            {
                if (remoteFiles[i] == null)
                    throw new IllegalArgumentException("Cannot accept null filename.");
    
    
    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 666..677

    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 84.

    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

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

            for (int i = 0; i < remoteFiles.length; i++)
            {
                if (remoteFiles[i] == null)
                    throw new IllegalArgumentException("Cannot accept null filename.");
    
    
    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 718..729

    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 84.

    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

                for (int j = 28; j < 56; j++)
                {
                    l = j + totrot[i];
                    if (l < 56)
                    {
    Severity: Major
    Found in src/main/java/com/trilead/ssh2/crypto/cipher/DES.java and 1 other location - About 1 hr to fix
    src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 219..230

    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 84.

    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

                for (int j = 0; j < 28; j++)
                {
                    l = j + totrot[i];
                    if (l < 28)
                    {
    Severity: Major
    Found in src/main/java/com/trilead/ssh2/crypto/cipher/DES.java and 1 other location - About 1 hr to fix
    src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 232..243

    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 84.

    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 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public int read(byte[] b, int off, int len) throws IOException
        {
            if (b == null)
                throw new NullPointerException();
    
    
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/StreamGobbler.java - About 1 hr to fix

      Method sendMessage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void sendMessage(byte[] msg) throws IOException
          {
              if (Thread.currentThread() == receiveThread)
                  throw new IOException("Assertion error: sendMessage may never be invoked by the receiver thread!");
      
      
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/transport/TransportManager.java - About 1 hr to fix

        Method openDirectory has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private final byte[] openDirectory(String path) throws IOException
            {
                int req_id = generateNextRequestID();
        
                TypesWriter tw = new TypesWriter();
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

          Method init has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public void init(String name) throws IOException {
                  final DHParameterSpec spec;
                  if ("diffie-hellman-group18-sha512".equals(name)) {
                      spec = new DHParameterSpec(P18, G);
          Severity: Minor
          Found in src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java - About 1 hr to fix

            Method checkHashed has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private final boolean checkHashed(String entry, String hostname)
                {
                    if (!entry.startsWith("|1|"))
                        return false;
            
            
            Severity: Minor
            Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

              Method get has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public void get(String remoteFiles[], String localTargetDirectory) throws IOException
                  {
                      Session sess = null;
              
                      if ((remoteFiles == null) || (localTargetDirectory == null))
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 1 hr to fix

                Method rawToBubblebabbleFingerprint has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    static final private String rawToBubblebabbleFingerprint(byte[] raw)
                    {
                        final char[] v = "aeiouy".toCharArray();
                        final char[] c = "bcdfghklmnprstvzx".toCharArray();
                
                
                Severity: Minor
                Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

                  Method fstat has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public SFTPv3FileAttributes fstat(SFTPv3FileHandle handle) throws IOException
                      {
                          checkHandleValidAndOpen(handle);
                  
                          int req_id = generateNextRequestID();
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

                    Method decode has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private static byte[] decode(PKCS8EncodedKeySpec keySpec) throws InvalidKeySpecException {
                            byte[] encoded = keySpec.getEncoded();
                            if (encoded.length != ENCODED_SIZE) {
                                throw new InvalidKeySpecException("Key spec is of invalid size");
                            }
                    Severity: Minor
                    Found in src/main/java/com/trilead/ssh2/crypto/keys/Ed25519PrivateKey.java - About 1 hr to fix

                      Method msgChannelExtendedData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

                        Method calculateKey has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private static byte[] calculateKey(HashForSSH2Types sh, BigInteger K, byte[] H, byte type, byte[] SessionID,
                                    int keyLength)
                            {
                                byte[] res = new byte[keyLength];
                        
                        
                        Severity: Minor
                        Found in src/main/java/com/trilead/ssh2/crypto/KeyMaterial.java - About 1 hr to fix

                          Method statBoth has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private SFTPv3FileAttributes statBoth(String path, int statMethod) throws IOException
                              {
                                  int req_id = generateNextRequestID();
                          
                                  TypesWriter tw = new TypesWriter();
                          Severity: Minor
                          Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

                            Method requestCancelGlobalForward has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public void requestCancelGlobalForward(int bindPort) throws IOException
                                {
                                    RemoteForwardingData rfd = null;
                            
                                    synchronized (remoteForwardings)
                            Severity: Minor
                            Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix

                              Method parseCLine has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private LenNamePair parseCLine(String line) throws IOException
                                  {
                                      /* Minimum line: "xxxx y z" ---> 8 chars */
                              
                                      long len;
                              Severity: Minor
                              Found in src/main/java/com/trilead/ssh2/SCPClient.java - About 1 hr to fix

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

                                            public void run()
                                            {
                                                try
                                                {
                                                    receiveLoop();
                                Severity: Minor
                                Found in src/main/java/com/trilead/ssh2/transport/TransportManager.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

                                Severity
                                Category
                                Status
                                Source
                                Language