connectbot/sshlib

View on GitHub

Showing 412 of 412 total issues

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

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

    private boolean verifySignature(byte[] sig, byte[] hostkey) throws IOException {
        SSHSignature sshSignature;
        if (kxs.np.server_host_key_algo.equals(Ed25519Verify.get().getKeyFormat())) {
            sshSignature = Ed25519Verify.get();
        } else if (kxs.np.server_host_key_algo.equals(ECDSASHA2Verify.ECDSASHA2NISTP256Verify.get().getKeyFormat())) {
Severity: Minor
Found in src/main/java/com/trilead/ssh2/transport/KexManager.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 requestX11Forwarding has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public void requestX11Forwarding(String hostname, int port, byte[] cookie, boolean singleConnection)
            throws IOException
    {
        if (hostname == null)
            throw new IllegalArgumentException("hostname argument may not be null");
Severity: Minor
Found in src/main/java/com/trilead/ssh2/Session.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 waitForGlobalRequestResult has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    private boolean waitForGlobalRequestResult() throws IOException
    {
        synchronized (channels)
        {
            while ((globalSuccessCounter == 0) && (globalFailedCounter == 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 uncompress has a Cognitive Complexity of 10 (exceeds 5 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

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 get has a Cognitive Complexity of 10 (exceeds 5 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

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 2 locations. Consider refactoring.
Open

        int packetLength = ((packetHeader[0] & 0xff) << 24)
                        | ((packetHeader[1] & 0xff) << 16) | ((packetHeader[2] & 0xff) << 8)
                        | ((packetHeader[3] & 0xff));
src/main/java/com/trilead/ssh2/crypto/Base64.java on lines 135..135

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

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.sftp;

/**
 *
Severity: Major
Found in src/main/java/com/trilead/ssh2/sftp/AttribBits.java and 1 other location - About 1 hr to fix
src/main/java/com/trilead/ssh2/sftp/AttribPermissions.java on lines 1..32

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

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

                    int v = (((buff[0] & 0x3f) << 18) | ((buff[1] & 0x3f) << 12) | ((buff[2] & 0x3f) << 6) | ((buff[3] & 0x3f)));
Severity: Major
Found in src/main/java/com/trilead/ssh2/crypto/Base64.java and 1 other location - About 1 hr to fix
src/main/java/com/trilead/ssh2/transport/TransportConnection.java on lines 347..349

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

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.sftp;

/**
 *
Severity: Major
Found in src/main/java/com/trilead/ssh2/sftp/AttribPermissions.java and 1 other location - About 1 hr to fix
src/main/java/com/trilead/ssh2/sftp/AttribBits.java on lines 1..129

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

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

    private boolean initialize(String user) throws IOException
    {
        if (!initDone)
        {
            tm.registerMessageHandler(this, 0, 255);
Severity: Minor
Found in src/main/java/com/trilead/ssh2/auth/AuthenticationManager.java - About 1 hr to fix

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

        private void init() throws IOException
        {
            /* Send SSH_FXP_INIT (version 3) */
    
            final int client_version = 3;
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 1 hr to fix

      Method decodePublicKey has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public PublicKey decodePublicKey(byte[] key) throws IOException {
              TypesReader tr = new TypesReader(key);
      
              String key_format = tr.readString();
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java - About 1 hr to fix

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

                catch (IOException e)
                {
                    log.log(50, "IOException in proxy code: " + e.getMessage());
        
                    try
        src/main/java/com/trilead/ssh2/channel/RemoteX11AcceptThread.java on lines 226..245

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

        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

                catch (IOException e)
                {
                    log.log(50, "IOException in X11 proxy code: " + e.getMessage());
        
                    try
        src/main/java/com/trilead/ssh2/channel/RemoteAcceptThread.java on lines 82..101

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

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

            private static byte[] generateKeyFromPasswordSaltWithMD5(byte[] password, byte[] salt, int keyLen)
                    throws IOException
            {
                if (salt.length < 8)
                    throw new IllegalArgumentException("Salt needs to be at least 8 bytes for key generation.");
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/crypto/PEMDecoder.java - About 1 hr to fix

          Method onConnect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  private void onConnect(Socks5Server server) throws IOException {
                      final Channel cn;
          
                      String destHost = server.getHostName();
                      if (destHost == null) {
          Severity: Minor
          Found in src/main/java/com/trilead/ssh2/channel/DynamicAcceptThread.java - About 1 hr to fix

            Method waitForChannelRequestResult has 26 lines of code (exceeds 25 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

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

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

                Method requestX11 has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public void requestX11(Channel c, boolean singleConnection, String x11AuthenticationProtocol,
                            String x11AuthenticationCookie, int x11ScreenNumber) throws IOException
                    {
                        PacketSessionX11Request psr;
                
                
                Severity: Minor
                Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language