grantcarthew/node-perj

View on GitHub

Showing 12 of 25 total issues

File perj.js has 284 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { options as defaultOptions } from "./options.js";
import { notationCopy } from "./notation-copy.js";

// Symbols for functions and values
const _HeaderStrings = Symbol("HeaderStrings");
Severity: Minor
Found in src/perj.js - About 2 hrs to fix

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

    export function assertObjectSubsetMatch(t, fullObject, subsetObject) {
      if (
        typeof fullObject !== "object" ||
        fullObject === null ||
        typeof subsetObject !== "object" ||
    Severity: Minor
    Found in tests/asserts.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

    Avoid deeply nested control flow statements.
    Open

                if (msg) {
                  data.push(item);
                } else {
                  msg = item;
                }
    Severity: Major
    Found in src/perj.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (!msg) {
                    msg = item.message;
                  }
      Severity: Major
      Found in src/perj.js - About 45 mins to fix

        Consider simplifying this complex logical expression.
        Open

              if (
                Object.hasOwn(defaultOptions, key) ||
                this[_Options].levelKey === key ||
                this[_Options].levelNumberKey === key ||
                this[_Options].dateTimeKey === key ||
        Severity: Major
        Found in src/perj.js - About 40 mins to fix

          Avoid too many return statements within this function.
          Open

                  return src;
          Severity: Major
          Found in src/notation-copy.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return undefined;
            Severity: Major
            Found in src/notation-copy.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return result;
              Severity: Major
              Found in src/notation-copy.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return newArray;
                Severity: Major
                Found in src/notation-copy.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return tgt;
                  Severity: Major
                  Found in src/notation-copy.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return tgt;
                    Severity: Major
                    Found in src/notation-copy.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        return JSON.stringify(notationCopy({}, obj), replacer, spacer);
                      Severity: Major
                      Found in src/options.js - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language