connectbot/sshlib

View on GitHub

Showing 412 of 412 total issues

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

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

          static int[] bigbyte = { 0x800000, 0x400000, 0x200000, 0x100000, 0x80000, 0x40000, 0x20000, 0x10000, 0x8000,
                  0x4000, 0x2000, 0x1000, 0x800, 0x400, 0x200, 0x100, 0x80, 0x40, 0x20, 0x10, 0x8, 0x4, 0x2, 0x1 };
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/crypto/cipher/DES.java and 1 other location - About 45 mins to fix
      src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 91..92

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

      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

          static short[] Df_Key = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32,
                  0x10, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23, 0x45, 0x67 };
      Severity: Minor
      Found in src/main/java/com/trilead/ssh2/crypto/cipher/DES.java and 1 other location - About 45 mins to fix
      src/main/java/com/trilead/ssh2/crypto/cipher/DES.java on lines 96..97

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

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

          public byte[] getPayload()
          {
              if (payload == null)
              {
                  TypesWriter tw = new TypesWriter();
      Severity: Major
      Found in src/main/java/com/trilead/ssh2/packets/PacketKexDhGexInit.java and 3 other locations - About 45 mins to fix
      src/main/java/com/trilead/ssh2/packets/PacketKexDhGexRequestOld.java on lines 23..33
      src/main/java/com/trilead/ssh2/packets/PacketServiceAccept.java on lines 50..60
      src/main/java/com/trilead/ssh2/packets/PacketServiceRequest.java on lines 41..51

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

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

          public byte[] getPayload()
          {
              if (payload == null)
              {
                  TypesWriter tw = new TypesWriter();
      src/main/java/com/trilead/ssh2/packets/PacketKexDhGexInit.java on lines 22..32
      src/main/java/com/trilead/ssh2/packets/PacketKexDhGexRequestOld.java on lines 23..33
      src/main/java/com/trilead/ssh2/packets/PacketServiceAccept.java on lines 50..60

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

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

          public byte[] getPayload()
          {
              if (payload == null)
              {
                  TypesWriter tw = new TypesWriter();
      src/main/java/com/trilead/ssh2/packets/PacketKexDhGexInit.java on lines 22..32
      src/main/java/com/trilead/ssh2/packets/PacketServiceAccept.java on lines 50..60
      src/main/java/com/trilead/ssh2/packets/PacketServiceRequest.java on lines 41..51

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

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

          public byte[] getPayload()
          {
              if (payload == null)
              {
                  TypesWriter tw = new TypesWriter();
      src/main/java/com/trilead/ssh2/packets/PacketKexDhGexInit.java on lines 22..32
      src/main/java/com/trilead/ssh2/packets/PacketKexDhGexRequestOld.java on lines 23..33
      src/main/java/com/trilead/ssh2/packets/PacketServiceRequest.java on lines 41..51

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

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

                  synchronized (c)
                  {
                      c.remoteID = remoteID;
                      c.remoteWindow = remoteWindow & 0xFFFFffffL; /* convert UINT32 to long */
                      c.remoteMaxPacketSize = remoteMaxPacketSize;
      Severity: Major
      Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 2 other locations - About 40 mins to fix
      src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1239..1245
      src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1314..1320

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

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

                  synchronized (c)
                  {
                      c.remoteID = remoteID;
                      c.remoteWindow = remoteWindow & 0xFFFFffffL; /* properly convert UINT32 to long */
                      c.remoteMaxPacketSize = remoteMaxPacketSize;
      Severity: Major
      Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 2 other locations - About 40 mins to fix
      src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1239..1245
      src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1290..1296

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

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

                  synchronized (c)
                  {
                      c.remoteID = remoteID;
                      c.remoteWindow = remoteWindow & 0xFFFFffffL; /* properly convert UINT32 to long */
                      c.remoteMaxPacketSize = remoteMaxPacketSize;
      Severity: Major
      Found in src/main/java/com/trilead/ssh2/channel/ChannelManager.java and 2 other locations - About 40 mins to fix
      src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1290..1296
      src/main/java/com/trilead/ssh2/channel/ChannelManager.java on lines 1314..1320

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

      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

      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

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

                    if ((attr.atime != null) && (attr.mtime != null))
                    {
                        tw.writeUINT32(attr.atime.intValue());
                        tw.writeUINT32(attr.mtime.intValue());
                    }
        Severity: Minor
        Found in src/main/java/com/trilead/ssh2/SFTPv3Client.java and 1 other location - About 40 mins to fix
        src/main/java/com/trilead/ssh2/SFTPv3Client.java on lines 1140..1144

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

        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 static ECParameterSpec nistp521 = new ECParameterSpec(
                    new EllipticCurve(
                        new ECFieldFp(new BigInteger("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", 16)),
                        new BigInteger("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC", 16),
                        new BigInteger("0051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00", 16)),
        Severity: Major
        Found in src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java and 2 other locations - About 40 mins to fix
        src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java on lines 458..466
        src/main/java/com/trilead/ssh2/signature/ECDSASHA2Verify.java on lines 515..523

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

        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