Showing 23 of 35 total issues
Function resolveValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static resolveValue(value: string | number | string[], variables: ScopedVariables, suppressUndefinedVariableError: boolean = false): string | string[]{
if(Array.isArray(value)) return value;
if(value[0] === `'` || value[0] === `"`) return (<string>value).slice(1, (<string>value).length - 1);
if(!isNaN(+value)) return value.toString();
if(!!variables && variables.hasOwnProperty(<string>value)) return variables[<string>value];
- Read upRead up
- Create a ticketCreate a ticket
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 a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public parse(dsl: DSLExpression, variables: ScopedVariables): ExpressionResult{
let idx: number,
result: ExpressionResult = {value: null};
for (idx=0; idx < dsl.values.length; idx++) {
dsl.values[idx] = Parser.resolveValue(dsl.values[idx], variables, !!dsl.expression.suppressUndefinedVariableError);
- Read upRead up
- Create a ticketCreate a ticket
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 validateOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private validateOptions(options: LexerOptions): Lexer{
let array: string[] = [];
for(var key of Object.keys(DEFAULT_LEXER_OPTIONS)){
if(typeof options[key] === 'string') array.push(options[key]);
}
- Read upRead up
- Create a ticketCreate a ticket
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"