File transport.ts
has 441 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
/**
* Import interfaces
*/
- Create a ticketCreate a ticket
Function getChoiseType
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
public static getChoiseType(rate: any, choices: any): string {
if (rate === 0) {
if (Transport.isObjectNotEmpty(choices.normal)) {
return "normal";
} else if (Transport.isObjectNotEmpty(choices.bad)) {
- 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 combineSettings
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public static combineSettings(settedSettings: any, defaultSettings: any): any {
let settings;
if (
(
typeof settedSettings === "boolean" ||
- 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
Consider simplifying this complex logical expression. Open
if (
(
typeof settedSettings === "boolean" ||
typeof settedSettings === "number" ||
typeof settedSettings === "string" ||
- Create a ticketCreate a ticket
Function getTransport
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public getTransport(_transports: string[], type: string): string[] {
/**
* Filter sub transports by settings
*/
const transports = [];
- 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 combineSettings
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static combineSettings(settedSettings: any, defaultSettings: any): any {
let settings;
if (
(
typeof settedSettings === "boolean" ||
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if (
type === "base" ||
(
this.Settings &&
this.Settings.Transports &&
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return "good";
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return "good";
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return "normal";
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return "bad";
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return "normal";
- Create a ticketCreate a ticket