connectbot/sshlib

View on GitHub

Showing 412 of 412 total issues

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

        long high = ((arr[pos++] & 0xff) << 24) | ((arr[pos++] & 0xff) << 16) | ((arr[pos++] & 0xff) << 8)
                | (arr[pos++] & 0xff); /* sign extension may take place - will be shifted away =) */
Severity: Major
Found in src/main/java/com/trilead/ssh2/packets/TypesReader.java and 1 other location - About 1 hr to fix
src/main/java/com/trilead/ssh2/packets/TypesReader.java on lines 117..118

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

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

        long low = ((arr[pos++] & 0xff) << 24) | ((arr[pos++] & 0xff) << 16) | ((arr[pos++] & 0xff) << 8)
                | (arr[pos++] & 0xff); /* sign extension may take place - handle below */
Severity: Major
Found in src/main/java/com/trilead/ssh2/packets/TypesReader.java and 1 other location - About 1 hr to fix
src/main/java/com/trilead/ssh2/packets/TypesReader.java on lines 114..115

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

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

            "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" +
            "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" +
            "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" +
            "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" +
            "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" +
Severity: Major
Found in src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java and 1 other location - About 1 hr to fix
src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java on lines 75..96

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

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

            "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" +
            "29024E088A67CC74020BBEA63B139B22514A08798E3404DD" +
            "EF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245" +
            "E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED" +
            "EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3D" +
Severity: Major
Found in src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java and 1 other location - About 1 hr to fix
src/main/java/com/trilead/ssh2/crypto/dh/DhExchange.java on lines 51..72

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

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 create has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static KeyMaterial create(String hashAlgo, byte[] H, BigInteger K, byte[] SessionID, int keyLengthCS,
            int blockSizeCS, int macLengthCS, int keyLengthSC, int blockSizeSC, int macLengthSC)
Severity: Major
Found in src/main/java/com/trilead/ssh2/crypto/KeyMaterial.java - About 1 hr to fix

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

            public void run()
            {
                while (true)
                {
                    byte[] msg;
    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 readLineRN has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public final static int readLineRN(InputStream is, byte[] buffer) throws IOException
        {
            int pos = 0;
            boolean need10 = false;
            int len = 0;
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/transport/ClientServerHello.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 a Cognitive Complexity of 11 (exceeds 5 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

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

        public void run()
        {
            try
            {
                c.cm.sendOpenConfirmation(c);
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/channel/RemoteAcceptThread.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 write has a Cognitive Complexity of 11 (exceeds 5 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

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

        public static String[] parseTokens(String source, char delimiter)
        {
            if (source.length() == 0)
                return new String[0];
    
    
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/util/Tokenizer.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 addHostkeyToFile has a Cognitive Complexity of 11 (exceeds 5 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

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

        private static byte[] rawFingerPrint(String type, String keyType, byte[] hostkey)
        {
            MessageDigest dig = null;
    
            try {
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/KnownHosts.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 recommendHostkeyAlgorithms has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        private String[] recommendHostkeyAlgorithms(String hostname) {
            List<String> preferredAlgos = new ArrayList<>();
    
            List<PublicKey> keys = getAllKeys(hostname);
    
    
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/KnownHosts.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 11 (exceeds 5 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

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

        public String readOid() throws IOException
        {
            int type = readByte() & 0xff;
    
            if (type != 0x06)
    Severity: Minor
    Found in src/main/java/com/trilead/ssh2/crypto/SimpleDERReader.java - About 1 hr to fix

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

          private SFTPv3FileHandle openFile(String fileName, int flags, SFTPv3FileAttributes attr) 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 readLink has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public String readLink(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 canonicalPath has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public String canonicalPath(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 run has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public void run()
                    {
                        while (true)
                        {
                            byte[] msg;
            Severity: Minor
            Found in src/main/java/com/trilead/ssh2/transport/TransportManager.java - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language