r37r0m0d3l/vicis

View on GitHub

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";
Severity: Major
Found in src/core/class/Vicis.ts - About 1 day to fix

    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 {
    Severity: Major
    Found in src/core/class/Vicis.ts - About 5 hrs to fix

      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) {
      Severity: Minor
      Found in src/util/variable/cloneDeep.ts - About 4 hrs to fix

      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
      Severity: Minor
      Found in src/core/class/Vicis.ts - About 4 hrs to fix

        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) {
        Severity: Major
        Found in src/util/variable/cloneDeep.ts - About 3 hrs to fix

          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);
          Severity: Major
          Found in src/core/class/Vicis.ts - About 3 hrs to fix

            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");
            Severity: Major
            Found in src/core/config/functionToConfig.ts - About 2 hrs to fix

              Function castData has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function castData(
                propertyToType: ICast,
                dataToSerialize: IObject,
              ): IObject {
                if (objectIsEmpty(propertyToType)) {
              Severity: Major
              Found in src/core/cast/castData.ts - About 2 hrs to fix

                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)];
                Severity: Minor
                Found in src/util/array/get/unique.ts - About 2 hrs to fix

                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 {
                Severity: Minor
                Found in src/core/class/Vicis.ts - About 1 hr to fix

                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":
                Severity: Minor
                Found in src/util/variable/cloneDeep.ts - About 1 hr to fix

                  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)];
                  Severity: Minor
                  Found in src/util/array/get/unique.ts - About 1 hr to fix

                    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");
                    Severity: Minor
                    Found in src/core/config/functionToConfig.ts - About 1 hr to fix

                    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 {
                    Severity: Minor
                    Found in src/core/class/Vicis.ts - About 1 hr to fix

                      Function validateData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        public validateData() {
                          if (this.__dataOriginal === undefined) {
                            return this;
                          }
                          if (
                      Severity: Minor
                      Found in src/core/class/Vicis.ts - About 1 hr to fix

                        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);
                        Severity: Minor
                        Found in src/core/class/Vicis.ts - About 1 hr to fix

                        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);
                        Severity: Minor
                        Found in src/core/exclude/exclude.ts - About 1 hr to fix

                          Function excludeData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function excludeData(
                            propertiesToExclude: IExclude,
                            data: IObject,
                          ): IObject {
                            if (arrayIsEmpty(propertiesToExclude)) {
                          Severity: Minor
                          Found in src/core/exclude/excludeData.ts - About 1 hr to fix

                            Function convertToFlag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function convertToFlag(
                              value: any,
                              onEmpty = false,
                              onUnParsable = false,
                            ): boolean {
                            Severity: Minor
                            Found in src/util/convert/to/flag.ts - About 35 mins to fix

                            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 "regexp";
                            Severity: Major
                            Found in src/util/variable/cloneDeep.ts - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language