fujaba/NetworkParser

View on GitHub
src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java

Summary

Maintainability
F
1 wk
Test Coverage

File CharacterBuffer.java has 1175 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.buffer;

import java.util.List;
/*
 * NetworkParser The MIT License Copyright (c) 2010-2016 Stefan Lindel
Severity: Major
Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 3 days to fix

    CharacterBuffer has 70 methods (exceeds 20 allowed). Consider refactoring.
    Open

    public class CharacterBuffer extends BufferedBuffer implements CharSequence, BaseItem {
      /** The value is used for character storage. */
      char[] buffer;
    
      /**
    Severity: Major
    Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 1 day to fix

      Method replace has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
      Open

        public boolean replace(String search, String replace) {
          if (search == null || search.length() < 1) {
            return false;
          }
          int deleted = 0;
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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

      Method equalsLevenshtein has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

        public double equalsLevenshtein(CharacterBuffer t) {
          if (t == null || t.length() < 1) {
            return this.length();
          }
          if (this.length() < 1) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 5 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 withObjects has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

        public CharacterBuffer withObjects(Object... items) {
          if (items == null) {
            return this;
          }
          if (this.buffer == null) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 replace has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

        public boolean replace(int start, int end, String replace) {
          int pos = 0;
          if (replace == null || buffer == null || start > end || start > buffer.length) {
            return false;
          }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 rtrim has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        public CharacterBuffer rtrim(char... items) {
          validateValue();
          if (items != null) {
            int z;
            while (length > 0) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 with has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

        public CharacterBuffer with(CharSequence values, int start, int end) {
          if (values == null || (buffer != null && start > buffer.length)) {
            return this;
          }
          if (this.buffer == null) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 with has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        public CharacterBuffer with(CharSequence... items) {
          if (items == null) {
            return this;
          }
          if (this.buffer == null) {
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 replace has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public boolean replace(String search, String replace) {
          if (search == null || search.length() < 1) {
            return false;
          }
          int deleted = 0;
      Severity: Major
      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 2 hrs to fix

        Method withStart has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          public CharacterBuffer withStart(CharSequence item, boolean newLine) {
            if (item == null || start < 0) {
              return this;
            }
            int len = item.length();
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 equalsLevenshtein has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public double equalsLevenshtein(CharacterBuffer t) {
            if (t == null || t.length() < 1) {
              return this.length();
            }
            if (this.length() < 1) {
        Severity: Major
        Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 2 hrs to fix

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

            public boolean replace(int start, int end, String replace) {
              int pos = 0;
              if (replace == null || buffer == null || start > end || start > buffer.length) {
                return false;
              }
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 2 hrs to fix

            Method equalsText has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              public boolean equalsText(char... other) {
                if (other == null) {
                  return true;
                }
                if (start > length || start < 0 || buffer == null) {
            Severity: Minor
            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 withObjects has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public CharacterBuffer withObjects(Object... items) {
                if (items == null) {
                  return this;
                }
                if (this.buffer == null) {
            Severity: Minor
            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 1 hr to fix

              Method startsWith has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                public boolean startsWith(CharSequence prefix, int toffset, boolean ignoreCase) {
                  if (buffer == null) {
                    return false;
                  }
                  char ta[] = buffer;
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 replace has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                public void replace(char search, char replace) {
                  int len = this.length + start;
                  int pos = position + start;
                  if (replace > 0) {
                    while (pos < len) {
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 withStart has 39 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public CharacterBuffer withStart(CharSequence item, boolean newLine) {
                  if (item == null || start < 0) {
                    return this;
                  }
                  int len = item.length();
              Severity: Minor
              Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 1 hr to fix

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

                  public String getStringPart(Character start, Character end) {
                    if (start == null || end == null) {
                      return null;
                    }
                    int count = 1;
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 withRepeat has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  public boolean withRepeat(String string, int rest) {
                    if (string == null) {
                      return false;
                    }
                    int newCapacity = this.length() + rest * string.length();
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 with has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public CharacterBuffer with(CharSequence values, int start, int end) {
                    if (values == null || (buffer != null && start > buffer.length)) {
                      return this;
                    }
                    if (this.buffer == null) {
                Severity: Minor
                Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 1 hr to fix

                  Method equalsText has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public boolean equalsText(char... other) {
                      if (other == null) {
                        return true;
                      }
                      if (start > length || start < 0 || buffer == null) {
                  Severity: Minor
                  Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 1 hr to fix

                    Method with has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public CharacterBuffer with(CharSequence... items) {
                        if (items == null) {
                          return this;
                        }
                        if (this.buffer == null) {
                    Severity: Minor
                    Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 1 hr to fix

                      Method indexOf has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                        public int indexOf(CharSequence str, int fromIndex) {
                          final int max = length();
                          if (fromIndex < 0) {
                            fromIndex = 0;
                          } else if (fromIndex >= length) {
                      Severity: Minor
                      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 getLine has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        public CharacterBuffer getLine(int pos) {
                          CharacterBuffer buffer = new CharacterBuffer();
                          if (pos > 0 && pos < length()) {
                            int start = pos;
                            while (this.buffer[start] != '\r' && this.buffer[start] != '\n' && start > 0) {
                      Severity: Minor
                      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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 rtrim has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        public CharacterBuffer rtrim(char... items) {
                          validateValue();
                          if (items != null) {
                            int z;
                            while (length > 0) {
                      Severity: Minor
                      Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 1 hr to fix

                        Method getStringPart has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          public String getStringPart(Character start, Character end) {
                            if (start == null || end == null) {
                              return null;
                            }
                            int count = 1;
                        Severity: Minor
                        Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 1 hr to fix

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

                            public CharacterBuffer trim() {
                              if (buffer == null) {
                                return this;
                              }
                              if (length > buffer.length) {
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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

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

                            public CharacterBuffer with(char src) {
                              if (this.buffer == null) {
                                this.buffer = new char[5];
                                start = 0;
                                length = 1;
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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

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

                            public CharacterBuffer write(byte[] values, int length) {
                              if (values == null) {
                                return this;
                              }
                              if (this.length < 0) {
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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

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

                            public CharacterBuffer with(byte[] values, int start, int length) {
                              int newLen = length + this.length;
                              if (buffer == null || newLen + this.start > buffer.length) {
                                char[] oldValue = this.buffer;
                                this.buffer = new char[(newLen * 2 + 2)];
                          Severity: Minor
                          Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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

                          Consider simplifying this complex logical expression.
                          Open

                              if (pos > 0 && pos < length()) {
                                int start = pos;
                                while (this.buffer[start] != '\r' && this.buffer[start] != '\n' && start > 0) {
                                  start--;
                                }
                          Severity: Major
                          Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 40 mins to fix

                            Method with has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              public CharacterBuffer with(char[] values, int start, int end, boolean copy) {
                                if (copy) {
                                  if (values != null) {
                                    if (start > values.length) {
                                      return this;
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 35 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 isEmptyCharacter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              public boolean isEmptyCharacter() {
                                if (super.isEmpty() || start > length || start < 0) {
                                  return true;
                                }
                                if (length > buffer.length) {
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 35 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 addValues has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              public boolean addValues(char sep, String... values) {
                                if (values == null) {
                                  return false;
                                }
                                int size = this.size();
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 35 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 splitStrings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              public SimpleList<String> splitStrings(char split) {
                            
                                SimpleList<String> result = new SimpleList<String>();
                                if (buffer == null) {
                                  return result;
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 35 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 remove has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              public char remove(int position) {
                                if (position < 0 || this.buffer == null || position > this.buffer.length) {
                                  return 0;
                                }
                                char oldChar = this.buffer[position];
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 35 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 withCollection has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              public CharacterBuffer withCollection(String splitter, Object... values) {
                                if (values == null) {
                                  return this;
                                }
                                int len = values.length;
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 35 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 with has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                              public CharacterBuffer with(char[] values, int start, int length) {
                                if (values == null || start + length > values.length) {
                                  return this;
                                }
                                if (this.length < 0) {
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.java - About 35 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 validateValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              private boolean validateValue() {
                                if (buffer == null) {
                                  this.start = 0;
                                  this.length = 0;
                                  return true;
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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

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

                              public boolean add(Object... values) {
                                if (values == null) {
                                  return true;
                                }
                                boolean addValues = true;
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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

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

                              public CharacterBuffer withStart(char item) {
                                if (start > 0) {
                                  if (start > this.buffer.length) {
                                    start = this.buffer.length - 1;
                                  }
                            Severity: Minor
                            Found in src/main/java/de/uniks/networkparser/buffer/CharacterBuffer.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

                            Avoid using a branching statement as the last in a loop.
                            Open

                                  return false;

                            AvoidBranchingStatementAsLastInLoop

                            Since: PMD 5.0

                            Priority: Medium High

                            Categories: Style

                            Remediation Points: 50000

                            Using a branching statement as the last part of a loop may be a bug, and/or is confusing. Ensure that the usage is not a bug, or consider using another approach.

                            Example:

                            // unusual use of branching statement in a loop
                            for (int i = 0; i < 10; i++) {
                             if (i*i <= 25) {
                             continue;
                             }
                             break;
                            }
                            
                            // this makes more sense...
                            for (int i = 0; i < 10; i++) {
                             if (i*i > 25) {
                             break;
                             }
                            }

                            These nested if statements could be combined
                            Open

                                      if (Character.toLowerCase(c1) == Character.toLowerCase(c2)) {
                                        continue;
                                      }

                            CollapsibleIfStatements

                            Since: PMD 3.1

                            Priority: Medium

                            Categories: Style

                            Remediation Points: 50000

                            Sometimes two consecutive 'if' statements can be consolidated by separating their conditions with a boolean short-circuit operator.

                            Example:

                            void bar() {
                             if (x) { // original implementation
                             if (y) {
                             // do stuff
                             }
                             }
                            }
                            
                            void bar() {
                             if (x && y) { // optimized implementation
                             // do stuff
                             }
                            }

                            There are no issues that match your filters.

                            Category
                            Status