antongolub/yarn-audit-fix

View on GitHub

Showing 7 of 7 total issues

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

export const _patch = (
  lockfile: TLockfileObject,
  report: TAuditReport,
  { flags, bins }: TContext,
  lockfileType: TLockfileType,
Severity: Minor
Found in src/main/ts/lockfile/index.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 audit has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const audit = (
  flags: TFlags,
  temp: string,
  bins: Record<string, string>,
): TAuditReport => {
Severity: Minor
Found in src/main/ts/lockfile/v2.ts - About 1 hr to fix

    Function format has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const format = (lockfile: TLockfileObject): string => {
      const keymap = Object.entries(lockfile).reduce<Record<string, any>>(
        (m, [k, { resolution }]) => {
          const entry = m[resolution] || (m[resolution] = [])
          entry.push(k)
    Severity: Minor
    Found in src/main/ts/lockfile/v2.ts - About 1 hr to fix

      Function formatFlags has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      export const formatFlags = (flags: TFlags, ...picklist: string[]): string[] =>
        Object.keys(flags).reduce<string[]>((memo, key: string) => {
          const omitlist = ['_', '--']
          const value = flags[key]
          const flag = formatFlag(key)
      Severity: Minor
      Found in src/main/ts/util.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 audit has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const audit = (
        flags: TFlags,
        temp: string,
        bins: Record<string, string>,
      ): TAuditReport => {
      Severity: Minor
      Found in src/main/ts/lockfile/v1.ts - About 1 hr to fix

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

        export const printRuntimeDigest: TCallback = ({
          temp,
          cwd,
          flags,
          bins,
        Severity: Minor
        Found in src/main/ts/stages.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 mapFlags has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        export const mapFlags = (flags: TFlags, mapping: TFlagsMapping): TFlags =>
          reduce(
            flags,
            (memo: TFlags, value: any, key: string) => {
              const repl = mapping[key]
        Severity: Minor
        Found in src/main/ts/util.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

        Severity
        Category
        Status
        Source
        Language