tunnckoCore/gibon

View on GitHub
@packages/jest-runner-rollup/src/runner.js

Summary

Maintainability
D
1 day
Test Coverage

Function jestRunnerRollup has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = async function jestRunnerRollup({ testPath, config }) {
  const start = new Date();

  /** Load config from possible places */
  const cfg = await tryLoadConfig({ testPath, config, start });
Severity: Minor
Found in @packages/jest-runner-rollup/src/runner.js - About 5 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

File runner.js has 273 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const fs = require('fs');
const path = require('path');
const crypto = require('crypto');

const builtins = require('builtin-modules');
Severity: Minor
Found in @packages/jest-runner-rollup/src/runner.js - About 2 hrs to fix

    Function tryLoadConfig has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    async function tryLoadConfig({ testPath, config: jestConfig, start }) {
      const cfg = await tryCatch(testPath, start, () => {
        let result = null;
        result = jestRunnerConfig.search();
    
    
    Severity: Minor
    Found in @packages/jest-runner-rollup/src/runner.js - 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 (
          // if `jest-runner.config.js` not found
          !result ||
          // or found
          (result && // but // the `rollup` property is not an object
    Severity: Critical
    Found in @packages/jest-runner-rollup/src/runner.js - About 1 hr to fix

      Avoid too many return statements within this function.
      Open

        if (res.hasError) return res.error;
      Severity: Major
      Found in @packages/jest-runner-rollup/src/runner.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

          return res;
        Severity: Major
        Found in @packages/jest-runner-rollup/src/runner.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return ret;
          Severity: Major
          Found in @packages/jest-runner-rollup/src/runner.js - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status