Showing 92 of 92 total issues

Function fromQueryString has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
Open

export default function fromQueryString(
  queryString: string,
  recursive: boolean = false,
  options: FromQueryStringOptions = { decodeName: true }
): Record<string, any> {
Severity: Minor
Found in src/object/fromQueryString.ts - About 1 day 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 equal has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

export default function equal(origin: Record<PropertyKey, any>, ...list: Record<PropertyKey, any>[]): boolean {
  let i: number, l: number, leftChain: Array<any>, rightChain: Array<any>

  if (!isObject(origin) || list.length === 0) {
    throw new Error('Need two or more arguments to compare')
Severity: Minor
Found in src/object/equals.ts - About 1 day 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 equals has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

export default function equals(array1: any[], array2: any[]): boolean {
  const length1 = array1.length
  const length2 = array2.length
  let i

Severity: Minor
Found in src/array/equals.ts - About 3 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 pathToObject has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

export default function pathToObject(
  paths: string = '',
  value: any = null,
  object: Record<PropertyKey, any> = {},
  divider: string = '.',
Severity: Minor
Found in src/object/pathToObject.ts - About 3 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 clone has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

export default function clone<T = NonNullable<any>>(item: T, cloneDom: boolean = true): T {
  if (item === null || item === undefined) {
    return item
  }

Severity: Minor
Found in src/core/clone.ts - About 3 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 equal has 77 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function equal(origin: Record<PropertyKey, any>, ...list: Record<PropertyKey, any>[]): boolean {
  let i: number, l: number, leftChain: Array<any>, rightChain: Array<any>

  if (!isObject(origin) || list.length === 0) {
    throw new Error('Need two or more arguments to compare')
Severity: Major
Found in src/object/equals.ts - About 3 hrs to fix

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

      public toString(callback?: (i: T) => any): string {
        const data = this.toArray()
    
        if (callback && isFunction(callback)) {
          return data.map(item => callback(item)).toString()
    Severity: Major
    Found in src/structures/CollectionArray.ts and 2 other locations - About 2 hrs to fix
    src/structures/Queue.ts on lines 34..42
    src/structures/Stack.ts on lines 30..38

    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 94.

    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

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

      public toString(callback?: (i: T) => any): string {
        const data = this.toArray()
    
        if (callback && isFunction(callback)) {
          return data.map(item => callback(item)).toString()
    Severity: Major
    Found in src/structures/Stack.ts and 2 other locations - About 2 hrs to fix
    src/structures/CollectionArray.ts on lines 27..35
    src/structures/Queue.ts on lines 34..42

    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 94.

    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

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

      public toString(callback?: (i: T) => any): string {
        const data = this.toArray()
    
        if (callback && isFunction(callback)) {
          return data.map(item => callback(item)).toString()
    Severity: Major
    Found in src/structures/Queue.ts and 2 other locations - About 2 hrs to fix
    src/structures/CollectionArray.ts on lines 27..35
    src/structures/Stack.ts on lines 30..38

    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 94.

    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 defaults has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function defaults(
      origin: Record<PropertyKey, any>,
      ...destinations: Record<PropertyKey, any>[]
    ): Record<PropertyKey, any> {
      const ln = destinations.length
    Severity: Minor
    Found in src/object/defaults.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 toQueryObjects has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function toQueryObjects(
      name: string,
      value: oType | oTypeArray,
      recursive: boolean = false
    ): Record<string, any>[] {
    Severity: Minor
    Found in src/object/toQueryObjects.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

    Consider simplifying this complex logical expression.
    Open

        if (
          (inherited || hasOwnProperty.call(value, key)) &&
          !(
            skipIndexes &&
            // Safari 9 has enumerable `arguments.length` in strict mode.
    Severity: Critical
    Found in src/internal/arrayLikeKeys.ts - About 2 hrs to fix

      Function removeEmpty has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

      export default function removeEmpty(object: Record<PropertyKey, any>): Record<PropertyKey, any> {
        let result: Record<PropertyKey, any> = {},
          key: PropertyKey
      
        for (key in object) {
      Severity: Minor
      Found in src/object/removeEmpty.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 compare2Objects has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function compare2Objects(x: any, y: any) {
          let p
      
          // remember that NaN === NaN returns false
          // and isNaN(undefined) returns true
      Severity: Major
      Found in src/object/equals.ts - About 2 hrs to fix

        Function remove has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function remove(
          object: Record<PropertyKey, any>,
          selector: string | string[],
          divider: string = '.'
        ): Record<PropertyKey, any> {
        Severity: Minor
        Found in src/object/remove.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 merge has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        export default function merge<T extends Partial<record>>(original: Partial<T>, ...values: Partial<T>[]): T {
          const ln = values.length
          let i = 0,
            object: Partial<T>,
            key: PropertyKey,
        Severity: Minor
        Found in src/object/merge.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

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

        export function isObjects(...parameters: any[]): boolean {
          if (parameters.length === 0) {
            throw new Error('Please provide at least one number to evaluate isObject.')
          }
        
        
        Severity: Major
        Found in src/is/isObject.ts and 1 other location - About 2 hrs to fix
        src/is/isFunction.ts on lines 13..21

        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 78.

        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 function isFunctions(...parameters: any[]): boolean {
          if (parameters.length === 0) {
            throw new Error('Please provide at least one number to evaluate isInteger.')
          }
        
        
        Severity: Major
        Found in src/is/isFunction.ts and 1 other location - About 2 hrs to fix
        src/is/isObject.ts on lines 18..26

        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 78.

        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

              if (Object.prototype.hasOwnProperty.call(value, i)) {
                if (recursive) {
                  objects = objects.concat(toQueryObjects(name + '[' + i + ']', valueObject[i], true))
                } else {
                  objects.push({
        Severity: Major
        Found in src/object/toQueryObjects.ts and 1 other location - About 2 hrs to fix
        src/object/toQueryObjects.ts on lines 55..64

        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 77.

        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

            for (i = 0, ln = valueArray.length; i < ln; i++) {
              if (recursive) {
                objects = objects.concat(toQueryObjects(name + '[' + i + ']', valueArray[i], true))
              } else {
                objects.push({
        Severity: Major
        Found in src/object/toQueryObjects.ts and 1 other location - About 2 hrs to fix
        src/object/toQueryObjects.ts on lines 71..80

        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 77.

        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