Showing 164 of 164 total issues

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

    @SuppressWarnings("unused")
    private String SHA256Short(String toHash) //Each hash is shortened to 16 characters based on a 64-character charset. 64^16=79,228,162,514,264,337,593,543,950,336 (Aka more than enough for Lamport)
    {
        try {
            return base64.encodeAsString(md.digest(toHash.getBytes("UTF-8"))).substring(0, 16);
src/main/java/io/codepace/cozy/MerkleAddressUtility.java on lines 493..503
src/main/java/io/codepace/cozy/MerkleAddressUtility.java on lines 554..564
src/main/java/io/codepace/cozy/address/LamportGenThread.java on lines 159..169
src/main/java/io/codepace/cozy/address/MerkleTreeGenLimitless.java on lines 338..345

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

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

    private String SHA256Short(String toHash) //Each hash is shortened to 16 characters based on a 64-character charset. 64^16=79,228,162,514,264,337,593,543,950,336 (Aka more than enough for Lamport)
    {
        try
        {
            return base64.encodeAsString(md.digest(toHash.getBytes("UTF-8"))).substring(0, 16);
Severity: Major
Found in src/main/java/io/codepace/cozy/address/LamportGenThread.java and 4 other locations - About 35 mins to fix
src/main/java/io/codepace/cozy/MerkleAddressUtility.java on lines 493..503
src/main/java/io/codepace/cozy/MerkleAddressUtility.java on lines 554..564
src/main/java/io/codepace/cozy/address/MerkleTreeGenLimitless.java on lines 304..313
src/main/java/io/codepace/cozy/address/MerkleTreeGenLimitless.java on lines 338..345

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

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

                if (transactions.size() == 1 && transactions.get(0).equals(""))
                {
                    //Block has no explicit transactions
                    return true;
                }
Severity: Minor
Found in src/main/java/io/codepace/cozy/db/Block.java and 1 other location - About 35 mins to fix
src/main/java/io/codepace/cozy/db/Block.java on lines 292..301

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

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

    private String SHA256ReturnBase32(String toHash) {
        try {
            return base32.encodeAsString(md.digest(toHash.getBytes("UTF-8"))).substring(0, 32);
        } catch (Exception e) {
            e.printStackTrace();
src/main/java/io/codepace/cozy/MerkleAddressUtility.java on lines 493..503
src/main/java/io/codepace/cozy/MerkleAddressUtility.java on lines 554..564
src/main/java/io/codepace/cozy/address/LamportGenThread.java on lines 159..169
src/main/java/io/codepace/cozy/address/MerkleTreeGenLimitless.java on lines 304..313

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

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

    private String SHA256Short(String toHash) //Each hash is shortened to 16 characters based on a 64-character charset. 64^16=79,228,162,514,264,337,593,543,950,336 (Aka more than enough for Lamport)
    {
        try
        {
            return base64.encodeAsString(md.digest(toHash.getBytes("UTF-8"))).substring(0, 16);
Severity: Major
Found in src/main/java/io/codepace/cozy/MerkleAddressUtility.java and 4 other locations - About 35 mins to fix
src/main/java/io/codepace/cozy/MerkleAddressUtility.java on lines 554..564
src/main/java/io/codepace/cozy/address/LamportGenThread.java on lines 159..169
src/main/java/io/codepace/cozy/address/MerkleTreeGenLimitless.java on lines 304..313
src/main/java/io/codepace/cozy/address/MerkleTreeGenLimitless.java on lines 338..345

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

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

    private String SHA256ReturnBase32(String toHash)
    {
        try
        {
            return base32.encodeAsString(md.digest(toHash.getBytes("UTF-8"))).substring(0, 32);
Severity: Major
Found in src/main/java/io/codepace/cozy/MerkleAddressUtility.java and 4 other locations - About 35 mins to fix
src/main/java/io/codepace/cozy/MerkleAddressUtility.java on lines 493..503
src/main/java/io/codepace/cozy/address/LamportGenThread.java on lines 159..169
src/main/java/io/codepace/cozy/address/MerkleTreeGenLimitless.java on lines 304..313
src/main/java/io/codepace/cozy/address/MerkleTreeGenLimitless.java on lines 338..345

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

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

            for (int i = 0; i < destinationAddresses.size(); i++) {
                if (!merkleAddressUtility.isAddressFormattedCorrectly(destinationAddresses.get(i))) {
                    return false; //A destination address is not a valid address
                }
            }
Severity: Minor
Found in src/main/java/io/codepace/cozy/LedgerManager.java and 1 other location - About 30 mins to fix
src/main/java/io/codepace/cozy/LedgerManager.java on lines 213..217

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

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

                        System.out.println("Got data: " + data.substring(0, 30) + "..." + data.substring(data.length() - 30, data.length()));
Severity: Minor
Found in src/main/java/io/codepace/cozy/Main.java and 1 other location - About 30 mins to fix
src/main/java/io/codepace/cozy/PendingTransactionContainer.java on lines 77..77

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

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

            for (int i = 0; i < destinationAddresses.size(); i++) {
                if (!merkleAddressUtility.isAddressFormattedCorrectly(destinationAddresses.get(i))) {
                    return false; //A destination address is not a valid address
                }
            }
Severity: Minor
Found in src/main/java/io/codepace/cozy/LedgerManager.java and 1 other location - About 30 mins to fix
src/main/java/io/codepace/cozy/LedgerManager.java on lines 150..154

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

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

            System.out.println("Added transaction " + transaction.substring(0, 20) + "..." + transaction.substring(transaction.length() - 20, transaction.length()));
Severity: Minor
Found in src/main/java/io/codepace/cozy/PendingTransactionContainer.java and 1 other location - About 30 mins to fix
src/main/java/io/codepace/cozy/Main.java on lines 111..111

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

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

Avoid too many return statements within this method.
Open

                return false; //This should never happen. But if it does...
Severity: Major
Found in src/main/java/io/codepace/cozy/LedgerManager.java - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                    return false;
    Severity: Major
    Found in src/main/java/io/codepace/cozy/LedgerManager.java - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return true;
      Severity: Major
      Found in src/main/java/io/codepace/cozy/PendingTransactionContainer.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return false;
        Severity: Major
        Found in src/main/java/io/codepace/cozy/db/Blockchain.java - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return true;
          Severity: Major
          Found in src/main/java/io/codepace/cozy/LedgerManager.java - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return false;
            Severity: Major
            Found in src/main/java/io/codepace/cozy/Certificate.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                                  return false; //Block mining signature is not valid
              Severity: Major
              Found in src/main/java/io/codepace/cozy/db/Block.java - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return false;
                Severity: Major
                Found in src/main/java/io/codepace/cozy/MerkleAddressUtility.java - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                          return false; // Address has mined PoS block too recently!
                  Severity: Major
                  Found in src/main/java/io/codepace/cozy/db/Block.java - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return false; //maxNonce must be a positive integer
                    Severity: Major
                    Found in src/main/java/io/codepace/cozy/Certificate.java - About 30 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language