src/main/java/io/codepace/cozy/TransactionUtility.java

Summary

Maintainability
C
1 day
Test Coverage

Method sortTransactionsBySignatureIndex has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    public static ArrayList<String> sortTransactionsBySignatureIndex(ArrayList<String> transactionsToSort)
    {
        for (int i = 0; i < transactionsToSort.size(); i++)
        {
            if (!isTransactionValid(transactionsToSort.get(i)))
Severity: Minor
Found in src/main/java/io/codepace/cozy/TransactionUtility.java - About 3 hrs 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 sortTransactionsBySignatureIndex has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static ArrayList<String> sortTransactionsBySignatureIndex(ArrayList<String> transactionsToSort)
    {
        for (int i = 0; i < transactionsToSort.size(); i++)
        {
            if (!isTransactionValid(transactionsToSort.get(i)))
Severity: Minor
Found in src/main/java/io/codepace/cozy/TransactionUtility.java - About 1 hr to fix

    Method isTransactionValid has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static boolean isTransactionValid(String transaction)
        {
            System.out.println("Checking transaction: " + transaction);
            MerkleAddressUtility merkleAddressUtility = new MerkleAddressUtility();
            try
    Severity: Minor
    Found in src/main/java/io/codepace/cozy/TransactionUtility.java - About 1 hr to fix

      Method isTransactionValid has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static boolean isTransactionValid(String transaction)
          {
              System.out.println("Checking transaction: " + transaction);
              MerkleAddressUtility merkleAddressUtility = new MerkleAddressUtility();
              try
      Severity: Minor
      Found in src/main/java/io/codepace/cozy/TransactionUtility.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 signTransaction has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public static String signTransaction(String privateKey, String inputAddress, long inputAmount, ArrayList<String> outputAddresses, ArrayList<Long> outputAmounts, long index)
      Severity: Minor
      Found in src/main/java/io/codepace/cozy/TransactionUtility.java - About 45 mins to fix

        Avoid too many return statements within this method.
        Open

                        return false; //Siganture doesn't match
        Severity: Major
        Found in src/main/java/io/codepace/cozy/TransactionUtility.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/TransactionUtility.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/TransactionUtility.java - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status