fh1ch/node-bacstack

View on GitHub

Showing 217 of 365 total issues

File service-event-notify-data.spec.js has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

const utils = require('./utils');
const baServices = require('../../lib/services');
const baEnum = require('../../lib/enum');
Severity: Minor
Found in test/unit/service-event-notify-data.spec.js - About 3 hrs to fix

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

    module.exports.decode = (buffer, offset, apduLen) => {
      let len = 0;
      let result;
      let decodedValue;
      if (!baAsn1.decodeIsContextTag(buffer, offset + len, 0)) return;
    Severity: Major
    Found in lib/services/cov-notify.js - About 3 hrs to fix

      Function decode has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      module.exports.decode = (buffer, offset, apduLen) => {
        let len = 0;
        let result;
        let decodedValue;
        result = baAsn1.decodeTagNumberAndValue(buffer, offset + len);
      Severity: Minor
      Found in lib/services/write-property-multiple.js - About 3 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 decode has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.decode = (buffer, offset, apduLen) => {
        let len = 0;
        const value = {};
        let result;
        let decodedValue;
      Severity: Major
      Found in lib/services/alarm-acknowledge.js - About 2 hrs to fix

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

        module.exports.decode = (buffer, offset, apduLen) => {
          let len = 0;
          let result;
          let decodedValue;
          let isStream;
        Severity: Minor
        Found in lib/services/atomic-write-file.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 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 decode has 71 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: Major
          Found in lib/services/get-enrollment-summary.js - About 2 hrs to fix

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

            module.exports.decodeAcknowledge = (buffer, offset, apduLen) => {
              let len = 0;
              let result;
              let decodedValue;
              const value = {};
            Severity: Minor
            Found in lib/services/get-event-information.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 decode has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            module.exports.decode = (buffer, offset, apduLen) => {
              let len = 0;
              let result;
              let decodedValue;
              result = baAsn1.decodeTagNumberAndValue(buffer, offset + len);
            Severity: Major
            Found in lib/services/write-property-multiple.js - About 2 hrs to fix

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

              module.exports.decode = (buffer, offset, apduLen) => {
                let len = 0;
                let result;
                let decodedValue;
                len++;
              Severity: Major
              Found in lib/services/event-information.js - About 2 hrs to fix

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

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

                  module.exports.decode = (buffer, offset, apduLen) => {
                    let len = 0;
                    let result;
                    let decodedValue;
                    let objectId;
                  Severity: Major
                  Found in lib/services/create-object.js - About 2 hrs to fix

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

                    module.exports.decode = (buffer, offset) => {
                      let len = 0;
                      const value = {};
                      let result;
                      let decodedValue;
                    Severity: Major
                    Found in lib/services/subscribe-property.js - About 2 hrs to fix

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

                      module.exports.decode = (buffer, offset, apduLen) => {
                        let len = 0;
                        const value = {
                          property: {}
                        };
                      Severity: Major
                      Found in lib/services/write-property.js - About 2 hrs to fix

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

                          module.exports.decode = (buffer, offset, apduLen) => {
                            let len = 0;
                            const value = {
                              property: {}
                            };
                          Severity: Minor
                          Found in lib/services/write-property.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 decode has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports.decode = (buffer, offset) => {
                            let len = 0;
                            let result;
                            let decodedValue;
                            let isStream = true;
                          Severity: Major
                          Found in lib/services/atomic-read-file.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

                            Severity
                            Category
                            Status
                            Source
                            Language