fujaba/NetworkParser

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

Summary

Maintainability
D
2 days
Test Coverage

File AES.java has 300 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package de.uniks.networkparser.bytes;

import de.uniks.networkparser.buffer.BufferedBuffer;
import de.uniks.networkparser.buffer.ByteBuffer;
import de.uniks.networkparser.buffer.CharacterBuffer;
Severity: Minor
Found in src/main/java/de/uniks/networkparser/bytes/AES.java - About 3 hrs to fix

    Method withKey has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        public AES withKey(byte[] key) {
            /* assorted internal constants */
            if (key == null) {
                return this;
            }
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/bytes/AES.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 withKey has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public AES withKey(byte[] key) {
            /* assorted internal constants */
            if (key == null) {
                return this;
            }
    Severity: Major
    Found in src/main/java/de/uniks/networkparser/bytes/AES.java - About 2 hrs to fix

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

          public byte[] encodeBlock(byte[] plain) {
              /* check for bad arguments */
              if (plain == null || plain.length != BLOCK_SIZE) {
                  return null;
              }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/bytes/AES.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 decodeBlock has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public byte[] decodeBlock(byte[] cipher) {
              /* check for bad arguments */
              if (cipher == null || cipher.length != BLOCK_SIZE)
                  return null;
      
      
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/bytes/AES.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 encodeBlock has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public byte[] encodeBlock(byte[] plain) {
              /* check for bad arguments */
              if (plain == null || plain.length != BLOCK_SIZE) {
                  return null;
              }
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/bytes/AES.java - About 1 hr to fix

        Method decodeBlock has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public byte[] decodeBlock(byte[] cipher) {
                /* check for bad arguments */
                if (cipher == null || cipher.length != BLOCK_SIZE)
                    return null;
        
        
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/bytes/AES.java - About 1 hr to fix

          Method encode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              public CharacterBuffer encode(BufferedBuffer plain) {
                  CharacterBuffer result = new CharacterBuffer();
                  if (plain != null) {
                      result.withBufferLength(plain.length());
                      byte[] partByte;
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/bytes/AES.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 decode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public CharacterBuffer decode(CharSequence data) {
                  CharacterBuffer string = new CharacterBuffer().with(data);
                  int rest = ((int) string.length() / 32) * 32;
                  if (rest < string.length()) {
                      rest = 32 - data.length() + rest;
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/bytes/AES.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 encode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public CharacterBuffer encode(String data) {
                  CharacterBuffer string = new CharacterBuffer().with(data);
                  int rest = ((int) string.length() / 32) * 32;
                  if (rest < string.length()) {
                      rest = 32 - data.length() + rest;
          Severity: Minor
          Found in src/main/java/de/uniks/networkparser/bytes/AES.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

          There are no issues that match your filters.

          Category
          Status