connectbot/sshlib

View on GitHub

Showing 412 of 412 total issues

Method uncompress has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public byte[] uncompress(byte[] buffer, int start, int[] length) {
        int inflated_end = 0;

        inflate.next_in = buffer;
        inflate.next_in_index = start;
Severity: Minor
Found in src/main/java/com/trilead/ssh2/compression/Zlib.java - About 1 hr to fix

    Method receiveMessage has a Cognitive Complexity of 13 (exceeds 5 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

    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 13 (exceeds 5 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

    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 decodeSignature has a Cognitive Complexity of 13 (exceeds 5 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 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 put has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        public void put(String[] localFiles, String[] remoteFiles, String remoteTargetDirectory, String mode)
                throws IOException
        {
            Session sess = null;
    
    
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/SCPClient.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 waitForChannelRequestResult has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        private boolean waitForChannelRequestResult(Channel c) throws IOException
        {
            synchronized (c)
            {
                while ((c.successCounter == 0) && (c.failedCounter == 0))
    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 encode has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static char[] encode(byte[] content)
        {
            CharArrayWriter cw = new CharArrayWriter((4 * content.length) / 3);
    
            int idx = 0;
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/crypto/Base64.java - About 1 hr to fix

      Method pseudoRegex has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private final boolean pseudoRegex(char[] pattern, int i, char[] match, int j)
          {
              /* This matching logic is equivalent to the one present in OpenSSH 4.1 */
      
              while (true)
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

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

        package com.trilead.ssh2.packets;
        
        /**
         * PacketGlobalAuthAgent.
         *
        src/main/java/com/trilead/ssh2/packets/PacketChannelTrileadPing.java on lines 1..35

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

        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;
        
        /**
         * PacketChannelTrileadPing.
        src/main/java/com/trilead/ssh2/packets/PacketChannelAuthAgentReq.java on lines 1..33

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

        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 authenticateInteractive has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public boolean authenticateInteractive(String user, String[] submethods, InteractiveCallback cb) throws IOException
            {
                try
                {
                    initialize(user);
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/auth/AuthenticationManager.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 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public void run()
                {
                    synchronized (todolist)
                    {
                        while (true)
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/util/TimeoutService.java - About 1 hr to fix

          Method requestGlobalForward has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public int requestGlobalForward(String bindAddress, int bindPort, String targetAddress, int targetPort)
                      throws IOException
              {
                  RemoteForwardingData rfd = new RemoteForwardingData();
          
          
          Severity: Minor
          Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix

            Method write has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public void write(SFTPv3FileHandle handle, long fileOffset, byte[] src, int srcoff, int len) throws IOException
                {
                    checkHandleValidAndOpen(handle);
            
                    while (len > 0)
            Severity: Minor
            Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

              Method createAttrs has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private byte[] createAttrs(SFTPv3FileAttributes attr)
                  {
                      TypesWriter tw = new TypesWriter();
              
                      int attrFlags = 0;
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

                Method put has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

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

                              j = ((rsArray[i++] << 24) & 0xff000000) | ((rsArray[i++] << 16) & 0x00ff0000)
                                      | ((rsArray[i++] << 8) & 0x0000ff00) | ((rsArray[i++]) & 0x000000ff);
                  Severity: Major
                  Found in src/main/java/com/trilead/ssh2/signature/DSASHA1Verify.java and 1 other location - About 1 hr to fix
                  src/main/java/com/trilead/ssh2/signature/DSASHA1Verify.java on lines 173..174

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

                  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

                              j = ((rsArray[i++] << 24) & 0xff000000) | ((rsArray[i++] << 16) & 0x00ff0000)
                                      | ((rsArray[i++] << 8) & 0x0000ff00) | ((rsArray[i++]) & 0x000000ff);
                  Severity: Major
                  Found in src/main/java/com/trilead/ssh2/signature/DSASHA1Verify.java and 1 other location - About 1 hr to fix
                  src/main/java/com/trilead/ssh2/signature/DSASHA1Verify.java on lines 176..177

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

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

                      public final static void addHostkeyToFile(File knownHosts, String[] hostnames, String serverHostKeyAlgorithm,
                              byte[] serverHostKey) throws IOException
                      {
                          if ((hostnames == null) || (hostnames.length == 0))
                              throw new IllegalArgumentException("Need at least one hostname specification");
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 1 hr to fix

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

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