Showing 7 of 7 total issues
Function parse
has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring. Open
public parse(
parser: NunjucksExtension.Parser,
nodes: NunjucksExtension.Nodes,
lexer: NunjucksExtension.Lexer,
): NunjucksExtension.ParseResult {
- 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 parse
has 200 lines of code (exceeds 25 allowed). Consider refactoring. Open
public parse(
parser: NunjucksExtension.Parser,
nodes: NunjucksExtension.Nodes,
lexer: NunjucksExtension.Lexer,
): NunjucksExtension.ParseResult {
File setProp.ts
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { inspect } from 'util';
import { TemplateError as NunjucksTemplateError } from 'nunjucks/src/lib';
import type { Extension as NunjucksExtension } from '../types/nunjucks-extension';
Function runAssignProperties
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
public runAssignProperties(_context: NunjucksExtension.Context, arg: ArgType, body?: () => unknown): string {
const value = body ? body() : arg.value;
for (const targetPropData of arg.targetPropList) {
let obj: Record<string, unknown> | undefined;
targetPropData.forEach((objectPathItem, index) => {
Function value2node
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private value2node(
nodes: NunjucksExtension.Nodes,
value: unknown,
lineno: number,
colno: number,
Function getObjectPath
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private getObjectPath(
nodes: NunjucksExtension.Nodes,
lookupValNode: NunjucksNodes.LookupVal | NonNullable<NunjucksNodes.LookupVal['target']>,
): ObjectPathData<
| NunjucksNodes.Symbol
- 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 throwError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private throwError(
parser: NunjucksExtension.Parser,
currentMethod: Function, // eslint-disable-line @typescript-eslint/ban-types
message: string,
linenoOrError?: number | NunjucksTemplateError,
- 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"