Showing 70 of 92 total issues

Function sum has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function sum(object: Record<PropertyKey, TextNumber | boolean | Function>): number {
  let result = 0
  for (const key in object) {
    let value = object[key]
    if (value instanceof Function) {
Severity: Minor
Found in src/object/sum.ts - About 45 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

Function readdirP has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

async function* readdirP(dir: string): AsyncGenerator<string> {
  for (const entry of await fs.readdir(dir, { withFileTypes: true })) {
    if (entry.isDirectory()) {
      for await (const sub of readdirP(path.join(dir, entry.name))) {
        yield sub
Severity: Minor
Found in .scripts/rename.ts - About 45 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

Consider simplifying this complex logical expression.
Open

    } else if (
      isLastCharUpper &&
      isLastLastCharUpper &&
      /[A-Za-z]/.test(character) &&
      character.toLowerCase() === character
Severity: Major
Found in src/string/camelCase.ts - About 40 mins to fix

    Function pathToObject has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      paths: string = '',
      value: any = null,
      object: Record<PropertyKey, any> = {},
      divider: string = '.',
      replaceOnExist: boolean = true
    Severity: Minor
    Found in src/object/pathToObject.ts - About 35 mins to fix

      Function number has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        value: TextNumber,
        decimals: number = 2,
        decPoint: string = '.',
        thousandsSeparator: string = ',',
        clearDecimals: boolean = false
      Severity: Minor
      Found in src/format/number.ts - About 35 mins to fix

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

        async function main(): Promise<void> {
          for await (const entry of readdirP(path.relative(process.cwd(), path.join(__dirname, '..', 'dist/esm')))) {
            const match = /^(.*)(\.(js|js\.map|d\.ts))$/.exec(entry)
            if (match == null) {
              continue
        Severity: Minor
        Found in .scripts/rename.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

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

        const preserveCamelCase = (value: string): string => {
          let isLastCharLower = false
          let isLastCharUpper = false
          let isLastLastCharUpper = false
        
        
        Severity: Minor
        Found in src/string/camelCase.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

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

        export function trimAny(str: string, chars: string | string[]) {
          let start = 0,
            end = str.length
        
          const charsArray: string[] = typeof chars === 'string' ? [chars] : chars
        Severity: Minor
        Found in src/string/trim.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 false
        Severity: Major
        Found in src/object/equals.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return false
          Severity: Major
          Found in src/object/equals.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return objectsEqual(first, second)
            Severity: Major
            Found in src/core/equals.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return ('' + first).valueOf() === ('' + second).valueOf()
              Severity: Major
              Found in src/core/equals.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return true
                Severity: Major
                Found in src/array/equals.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return false
                  Severity: Major
                  Found in src/object/equals.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return false
                    Severity: Major
                    Found in src/array/equals.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return false
                      Severity: Major
                      Found in src/object/equals.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return false
                        Severity: Major
                        Found in src/object/equals.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            return values(value)
                          Severity: Major
                          Found in src/to/toArray.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return false
                            Severity: Major
                            Found in src/object/equals.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                return item
                              Severity: Major
                              Found in src/core/clone.ts - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language