fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java

Summary

Maintainability
F
1 wk
Test Coverage

File RabbitMessage.java has 766 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.ext.io;

/*
The MIT License

Severity: Major
Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 1 day to fix

    Method analysePayLoad has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
    Open

        public boolean analysePayLoad(NodeProxyBroker broker) {
            if (payload == null || broker == null) {
                return false;
            }
            classId = payload.getShort();
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 6 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

    RabbitMessage has 41 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class RabbitMessage {
        public static final byte NULL = 0;
    
        public static final byte FRAME_METHOD = 1;
        public static final byte FRAME_HEADER = 2;
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 5 hrs to fix

      Method writeValue has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          public boolean writeValue(Object value) {
              if (accumulator == null) {
                  return false;
              }
              if (value == null) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 4 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 writeFieldValue has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          public boolean writeFieldValue(Object value) {
              if (accumulator == null) {
                  return false;
              }
              if (value == null) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.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 writeFieldValue has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public boolean writeFieldValue(Object value) {
              if (accumulator == null) {
                  return false;
              }
              if (value == null) {
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 3 hrs to fix

        Method writeValue has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public boolean writeValue(Object value) {
                if (accumulator == null) {
                    return false;
                }
                if (value == null) {
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 2 hrs to fix

          Method readFieldValue has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              private static Object readFieldValue(ByteBuffer in) {
                  if (in == null) {
                      return null;
                  }
                  byte type = in.getByte();
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.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 readFieldValue has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static Object readFieldValue(ByteBuffer in) {
                  if (in == null) {
                      return null;
                  }
                  byte type = in.getByte();
          Severity: Major
          Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 2 hrs to fix

            Method initValues has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private void initValues(NodeProxyBroker broker) {
                    if (broker == null) {
                        return;
                    }
                    Object[][] data = new Object[][] {
            Severity: Minor
            Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 2 hrs to fix

              Method analysePayLoad has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public boolean analysePayLoad(NodeProxyBroker broker) {
                      if (payload == null || broker == null) {
                          return false;
                      }
                      classId = payload.getShort();
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 1 hr to fix

                Method write has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    public boolean write(OutputStream stream, NetworkParserLog logger) {
                        if (stream == null) {
                            return false;
                        }
                        try {
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.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 withValues has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    public RabbitMessage withValues(Object... args) {
                        if (accumulator == null) {
                            accumulator = new ByteBuffer();
                            if (getType() != 3) {
                                accumulator.insert(new byte[4], true);
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.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 readFrom has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static RabbitMessage readFrom(DataInputStream is, NetworkParserLog logger) {
                        if (is == null) {
                            return null;
                        }
                        byte frameEndMarker = 0;
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 1 hr to fix

                  Method write has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public boolean write(OutputStream stream, NetworkParserLog logger) {
                          if (stream == null) {
                              return false;
                          }
                          try {
                  Severity: Minor
                  Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 1 hr to fix

                    Method createConsume has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public static RabbitMessage createConsume(short channel, String queue, String consumerTag, boolean noLocal,
                                boolean noAck, boolean exclusive, boolean nowait, Map<String, Object> table) {
                    Severity: Major
                    Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                              if (value instanceof Integer || value instanceof Byte || value instanceof Double || value instanceof Float
                                      || value instanceof Long || value instanceof Short || value instanceof Boolean) {
                                  accumulator.insert(value, true);
                                  return true;
                              }
                      Severity: Major
                      Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 1 hr to fix

                        Method initValues has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private void initValues(NodeProxyBroker broker) {
                                if (broker == null) {
                                    return;
                                }
                                Object[][] data = new Object[][] {
                        Severity: Minor
                        Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 55 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

                        Method createQueue has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public static RabbitMessage createQueue(short channel, String queue, boolean durable, boolean exclusive,
                                    boolean autoDelete, Map<String, Object> table) {
                        Severity: Minor
                        Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 45 mins to fix

                          Method writeMap has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public RabbitMessage writeMap(Map<?, ?> map) {
                                  if (accumulator == null) {
                                      return null;
                                  }
                                  if (map == null) {
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 45 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

                          Avoid too many return statements within this method.
                          Open

                                  return false;
                          Severity: Major
                          Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return readTable(in);
                            Severity: Major
                            Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return in.getDouble();
                              Severity: Major
                              Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                            return true;
                                Severity: Major
                                Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return true;
                                  Severity: Major
                                  Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                    Avoid too many return statements within this method.
                                    Open

                                            return false;
                                    Severity: Major
                                    Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                      Avoid too many return statements within this method.
                                      Open

                                                  return readArray(in);
                                      Severity: Major
                                      Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                        Avoid too many return statements within this method.
                                        Open

                                                    return true;
                                        Severity: Major
                                        Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                          Avoid too many return statements within this method.
                                          Open

                                                      return new Date(in.getInt() * 1000);
                                          Severity: Major
                                          Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                            Avoid too many return statements within this method.
                                            Open

                                                        return true;
                                            Severity: Major
                                            Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                              Avoid too many return statements within this method.
                                              Open

                                                          return true;
                                              Severity: Major
                                              Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                Avoid too many return statements within this method.
                                                Open

                                                            return in.getBoolean();
                                                Severity: Major
                                                Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                  Avoid too many return statements within this method.
                                                  Open

                                                              return readBytes(in);
                                                  Severity: Major
                                                  Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                    Avoid too many return statements within this method.
                                                    Open

                                                                return true;
                                                    Severity: Major
                                                    Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                      Avoid too many return statements within this method.
                                                      Open

                                                                  return true;
                                                      Severity: Major
                                                      Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                        Avoid too many return statements within this method.
                                                        Open

                                                                    return in.getInt();
                                                        Severity: Major
                                                        Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                          Avoid too many return statements within this method.
                                                          Open

                                                                  return null;
                                                          Severity: Major
                                                          Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                            Avoid too many return statements within this method.
                                                            Open

                                                                        return in.getShort();
                                                            Severity: Major
                                                            Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                              Avoid too many return statements within this method.
                                                              Open

                                                                          return true;
                                                              Severity: Major
                                                              Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                Avoid too many return statements within this method.
                                                                Open

                                                                            return true;
                                                                Severity: Major
                                                                Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                  Avoid too many return statements within this method.
                                                                  Open

                                                                              return in.getFloat();
                                                                  Severity: Major
                                                                  Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                    Avoid too many return statements within this method.
                                                                    Open

                                                                                return new BigDecimal(new BigInteger(unscaled), scale);
                                                                    Severity: Major
                                                                    Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                      Avoid too many return statements within this method.
                                                                      Open

                                                                                  return in.getByte();
                                                                      Severity: Major
                                                                      Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                        Avoid too many return statements within this method.
                                                                        Open

                                                                                    return true;
                                                                        Severity: Major
                                                                        Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                          Avoid too many return statements within this method.
                                                                          Open

                                                                                      return true;
                                                                          Severity: Major
                                                                          Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                            Avoid too many return statements within this method.
                                                                            Open

                                                                                        return true;
                                                                            Severity: Major
                                                                            Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                              Avoid too many return statements within this method.
                                                                              Open

                                                                                          return null;
                                                                              Severity: Major
                                                                              Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                                Avoid too many return statements within this method.
                                                                                Open

                                                                                            return true;
                                                                                Severity: Major
                                                                                Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

                                                                                  Avoid too many return statements within this method.
                                                                                  Open

                                                                                              return true;
                                                                                  Severity: Major
                                                                                  Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.java - About 30 mins to fix

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

                                                                                        public static RabbitMessage readFrom(DataInputStream is, NetworkParserLog logger) {
                                                                                            if (is == null) {
                                                                                                return null;
                                                                                            }
                                                                                            byte frameEndMarker = 0;
                                                                                    Severity: Minor
                                                                                    Found in src/main/java/de/uniks/networkparser/ext/io/RabbitMessage.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