01alchemist/sls-yaml

View on GitHub

Showing 15 of 17 total issues

Function emitNode has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

export function emitNode({
  node,
  basePath = ".",
  parentPath = "",
  parentName = null,
Severity: Minor
Found in src/template-compiler/index.ts - About 7 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

File index.ts has 449 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const fs = require("fs");
// const util = require("util");
const path = require("path");
const { spawnSync } = require("child_process");
const get = require("lodash.get");
Severity: Minor
Found in src/template-compiler/index.ts - About 6 hrs to fix

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

    export function parseToken(value: any, parent: Node) {
      let buffer: string = "";
      const parentNode = createNode(parent, NodeKind.GROUP);
    
      let lastParent: Node | null = parentNode;
    Severity: Major
    Found in src/template-compiler/index.ts - About 2 hrs to fix

      Function decodeHelmTemplates has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function decodeHelmTemplates(data: string) {
        /* istanbul ignore next */
        if (!data) {
          return data;
        }
      Severity: Major
      Found in src/helm-template/index.ts - About 2 hrs to fix

        Function encodeHelmTemplates has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function encodeHelmTemplates(data: string) {
          const lines = data.split("\n");
          return lines
            .map(line => {
              if (line) {
        Severity: Minor
        Found in src/helm-template/index.ts - About 1 hr to fix

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

            file: (
              [uri, encoding],
              { basePath, parentName, globalObj, parentPath = "", parentObj, context }
            ) => {
              const ext = uri.substring(uri.lastIndexOf(".") + 1, uri.length);
          Severity: Minor
          Found in src/template-compiler/index.ts - 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 readHelmTemplateSync has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function readHelmTemplateSync(
            pathOrData: Path | Buffer,
            parent?: ParentObject,
            context?: any
          ) {
          Severity: Minor
          Found in src/helm-template/index.ts - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                        if (buffer[0] === ",") {
                          buffer = buffer.substring(1);
                        }
            Severity: Major
            Found in src/template-compiler/index.ts - About 45 mins to fix

              Function parse has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              export function parse({ content, parent = null }: ParseArg): any {
                if (typeof content === "object") {
                  if (!content) {
                    return createNode(parent, NodeKind.VALUE, content);
                  }
              Severity: Minor
              Found in src/template-compiler/index.ts - 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

                    return emitNode({
                      node: child,
                      ...options
                    });
              Severity: Major
              Found in src/template-compiler/index.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return result;
                Severity: Major
                Found in src/template-compiler/index.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return value;
                  Severity: Major
                  Found in src/template-compiler/index.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      return node;
                    Severity: Major
                    Found in src/template-compiler/index.ts - About 30 mins to fix

                      Function createNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function createNode(parent: Node | null, kind: NodeKind, value?: any) {
                        const node = new Node(kind);
                        if (value !== undefined) node.value = value;
                        if (parent) {
                          node.parent = parent;
                      Severity: Minor
                      Found in src/template-compiler/index.ts - 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 printNodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function printNodes(node: Node | null, indent: string = ""): string {
                        if (node) {
                          let str =
                            indent +
                            `[node:${NodeKind[node.kind]}]${
                      Severity: Minor
                      Found in src/template-compiler/utils.ts - 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