Showing 48 of 92 total issues
File Vicis.ts
has 549 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { IFunction } from "../../interface/common/IFunction";
import { IObject } from "../../interface/common/IObject";
import { ICast } from "../../interface/config/ICast";
import { IConfig } from "../../interface/config/IConfig";
Function testConfig
has 135 lines of code (exceeds 25 allowed). Consider refactoring. Open
static testConfig(config: IConfig): IConfigObject {
let configFull: IConfigObjectFull;
if (isFunction(config)) {
configFull = convertFunctionToConfig(config as IFunction);
} else {
Function typeOf
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
function typeOf(val: any) {
if (typeof val === "undefined") {
return "undefined";
}
if (val === 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
Vicis
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
export class Vicis {
//#region Config Fields
/**
* @name cast
* @private
Function typeOf
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
function typeOf(val: any) {
if (typeof val === "undefined") {
return "undefined";
}
if (val === null) {
Function validateConfig
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
public validateConfig() {
const cast = objectGetKeys(this.__cast);
const rename = objectGetKeys(this.__rename);
const replace = objectGetKeys(this.__replace);
const transform = objectGetKeys(this.__transform);
Function convertFunctionToConfig
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function convertFunctionToConfig(
callable: IFunction,
): IConfigObjectFull {
if (!isFunction(callable)) {
throw new TypeError("Callable must be a function");
Function castData
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function castData(
propertyToType: ICast,
dataToSerialize: IObject,
): IObject {
if (objectIsEmpty(propertyToType)) {
Function arrayGetUnique
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function arrayGetUnique(array: any[], sort = true): any[] {
if (array.length < 2) {
return array;
}
let unique = [...new Set(array)];
- 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 testConfig
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
static testConfig(config: IConfig): IConfigObject {
let configFull: IConfigObjectFull;
if (isFunction(config)) {
configFull = convertFunctionToConfig(config as IFunction);
} else {
- 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 clone
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function clone(val: any) {
switch (typeOf(val)) {
case "arraybuffer":
return cloneArrayBuffer(val);
case "array":
Function arrayGetUnique
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function arrayGetUnique(array: any[], sort = true): any[] {
if (array.length < 2) {
return array;
}
let unique = [...new Set(array)];
Function convertFunctionToConfig
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function convertFunctionToConfig(
callable: IFunction,
): IConfigObjectFull {
if (!isFunction(callable)) {
throw new TypeError("Callable must be a function");
- 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 config
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
config(config: IConfig = {}) {
let configFull: IConfigObjectFull;
if (isFunction(config)) {
configFull = convertFunctionToConfig(config as IFunction);
} else {
Function validateData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public validateData() {
if (this.__dataOriginal === undefined) {
return this;
}
if (
Function validateConfig
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public validateConfig() {
const cast = objectGetKeys(this.__cast);
const rename = objectGetKeys(this.__rename);
const replace = objectGetKeys(this.__replace);
const transform = objectGetKeys(this.__transform);
- 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 exclude
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function exclude(
data: IObject,
propertiesToExclude: IExclude = [],
): IObject {
const config = excludeConfig(propertiesToExclude);
Function excludeData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function excludeData(
propertiesToExclude: IExclude,
data: IObject,
): IObject {
if (arrayIsEmpty(propertiesToExclude)) {
Function convertToFlag
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function convertToFlag(
value: any,
onEmpty = false,
onUnParsable = false,
): boolean {
- 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 onUnParsable;