fh1ch/node-bacstack

View on GitHub

Showing 217 of 365 total issues

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

module.exports.encode = (buffer, acknowledgmentFilter, enrollmentFilter, eventStateFilter, eventTypeFilter, priorityFilter, notificationClassFilter) => {
  baAsn1.encodeContextEnumerated(buffer, 0, acknowledgmentFilter);
  if (enrollmentFilter) {
    baAsn1.encodeOpeningTag(buffer, 1);
    baAsn1.encodeOpeningTag(buffer, 0);
Severity: Minor
Found in lib/services/get-enrollment-summary.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 encode has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports.encode = (buffer, objectId, propertyId, arrayIndex, requestType, position, time, count) => {
          baAsn1.encodeContextObjectId(buffer, 0, objectId.type, objectId.instance);
          baAsn1.encodeContextEnumerated(buffer, 1, propertyId);
          if (arrayIndex !== baEnum.ASN1_ARRAY_ALL) {
            baAsn1.encodeContextUnsigned(buffer, 2, arrayIndex);
        Severity: Minor
        Found in lib/services/read-range.js - About 1 hr to fix

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

          module.exports.decodeAcknowledge = (buffer, offset) => {
            let len = 0;
            let result;
            let decodedValue;
            let isStream;
          Severity: Minor
          Found in lib/services/atomic-read-file.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 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 decode has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports.decode = (buffer, offset, apduLen) => {
            let len = 0;
            const value = {};
            let decodedValue;
            let result;
          Severity: Minor
          Found in lib/services/device-communication-control.js - About 1 hr to fix

            Function decode has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports.decode = (buffer, offset, apduLen) => {
              let len = 0;
              let result;
              let decodedValue;
              const alarms = [];
            Severity: Minor
            Found in lib/services/alarm-summary.js - About 1 hr to fix

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

              module.exports.decode = (buffer, offset, apduLen) => {
                let len = 0;
                let result;
                let decodedValue;
                const value = {};
              Severity: Minor
              Found in lib/services/private-transfer.js - About 1 hr to fix

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

                module.exports.decode = (buffer, offset, apduLen) => {
                  let len = 0;
                  let result;
                  let decodedValue;
                  const value = {};
                Severity: Minor
                Found in lib/services/life-safety-operation.js - About 1 hr to fix

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

                    module.exports.decode = (buffer, offset, apduLen) => {
                      let len = 0;
                      let result;
                      let decodedValue;
                      if (apduLen < 7) return;
                    Severity: Minor
                    Found in lib/services/read-property.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 encode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports.encode = (buffer, data) => {
                      baAsn1.encodeContextUnsigned(buffer, 0, data.processId);
                      baAsn1.encodeContextObjectId(buffer, 1, data.initiatingObjectId.type, data.initiatingObjectId.instance);
                      baAsn1.encodeContextObjectId(buffer, 2, data.eventObjectId.type, data.eventObjectId.instance);
                      baAsn1.bacappEncodeContextTimestamp(buffer, 3, data.timeStamp);
                    Severity: Minor
                    Found in lib/services/event-notify-data.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 decode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports.decode = (buffer, offset) => {
                      let len = 0;
                      const value = {};
                      let result;
                      let decodedValue;
                    Severity: Minor
                    Found in lib/services/subscribe-property.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 decode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports.decode = (buffer, offset, apduLen) => {
                      let len = 0;
                      let result;
                      let decodedValue;
                      len++;
                    Severity: Minor
                    Found in lib/services/event-information.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 decodeAcknowledge has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports.decodeAcknowledge = (buffer, offset, apduLen) => {
                      let result;
                      let decodedValue;
                      const objectId = {};
                      const property = {};
                    Severity: Minor
                    Found in lib/services/read-property.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 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 encode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports.encode = (buffer, funct, destination, source, hopCount, networkMsgType, vendorId) => {
                      const hasDestination = destination && destination.net > 0;
                      const hasSource = source && source.net > 0 && source.net !== 0xFFFF;
                    
                      buffer.buffer[buffer.offset++] = BACNET_PROTOCOL_VERSION;
                    Severity: Minor
                    Found in lib/npdu.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 decode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports.decode = (buffer, offset) => {
                      const orgOffset = offset;
                      offset++;
                      const funct = buffer[offset++];
                      let destination;
                    Severity: Minor
                    Found in lib/npdu.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 debug('Received invalid writePropertyMultiple message');
                    Severity: Major
                    Found in lib/client.js - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language