connectbot/sshlib

View on GitHub

Showing 244 of 412 total issues

Method getOrWaitForConnectionInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public ConnectionInfo getOrWaitForConnectionInfo(int minKexCount) throws IOException
    {
        synchronized (accessLock)
        {
            while (true)
Severity: Minor
Found in src/main/java/com/trilead/ssh2/transport/KexManager.java - About 45 mins 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 calculateKey has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    Method encode has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 requestPTY has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public void requestPTY(String term, int term_width_characters, int term_height_characters, int term_width_pixels,
                int term_height_pixels, byte[] terminal_modes) throws IOException
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/Session.java - About 45 mins to fix

      Method read has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public int read() throws IOException
          {
              synchronized (synchronizer)
              {
                  if (isClosed)
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/StreamGobbler.java - About 45 mins 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 init has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 unRegisterX11Cookie has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 handleMessage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public void handleMessage(byte[] msg, int msglen) throws IOException
          {
              if (msg == null)
              {
                  if (log.isEnabled())
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 45 mins 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 rawToBubblebabbleFingerprint has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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

      Avoid deeply nested control flow statements.
      Open

                              if (match.length == j)
                                  return false;
      Severity: Major
      Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 45 mins to fix

        Method checkHashed has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 msgChannelExtendedData has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 msgChannelOpenFailure has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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

        Avoid deeply nested control flow statements.
        Open

                                if ((pattern[i] == match[j]) && pseudoRegex(pattern, i + 1, match, j + 1))
                                    return true;
        Severity: Major
        Found in src/main/java/com/trilead/ssh2/KnownHosts.java - About 45 mins to fix

          Consider simplifying this complex logical expression.
          Open

                      if (tr.readByte() != 0x30 ||
                          tr.readByte() != 7 + ED25519_OID.length + KEY_BYTES_LENGTH ||
                          tr.readByte() != 0x30 ||
                          tr.readByte() != 2 + ED25519_OID.length ||
                          tr.readByte() != 0x06 ||
          Severity: Major
          Found in src/main/java/com/trilead/ssh2/crypto/keys/Ed25519PublicKey.java - About 40 mins to fix

            Method sendMessage has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private final void sendMessage(int type, int requestId, byte[] msg, int off, int len) throws IOException
            Severity: Minor
            Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 35 mins to fix

              Method read has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public int read(SFTPv3FileHandle handle, long fileOffset, byte[] dst, int dstoff, int len) throws IOException
              Severity: Minor
              Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java - About 35 mins to fix

                Method requestX11 has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public void requestX11(Channel c, boolean singleConnection, String x11AuthenticationProtocol,
                            String x11AuthenticationCookie, int x11ScreenNumber) throws IOException
                Severity: Minor
                Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 35 mins to fix

                  Method getChannelData has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public int getChannelData(Channel c, boolean extended, byte[] target, int off, int len) throws IOException
                  Severity: Minor
                  Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java - About 35 mins to fix

                    Method replyToChallenge has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        String[] replyToChallenge(String name, String instruction, int numPrompts, String[] prompt, boolean[] echo)
                    Severity: Minor
                    Found in src/main/java/com/trilead/ssh2/InteractiveCallback.java - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language