fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/bytes/ByteEntity.java

Summary

Maintainability
D
2 days
Test Coverage

File ByteEntity.java has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.bytes;

/*
NetworkParser
The MIT License
Severity: Minor
Found in src/main/java/de/uniks/networkparser/bytes/ByteEntity.java - About 2 hrs to fix

    ByteEntity has 23 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class ByteEntity implements ByteItem {
        /** The Constant BIT OF A BYTE. */
        public static final int BITOFBYTE = 8;
        public static final int TYPEBYTE = 1;
    
    
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/bytes/ByteEntity.java - About 2 hrs to fix

      Method setValues has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public boolean setValues(Object value) {
              byte type = 0;
              ByteBuffer msgValue = new ByteBuffer();
              if (value == null) {
                  type = ByteTokener.DATATYPE_NULL;
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/bytes/ByteEntity.java - About 2 hrs to fix

        Method writeBytes has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public void writeBytes(ByteBuffer buffer, boolean isDynamic, boolean isLast, boolean isPrimitive) {
                byte[] value = this.values;
        
                byte type = getType();
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/bytes/ByteEntity.java - About 2 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 setValues has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            public boolean setValues(Object value) {
                byte type = 0;
                ByteBuffer msgValue = new ByteBuffer();
                if (value == null) {
                    type = ByteTokener.DATATYPE_NULL;
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/bytes/ByteEntity.java - About 2 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 calcLength has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            @Override
            public int calcLength(boolean isDynamic, boolean isLast) {
                /* Length calculate Sonderfaelle ermitteln */
                if (this.values == null) {
                    return TYPEBYTE;
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/bytes/ByteEntity.java - About 2 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 writeBytes has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            @Override
            public void writeBytes(ByteBuffer buffer, boolean isDynamic, boolean isLast, boolean isPrimitive) {
                byte[] value = this.values;
        
                byte type = getType();
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/bytes/ByteEntity.java - About 1 hr to fix

          Avoid too many return statements within this method.
          Open

                  return TYPEBYTE + EntityUtil.getTypeLen(type, values.length, isLast) + this.values.length;
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/bytes/ByteEntity.java - About 30 mins to fix

            Method toBinaryString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public String toBinaryString() {
                    if (values == null || values.length < 1) {
                        return "";
                    }
                    byte[] result = new byte[values.length * 9 + 9];
            Severity: Minor
            Found in src/main/java/de/uniks/networkparser/bytes/ByteEntity.java - About 25 mins 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

            There are no issues that match your filters.

            Category
            Status