fujaba/NetworkParser

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

Summary

Maintainability
C
1 day
Test Coverage

Method update has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public boolean update(byte[] bytes, int offset, int length) {
        if (bytes == null || bytes.length < offset) {
            return false;
        }
Severity: Minor
Found in src/main/java/de/uniks/networkparser/bytes/SHA1.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 update has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Override
    public boolean update(byte[] bytes, int offset, int length) {
        if (bytes == null || bytes.length < offset) {
            return false;
        }
Severity: Major
Found in src/main/java/de/uniks/networkparser/bytes/SHA1.java - About 3 hrs to fix

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

        private void perform() {
            for (int t = 16; t < 80; t++) {
                int x = w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16];
                w[t] = ((x << 1) | (x >>> 31));
            }
    Severity: Minor
    Found in src/main/java/de/uniks/networkparser/bytes/SHA1.java - About 2 hrs to fix

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

          @Override
          public byte[] getByteArray() {
              byte[] out = new byte[getOrder()];
              int off = 0;
              /* Pad with a '1' and 7-31 zero bits... */
      Severity: Minor
      Found in src/main/java/de/uniks/networkparser/bytes/SHA1.java - About 1 hr to fix

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

            public static CharacterBuffer convertToHex(byte[] data) {
                if (data == null) {
                    return null;
                }
                CharacterBuffer buf = new CharacterBuffer();
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/bytes/SHA1.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 perform has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            private void perform() {
                for (int t = 16; t < 80; t++) {
                    int x = w[t - 3] ^ w[t - 8] ^ w[t - 14] ^ w[t - 16];
                    w[t] = ((x << 1) | (x >>> 31));
                }
        Severity: Minor
        Found in src/main/java/de/uniks/networkparser/bytes/SHA1.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