fh1ch/node-bacstack

View on GitHub

Showing 217 of 365 total issues

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 decode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                              Open

                              module.exports.decode = (buffer, offset, apduLen) => {
                                let len = 0;
                                const value = {};
                                let result;
                                let decodedValue;
                              Severity: Minor
                              Found in lib/services/alarm-acknowledge.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 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

                              Severity
                              Category
                              Status
                              Source
                              Language