r37r0m0d3l/vicis

View on GitHub

Showing 92 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export interface IConfigObject {
        cast?: ICast;
        defaults?: IDefaults;
        defined?: IDefined;
        exclude?: IExclude;
      Severity: Major
      Found in src/interface/config/IConfigObject.ts and 1 other location - About 4 hrs to fix
      src/interface/config/IConfigObjectFull.ts on lines 16..30

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 129.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      export interface IConfigObjectFull {
        cast?: ICast;
        defaults?: IDefaults;
        defined?: IDefined;
        exclude?: IExclude;
      Severity: Major
      Found in src/interface/config/IConfigObjectFull.ts and 1 other location - About 4 hrs to fix
      src/interface/config/IConfigObject.ts on lines 16..30

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 129.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        export function pickConfig(propertiesToPick: IPick): IPick {
          if (!Array.isArray(propertiesToPick)) {
            throw new TypeError("'Pick' should be an array");
          }
          if (arrayIsEmpty(propertiesToPick)) {
        Severity: Major
        Found in src/core/pick/pickConfig.ts and 2 other locations - About 4 hrs to fix
        src/core/defined/definedConfig.ts on lines 14..29
        src/core/omit/omitConfig.ts on lines 14..29

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 122.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        export function definedConfig(propertiesMustBeDefined: IDefined): IDefined {
          if (!Array.isArray(propertiesMustBeDefined)) {
            throw new TypeError("'Defined' should be an array");
          }
          if (arrayIsEmpty(propertiesMustBeDefined)) {
        Severity: Major
        Found in src/core/defined/definedConfig.ts and 2 other locations - About 4 hrs to fix
        src/core/omit/omitConfig.ts on lines 14..29
        src/core/pick/pickConfig.ts on lines 14..29

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 122.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        export function omitConfig(propertiesToOmit: IOmit): IOmit {
          if (!Array.isArray(propertiesToOmit)) {
            throw new TypeError("'Omit' should be an array");
          }
          if (arrayIsEmpty(propertiesToOmit)) {
        Severity: Major
        Found in src/core/omit/omitConfig.ts and 2 other locations - About 4 hrs to fix
        src/core/defined/definedConfig.ts on lines 14..29
        src/core/pick/pickConfig.ts on lines 14..29

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 122.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              if (
                "omit" in configFull && "pick" in configFull &&
                arrayHasSame(configFull.omit as IOmit, configFull.pick as IPick)
              ) {
                errors.push(
          Severity: Major
          Found in src/core/class/Vicis.ts and 2 other locations - About 3 hrs to fix
          src/core/class/Vicis.ts on lines 517..528
          src/core/class/Vicis.ts on lines 559..570

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 97.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              if (
                "omit" in configFull && "required" in configFull &&
                arrayHasSame(configFull.omit as IOmit, configFull.required as IRequired)
              ) {
                errors.push(
          Severity: Major
          Found in src/core/class/Vicis.ts and 2 other locations - About 3 hrs to fix
          src/core/class/Vicis.ts on lines 517..528
          src/core/class/Vicis.ts on lines 529..540

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 97.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              if (
                "omit" in configFull && "defined" in configFull &&
                arrayHasSame(configFull.omit as IOmit, configFull.defined as IDefined)
              ) {
                errors.push(
          Severity: Major
          Found in src/core/class/Vicis.ts and 2 other locations - About 3 hrs to fix
          src/core/class/Vicis.ts on lines 529..540
          src/core/class/Vicis.ts on lines 559..570

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 97.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                export function replace(
                  data: IObject,
                  replacePropertyValues: IReplace = {},
                ): IObject {
                  const config = replaceConfig(replacePropertyValues);
                Severity: Major
                Found in src/core/replace/replace.ts and 4 other locations - About 1 hr to fix
                src/core/defaults/defaults.ts on lines 16..25
                src/core/nullish/nullish.ts on lines 16..25
                src/core/rename/rename.ts on lines 15..24
                src/core/transform/transform.ts on lines 15..24

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 5 locations. Consider refactoring.
                Open

                export function transform(
                  data: IObject,
                  propertyValueTransformWith: ITransform = {},
                ): IObject {
                  const config = transformConfig(propertyValueTransformWith);
                Severity: Major
                Found in src/core/transform/transform.ts and 4 other locations - About 1 hr to fix
                src/core/defaults/defaults.ts on lines 16..25
                src/core/nullish/nullish.ts on lines 16..25
                src/core/rename/rename.ts on lines 15..24
                src/core/replace/replace.ts on lines 16..25

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 71.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Severity
                Category
                Status
                Source
                Language