fh1ch/node-bacstack

View on GitHub
lib/asn1.js

Summary

Maintainability
F
2 wks
Test Coverage

File asn1.js has 1528 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const iconv = require('iconv-lite');
const baEnum = require('./enum');

Severity: Major
Found in lib/asn1.js - About 4 days to fix

    Function bacappDecodeContextApplicationData has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
    Open

    const bacappDecodeContextApplicationData = (buffer, offset, maxOffset, objectType, propertyId) => {
      let len = 0;
      let result;
      if (isContextSpecific(buffer[offset])) {
        if (propertyId === baEnum.PropertyIdentifier.LIST_OF_GROUP_MEMBERS) {
    Severity: Minor
    Found in lib/asn1.js - About 1 day 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

    Function decodeReadAccessResult has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    const decodeReadAccessResult = module.exports.decodeReadAccessResult = (buffer, offset, apduLen) => {
      let len = 0;
      const value = {};
      if (!decodeIsContextTag(buffer, offset + len, 0)) return;
      len++;
    Severity: Minor
    Found in lib/asn1.js - 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

    Function bacappDecodeContextApplicationData has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const bacappDecodeContextApplicationData = (buffer, offset, maxOffset, objectType, propertyId) => {
      let len = 0;
      let result;
      if (isContextSpecific(buffer[offset])) {
        if (propertyId === baEnum.PropertyIdentifier.LIST_OF_GROUP_MEMBERS) {
    Severity: Major
    Found in lib/asn1.js - About 5 hrs to fix

      Function bacappContextTagType has 117 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const bacappContextTagType = (property, tagNumber) => {
        let tag = 0;
        switch (property) {
          case baEnum.PropertyIdentifier.ACTUAL_SHED_LEVEL:
          case baEnum.PropertyIdentifier.REQUESTED_SHED_LEVEL:
      Severity: Major
      Found in lib/asn1.js - About 4 hrs to fix

        Function decodeReadAccessResult has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const decodeReadAccessResult = module.exports.decodeReadAccessResult = (buffer, offset, apduLen) => {
          let len = 0;
          const value = {};
          if (!decodeIsContextTag(buffer, offset + len, 0)) return;
          len++;
        Severity: Major
        Found in lib/asn1.js - About 3 hrs to fix

          Function decodeCovSubscription has 87 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const decodeCovSubscription = (buffer, offset, apduLen) => {
            let len = 0;
            const value = {};
            let result;
            let decodedValue;
          Severity: Major
          Found in lib/asn1.js - About 3 hrs to fix

            Function decodeCovSubscription has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

            const decodeCovSubscription = (buffer, offset, apduLen) => {
              let len = 0;
              const value = {};
              let result;
              let decodedValue;
            Severity: Minor
            Found in lib/asn1.js - 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

            Function bacappDecodeData has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const bacappDecodeData = (buffer, offset, maxLength, tagDataType, lenValueType) => {
              let result;
              const value = {
                len: 0,
                type: tagDataType
            Severity: Major
            Found in lib/asn1.js - About 2 hrs to fix

              Function decodeReadAccessSpecification has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
              Open

              const decodeReadAccessSpecification = module.exports.decodeReadAccessSpecification = (buffer, offset, apduLen) => {
                let len = 0;
                const value = {};
                if (!decodeIsContextTag(buffer, offset + len, 0)) return;
                len++;
              Severity: Minor
              Found in lib/asn1.js - 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

              Function bacappEncodeApplicationData has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const bacappEncodeApplicationData = module.exports.bacappEncodeApplicationData = (buffer, value) => {
                if (value.value === null) {
                  value.type = baEnum.ApplicationTags.NULL;
                }
                switch (value.type) {
              Severity: Major
              Found in lib/asn1.js - About 2 hrs to fix

                Function bacappContextTagType has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                const bacappContextTagType = (property, tagNumber) => {
                  let tag = 0;
                  switch (property) {
                    case baEnum.PropertyIdentifier.ACTUAL_SHED_LEVEL:
                    case baEnum.PropertyIdentifier.REQUESTED_SHED_LEVEL:
                Severity: Minor
                Found in lib/asn1.js - 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

                Function bacappEncodePropertyState has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports.bacappEncodePropertyState = (buffer, value) => {
                  switch (value.type) {
                    case baEnum.PropertyStates.BOOLEAN_VALUE:
                      encodeContextBoolean(buffer, 0, value.state === 1 ? true : false);
                      break;
                Severity: Minor
                Found in lib/asn1.js - About 1 hr to fix

                  Function decodeReadAccessSpecification has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  const decodeReadAccessSpecification = module.exports.decodeReadAccessSpecification = (buffer, offset, apduLen) => {
                    let len = 0;
                    const value = {};
                    if (!decodeIsContextTag(buffer, offset + len, 0)) return;
                    len++;
                  Severity: Minor
                  Found in lib/asn1.js - About 1 hr to fix

                    Function encodeTag has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    const encodeTag = module.exports.encodeTag = (buffer, tagNumber, contextSpecific, lenValueType) => {
                      let len = 1;
                      const tmp = new Array(3);
                      tmp[0] = 0;
                      if (contextSpecific) {
                    Severity: Minor
                    Found in lib/asn1.js - About 1 hr to fix

                      Function decodeDeviceObjPropertyRef has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const decodeDeviceObjPropertyRef = (buffer, offset) => {
                        let len = 0;
                        let arrayIndex = baEnum.ASN1_ARRAY_ALL;
                        if (!decodeIsContextTag(buffer, offset + len, 0)) return;
                        len++;
                      Severity: Minor
                      Found in lib/asn1.js - About 1 hr to fix

                        Function decodeTagNumberAndValue has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const decodeTagNumberAndValue = module.exports.decodeTagNumberAndValue = (buffer, offset) => {
                          let value;
                          let result = decodeTagNumber(buffer, offset);
                          let len = result.len;
                          if (isExtendedValue(buffer[offset])) {
                        Severity: Minor
                        Found in lib/asn1.js - About 1 hr to fix

                          Function decodeCalendar has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const decodeCalendar = (buffer, offset, apduLen) => {
                            let len = 0;
                            const entries = [];
                            let decodedValue;
                            while (len < apduLen) {
                          Severity: Minor
                          Found in lib/asn1.js - About 1 hr to fix

                            Function bacappDecodeApplicationData has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                            Open

                            const bacappDecodeApplicationData = module.exports.bacappDecodeApplicationData = (buffer, offset, maxOffset, objectType, propertyId) => {
                              if (!isContextSpecific(buffer[offset])) {
                                let result = decodeTagNumberAndValue(buffer, offset);
                                if (result) {
                                  const len = result.len;
                            Severity: Minor
                            Found in lib/asn1.js - 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

                            Function byteReverseBits has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const byteReverseBits = (inByte) => {
                              let outByte = 0;
                              if ((inByte & 1) > 0) {
                                outByte |= 0x80;
                              }
                            Severity: Minor
                            Found in lib/asn1.js - About 1 hr to fix

                              Function encodeTag has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const encodeTag = module.exports.encodeTag = (buffer, tagNumber, contextSpecific, lenValueType) => {
                                let len = 1;
                                const tmp = new Array(3);
                                tmp[0] = 0;
                                if (contextSpecific) {
                              Severity: Minor
                              Found in lib/asn1.js - 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

                              Function decodeTagNumberAndValue has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const decodeTagNumberAndValue = module.exports.decodeTagNumberAndValue = (buffer, offset) => {
                                let value;
                                let result = decodeTagNumber(buffer, offset);
                                let len = result.len;
                                if (isExtendedValue(buffer[offset])) {
                              Severity: Minor
                              Found in lib/asn1.js - 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 deeply nested control flow statements.
                              Open

                                  } else if (propertyId === baEnum.PropertyIdentifier.LIST_OF_OBJECT_PROPERTY_REFERENCES || propertyId === baEnum.PropertyIdentifier.LOG_DEVICE_OBJECT_PROPERTY || propertyId === baEnum.PropertyIdentifier.OBJECT_PROPERTY_REFERENCE) {
                                    result = decodeDeviceObjPropertyRef(buffer, offset, maxOffset);
                                    if (!result) return;
                                    return {
                                      type: baEnum.ApplicationTags.OBJECT_PROPERTY_REFERENCE,
                              Severity: Major
                              Found in lib/asn1.js - About 45 mins to fix

                                Function byteReverseBits has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const byteReverseBits = (inByte) => {
                                  let outByte = 0;
                                  if ((inByte & 1) > 0) {
                                    outByte |= 0x80;
                                  }
                                Severity: Minor
                                Found in lib/asn1.js - 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 deeply nested control flow statements.
                                Open

                                      if (!result) return;
                                Severity: Major
                                Found in lib/asn1.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                            if (bacappResult.encoding !== undefined) resObj.encoding = bacappResult.encoding;
                                  Severity: Major
                                  Found in lib/asn1.js - About 45 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                      return {
                                        len: len,
                                        value: value
                                      };
                                    Severity: Major
                                    Found in lib/asn1.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                            if (!result) return;
                                      Severity: Major
                                      Found in lib/asn1.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                              if (!result) return;
                                        Severity: Major
                                        Found in lib/asn1.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                if (!subResult) return;
                                          Severity: Major
                                          Found in lib/asn1.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                              if (!decodeIsClosingTagNumber(buffer, offset + len, 0)) return;
                                            Severity: Major
                                            Found in lib/asn1.js - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                    return {
                                                      type: baEnum.ApplicationTags.CONTEXT_SPECIFIC_DECODED,
                                                      value: result.value,
                                                      len: result.len
                                                    };
                                              Severity: Major
                                              Found in lib/asn1.js - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

                                                        if (!bacappResult) return;
                                                Severity: Major
                                                Found in lib/asn1.js - About 30 mins to fix

                                                  Avoid too many return statements within this function.
                                                  Open

                                                    if (!decodeIsClosingTagNumber(buffer, offset + len, 0)) return;
                                                  Severity: Major
                                                  Found in lib/asn1.js - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                      if (result.tagNumber !== 1) return;
                                                    Severity: Major
                                                    Found in lib/asn1.js - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return {
                                                                type: baEnum.ApplicationTags.TIMESTAMP,
                                                                value: subEvtResult.value,
                                                                len: subEvtResult.len + 1
                                                              };
                                                      Severity: Major
                                                      Found in lib/asn1.js - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                            if ((len + offset) > maxOffset) return;
                                                        Severity: Major
                                                        Found in lib/asn1.js - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                              return;
                                                          Severity: Major
                                                          Found in lib/asn1.js - About 30 mins to fix

                                                            Avoid too many return statements within this function.
                                                            Open

                                                              if (result.tagNumber !== baEnum.ApplicationTags.OCTET_STRING) return;
                                                            Severity: Major
                                                            Found in lib/asn1.js - About 30 mins to fix

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                return {
                                                                  len: len,
                                                                  value: value
                                                                };
                                                              Severity: Major
                                                              Found in lib/asn1.js - About 30 mins to fix

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                        if ((len + tmp.value) >= apduLen) return;
                                                                Severity: Major
                                                                Found in lib/asn1.js - About 30 mins to fix

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                    if (!decodeIsClosingTagNumber(buffer, offset + len, 1)) return;
                                                                  Severity: Major
                                                                  Found in lib/asn1.js - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                      if (result.tagNumber !== 0) return;
                                                                    Severity: Major
                                                                    Found in lib/asn1.js - About 30 mins to fix

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return {
                                                                                type: baEnum.ApplicationTags.UNSIGNED_INTEGER,
                                                                                value: subEvtResult.value,
                                                                                len: subEvtResult.len + 1
                                                                              };
                                                                      Severity: Major
                                                                      Found in lib/asn1.js - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                          if (!decodeIsClosingTagNumber(buffer, offset + len, 1)) return;
                                                                        Severity: Major
                                                                        Found in lib/asn1.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                            if (result.tagNumber !== 1) return;
                                                                          Severity: Major
                                                                          Found in lib/asn1.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                if (result.tagNumber !== 4) return;
                                                                            Severity: Major
                                                                            Found in lib/asn1.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      return {
                                                                                        len: len,
                                                                                        value: list[0],
                                                                                        type: baEnum.ApplicationTags.CONTEXT_SPECIFIC_DECODED
                                                                                      };
                                                                              Severity: Major
                                                                              Found in lib/asn1.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                      if (!decodeIsClosingTagNumber(buffer, offset + len, 4)) return;
                                                                                Severity: Major
                                                                                Found in lib/asn1.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                          if (!result) return;
                                                                                  Severity: Major
                                                                                  Found in lib/asn1.js - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                          if (!decodeIsClosingTagNumber(buffer, offset + len, 5)) return;
                                                                                    Severity: Major
                                                                                    Found in lib/asn1.js - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                        if (!decodeIsOpeningTagNumber(buffer, offset + len, 1)) return;
                                                                                      Severity: Major
                                                                                      Found in lib/asn1.js - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                            if ((len + result.value) >= apduLen) return;
                                                                                        Severity: Major
                                                                                        Found in lib/asn1.js - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                  return {
                                                                                                    type: baEnum.ApplicationTags.TIMESTAMP,
                                                                                                    value: subEvtResult.value,
                                                                                                    len: subEvtResult.len + 2
                                                                                                  };
                                                                                          Severity: Major
                                                                                          Found in lib/asn1.js - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                              if (result.tagNumber !== 2) return;
                                                                                            Severity: Major
                                                                                            Found in lib/asn1.js - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                return {
                                                                                                  len: len,
                                                                                                  value: value
                                                                                                };
                                                                                              Severity: Major
                                                                                              Found in lib/asn1.js - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                      return {
                                                                                                        type: baEnum.ApplicationTags.READ_ACCESS_RESULT,
                                                                                                        value: result.value,
                                                                                                        len: result.len
                                                                                                      };
                                                                                                Severity: Major
                                                                                                Found in lib/asn1.js - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                    if (!decodeIsClosingTagNumber(buffer, offset + len, 1)) return;
                                                                                                  Severity: Major
                                                                                                  Found in lib/asn1.js - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                        return {
                                                                                                          len: len,
                                                                                                          value: list,
                                                                                                          type: baEnum.ApplicationTags.CONTEXT_SPECIFIC_DECODED
                                                                                                        };
                                                                                                    Severity: Major
                                                                                                    Found in lib/asn1.js - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

                                                                                                              return;
                                                                                                      Severity: Major
                                                                                                      Found in lib/asn1.js - About 30 mins to fix

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                          if (result.tagNumber !== 3) return;
                                                                                                        Severity: Major
                                                                                                        Found in lib/asn1.js - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

                                                                                                                if (!result) return;
                                                                                                          Severity: Major
                                                                                                          Found in lib/asn1.js - About 30 mins to fix

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

                                                                                                                  return {
                                                                                                                    type: baEnum.ApplicationTags.OBJECT_PROPERTY_REFERENCE,
                                                                                                                    value: result.value,
                                                                                                                    len: result.len
                                                                                                                  };
                                                                                                            Severity: Major
                                                                                                            Found in lib/asn1.js - About 30 mins to fix

                                                                                                              Function decodeBitstring has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                              Open

                                                                                                              const decodeBitstring = module.exports.decodeBitstring = (buffer, offset, lenValue) => {
                                                                                                                let len = 0;
                                                                                                                const bitString = {};
                                                                                                                bitString.value = [];
                                                                                                                if (lenValue > 0) {
                                                                                                              Severity: Minor
                                                                                                              Found in lib/asn1.js - 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

                                                                                                              Function decodeDeviceObjPropertyRef has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                                                              Open

                                                                                                              const decodeDeviceObjPropertyRef = (buffer, offset) => {
                                                                                                                let len = 0;
                                                                                                                let arrayIndex = baEnum.ASN1_ARRAY_ALL;
                                                                                                                if (!decodeIsContextTag(buffer, offset + len, 0)) return;
                                                                                                                len++;
                                                                                                              Severity: Minor
                                                                                                              Found in lib/asn1.js - 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

                                                                                                              HACK found
                                                                                                              Open

                                                                                                                        // HACK: Drop string specific handling ASAP
                                                                                                              Severity: Minor
                                                                                                              Found in lib/asn1.js by fixme

                                                                                                              HACK found
                                                                                                              Open

                                                                                                                    return 'utf8'; // HACK: There is currently no support for UTF-32
                                                                                                              Severity: Minor
                                                                                                              Found in lib/asn1.js by fixme

                                                                                                              HACK found
                                                                                                              Open

                                                                                                                    // HACK: Drop string specific handling ASAP
                                                                                                              Severity: Minor
                                                                                                              Found in lib/asn1.js by fixme

                                                                                                              HACK found
                                                                                                              Open

                                                                                                                      // HACK: Drop string specific handling ASAP
                                                                                                              Severity: Minor
                                                                                                              Found in lib/asn1.js by fixme

                                                                                                              Parsing error: Invalid ecmaVersion.
                                                                                                              Open

                                                                                                              'use strict';
                                                                                                              Severity: Minor
                                                                                                              Found in lib/asn1.js by eslint

                                                                                                              For more information visit Source: http://eslint.org/docs/rules/

                                                                                                              There are no issues that match your filters.

                                                                                                              Category
                                                                                                              Status