Showing 164 of 164 total issues
Method validateCertificate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public boolean validateCertificate() {
String authorityAddress = "";
if (authorities.containsKey(authorityName)) {
authorityAddress = authorities.get(authorityName);
} else {
- Read upRead up
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 getAllTransactionsInvolvingAddress
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public ArrayList<String> getAllTransactionsInvolvingAddress(String addressToFind) {
int longestChainLength = 0;
int longestChainNum = -1;
for (int i = 0; i < chains.size(); i++) {
if (chains.get(i).size() > longestChainLength) {
- Read upRead up
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 6 (exceeds 5 allowed). Consider refactoring. Open
public void write(String data) {
if (data.length() > 20) {
System.out.println("PUTTING INTO WRITE BUFFER: " + data.substring(0, 20) + "...");
} else {
System.out.println("PUTTING INTO WRITE BUFFER: " + data);
- Read upRead up
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 compileBlock
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public static String compileBlock(long timestamp, int blockNum, String previousBlockHash, long difficulty, int winningNonce, String ledgerHash, ArrayList<String> transactions, Certificate certificate, String signingAddress, String privateKey, long minerSignatureIndex) {
System.out.println("Creating block...");
System.out.println("timestamp: " + timestamp);
System.out.println("blockNum: " + blockNum);
System.out.println("previousBlockHash: " + previousBlockHash);
- Read upRead up
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"