fh1ch/node-bacstack

View on GitHub
lib/services/get-enrollment-summary.js

Summary

Maintainability
C
1 day
Test Coverage

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 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

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

      module.exports.decodeAcknowledge = (buffer, offset, apduLen) => {
        let len = 0;
        let result;
        const enrollmentSummaries = [];
        while ((apduLen - len) > 0) {
      Severity: Minor
      Found in lib/services/get-enrollment-summary.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 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 decode has a Cognitive Complexity of 7 (exceeds 5 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/get-enrollment-summary.js - About 35 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 too many return statements within this function.
        Open

            if (result.tagNumber !== baEnum.ApplicationTags.UNSIGNED_INTEGER) return;
        Severity: Major
        Found in lib/services/get-enrollment-summary.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return {
              enrollmentSummaries: enrollmentSummaries,
              len: len
            };
          Severity: Major
          Found in lib/services/get-enrollment-summary.js - About 30 mins to fix

            Parsing error: Invalid ecmaVersion.
            Open

            'use strict';

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

            There are no issues that match your filters.

            Category
            Status