Showing 23 of 35 total issues
Function invoke
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
public invoke(input: string): DSLVariable{
let currentType: DSLVariableType = DSLVariableType.key,
original: string = input,
idx: number = 0,
startIdx: number = 0,
- 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 invoke
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
public invoke(parts: string[]): DSLExpression{
let dsl: DSLExpression = {literal: this.craftLiteralFromParts(parts), expression: null},
expression: Expression,
pidx: number,
eidx: number,
- 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 invoke
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
public invoke(parts: string[]): DSLExpression{
let dsl: DSLExpression = {literal: this.craftLiteralFromParts(parts), expression: null},
expression: Expression,
pidx: number,
eidx: number,
- Create a ticketCreate a ticket
Function invoke
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public invoke<T extends DSLExpressionTree>(parts: string[]): T{
let dsl: T = <any>{},
idx: number = 0,
singleExpressionParts: string[];
while(idx < parts.length){
- 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 invoke
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
public invoke(input: string): DSLVariable{
let currentType: DSLVariableType = DSLVariableType.key,
original: string = input,
idx: number = 0,
startIdx: number = 0,
- Create a ticketCreate a ticket
Function levelDSL
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
private levelDSL(dsls: DSL[]): LeveledDSL[]{
let currentLevel: number = 0,
levels: LeveledDSL[] = [],
dsl: DSL;
for(dsl of dsls){
- 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 identify
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
private identify(input: string): DSL[]{
let currentType: DSLType = DSLType.text,
idx: number = 0,
startIdx: number = 0,
dsl: DSL[] = [];
- 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 15 (exceeds 5 allowed). Consider refactoring. Open
public parse(dsl: DSL[], variables: ScopedVariables = {}): string{
let output: string = '', idx: number;
for(idx=0; idx < dsl.length; idx++){
if(dsl[idx].variable) variables = this.resolveVariable(dsl[idx].variable, variables);
if(dsl[idx].command && !!(<DependentAction | StartingAction>dsl[idx].command.action).rule){
- 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 identify
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private identify(input: string): DSL[]{
let currentType: DSLType = DSLType.text,
idx: number = 0,
startIdx: number = 0,
dsl: DSL[] = [];
- Create a ticketCreate a ticket
Function compareOrderedModifier
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private compareOrderedModifier(part: string, ePart: OrderedModifier[]): [string, OrderedModifier] {
let ord: OrderedModifier,
key: string,
identifier: string;
for(ord of ePart){
- 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 9 (exceeds 5 allowed). Consider refactoring. Open
public parse(dsl: DSLCommand, scope: DSL[], variables: ScopedVariables):string {
const action: StartingAction | DependentAction | IterableAction = <StartingAction | DependentAction | IterableAction>dsl.action;
let expressionResult: ExpressionResult,
result: string;
if(!!action.rule){
- 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
Avoid deeply nested control flow statements. Open
if(clone[pidx] === SPACE && Array.isArray(expression.template[eidx-1])){
/* Rule: M2 */
clone.splice(pidx, 1);
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(!dsl.branches) dsl.branches = [];
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(!foundIdentifier) {/* Rule: M1 */
eidx++;
continue;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(ePart !== (<string>clone[pidx]).slice(0, ePart.length)){
/* Rule: O2 */
isMatch = false;
break;
}
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if((<string>clone[pidx]).length === foundIdentifier.length) {
/* Rule: M3 */
clone.splice(pidx, 1);
} else {
/* Rule: M3 */
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(ePart.length !== (<string>clone[pidx]).length){
/* Rule: O3 */
clone.splice(pidx, 1, (<string>clone[pidx]).slice(ePart.length, (<string>clone[pidx]).length));
} else {
/* Rule: O5 */
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if(!dsl.conjunctions) dsl.conjunctions = [];
- Create a ticketCreate a ticket
Function parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public parse(dsl: DSLReplacement, variables?: ScopedVariables): string{
let output: string | boolean,
result: ExpressionResult;
if(!!dsl.expressions) {
result = new ExpressionTreeParser(this.options).parse(dsl.expressions, variables);
- 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 extractString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private extractString(input: string, start: number, stringChar: string): string{
let idx: number = start + 1;
while(idx < input.length){
switch(input[idx]){
case this.options.stringEscapeChar:
- 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"