qiwi/packasso

View on GitHub

Showing 13 of 27 total issues

Function installData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export const installData = async (
  data: InstallData,
  cwd: string,
  uninstall: boolean,
) =>
Severity: Minor
Found in packages/core/src/main/ts/install.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 execute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

) => Promise<unknown> = async (commands, packages, options) => {
  await concurrently(
    [commands].flat().flatMap((command) =>
      [packages].flat().flatMap((pkg) => ({
        command: lodash.isString(command)
Severity: Minor
Found in packages/core/src/main/ts/run.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 diffJson has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

export const diffJson = (json1: any, json2: any): any =>
  Object.keys(json1).reduce((result, key) => {
    if (lodash.isEqual(json1[key], json2[key])) {
      return result
    }
Severity: Minor
Found in packages/core/src/main/ts/install.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 getTopo has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

) => Promise<ExtraTopoContext> = async (options, preset) => {
  const context = await topo(options)
  const packages = Object.fromEntries(
    await Promise.all(
      Object.entries(context.packages).map<
Severity: Minor
Found in packages/core/src/main/ts/topo.ts - About 1 hr to fix

    Function createCommandInstall has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    export const createCommandInstall = (
      install: Install,
      modules: string[] = [],
    ) => [
      createCommand('install', 'install').action(async (options, context) => {
    Severity: Minor
    Found in packages/core/src/main/ts/commands.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 run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    export const run = async (
      pkg: string | ExtraPackageEntry,
      modules: string[],
      command: string,
      preset: string | undefined,
    Severity: Minor
    Found in packages/core/src/main/ts/run.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 data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

      data: (pkg, topo) => [
        {
          [tsCjs]: {
            ...(pkg.leaf || pkg.unit
              ? {
    Severity: Minor
    Found in packages/tsc/src/main/ts/bin.ts - About 55 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 testTypes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    ) => TestType[] = (unit, it, e2e) => {
      return (
        unit || it || e2e
          ? [
              ...(unit ? ['unit'] : []),
    Severity: Minor
    Found in packages/core/src/main/ts/test.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 npx has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export const npx: (module: string, cwd: string) => string = (module, cwd) => {
      const { devDependencies = {} } = getPackageJson()
      const at = module.indexOf('@', module.startsWith('@') ? 1 : 0)
      const name = at === -1 ? module : module.slice(0, at)
      const version =
    Severity: Minor
    Found in packages/core/src/main/ts/run.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 data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      data: (pkg, topo) => [
        pkg.leaf || pkg.unit
          ? {
              [swcCjs]: {
                $schema: 'https://json.schemastore.org/swcrc',
    Severity: Minor
    Found in packages/swc/src/main/ts/bin.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 cmd has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    ) => string = (bin, args = {}, env = {}) =>
      [
        ...Object.entries(env)
          .filter(([key, value]) => !lodash.isNil(key) && !lodash.isNil(value))
          .flatMap(([key, value]) => `${key}=${value}`),
    Severity: Minor
    Found in packages/core/src/main/ts/run.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 { ...result, [key]: d }
    Severity: Major
    Found in packages/core/src/main/ts/install.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return { ...result, [key]: json1[key] }
      Severity: Major
      Found in packages/core/src/main/ts/install.ts - About 30 mins to fix
        Severity
        Category
        Status
        Source
        Language