Method unmaskBitMatrix
has a Cognitive Complexity of 80 (exceeds 5 allowed). Consider refactoring. Open
final void unmaskBitMatrix(byte mask, BitMatrix bits, int dimension) {
if (mask == 0) { /* 000: mask bits for which (x + y) mod 2 == 0 */
for (int i = 0; i < dimension; i++) {
for (int j = 0; j < dimension; j++) {
if (((i + j) & 0x01) == 0) {
- 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 readCodewords
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
byte[] readCodewords() {
if (bitMatrix == null) {
return null;
}
FormatInformation formatInfo = readFormatInformation();
- 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 unmaskBitMatrix
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
final void unmaskBitMatrix(byte mask, BitMatrix bits, int dimension) {
if (mask == 0) { /* 000: mask bits for which (x + y) mod 2 == 0 */
for (int i = 0; i < dimension; i++) {
for (int j = 0; j < dimension; j++) {
if (((i + j) & 0x01) == 0) {
Method readVersion
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Version readVersion() {
if (parsedVersion != null || bitMatrix == null) {
return parsedVersion;
}
int dimension = bitMatrix.getHeight();
- 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 readCodewords
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
byte[] readCodewords() {
if (bitMatrix == null) {
return null;
}
FormatInformation formatInfo = readFormatInformation();
Method readVersion
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Version readVersion() {
if (parsedVersion != null || bitMatrix == null) {
return parsedVersion;
}
int dimension = bitMatrix.getHeight();
Method mirror
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
void mirror() {
if (bitMatrix != null) {
for (int x = 0; x < bitMatrix.getWidth(); x++) {
for (int y = x + 1; y < bitMatrix.getHeight(); y++) {
if (bitMatrix.get(x, y) != bitMatrix.get(y, x)) {
- 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
Avoid deeply nested control flow statements. Open
if (bitMatrix.get(j - col, i)) {
currentByte |= 1;
}
Avoid deeply nested control flow statements. Open
if (bitsRead == 8) {
result[resultOffset++] = (byte) currentByte;
bitsRead = 0;
currentByte = 0;
}
Avoid too many return
statements within this method. Open
return null;
Method readFormatInformation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
FormatInformation readFormatInformation() {
if (parsedFormatInfo != null || bitMatrix == null) {
return parsedFormatInfo;
}
- 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"