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,
- Read upRead up
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");
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;
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;
}
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) {
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);
- Read upRead up
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
) {
Avoid deeply nested control flow statements. Open
if (buffer[0] === ",") {
buffer = buffer.substring(1);
}
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);
}
- Read upRead up
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
});
Avoid too many return
statements within this function. Open
return result;
Avoid too many return
statements within this function. Open
return value;
Avoid too many return
statements within this function. Open
return node;
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;
- Read upRead up
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]}]${
- Read upRead up
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"