tunnckoCore/gibon

View on GitHub

Showing 108 of 164 total issues

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

export default function ipFilter(ip, patterns, options) {
  if (typeof ip !== 'string') {
    throw new TypeError('ip-filter: expect `ip` to be a string');
  }

Severity: Minor
Found in modules/ip-filter/src/index.js - 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 getCliInfo has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function getCliInfo(rootCommand, commands, cfg) {
  const version = cfg.version || '0.0.0';

  if (rootCommand && rootCommand.cli) {
    const { name, usage } = rootCommand.cli;
Severity: Minor
Found in yaro/yaro-create-cli/src/index.js - 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 babelPresetOptimize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function babelPresetOptimize(api, options) {
  api.assertVersion(7);

  // NOTE: minifyBuiltins: true might output a bigger output - it depends, try your codebase.
  const opts = {
Severity: Minor
Found in @packages/babel-preset-optimise/src/index.js - 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 koaBetterBody has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export default function koaBetterBody(options) {
  const opts = defaultOptions(options);

  // eslint-disable-next-line consistent-return
  return function* plugin(next) {
Severity: Minor
Found in @packages/koa-better-body/src/index.js - 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

Avoid deeply nested control flow statements.
Open

          } else if (index - 1 === boundary.length) {
            if (flags & F.PART_BOUNDARY) {
              index = 0;
              if (c === LF) {
                // unset the PART_BOUNDARY flag
Severity: Major
Found in modules/formidable-mini/src/multipart.js - About 45 mins to fix

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

    export default async function main(settings = {}) {
      const { cwd, path, fs, env, asia, loadConfig, nextTick } = settings;
      const configPath = path.resolve(cwd, 'asia.config.js');
      const config = await loadConfig(configPath);
      const cfg = { cwd, path, fs, env, ...config };
    Severity: Minor
    Found in asia/asia/src/main.js - 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

    Avoid deeply nested control flow statements.
    Open

                if (flags & F.LAST_BOUNDARY && c === HYPHEN) {
                  state = S.END;
                  flags = 0;
                } else if (!(flags & F.LAST_BOUNDARY) && c === LF) {
                  index = 0;
    Severity: Major
    Found in modules/formidable-mini/src/multipart.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (c === CR) {
                    // CR = part boundary
                    flags |= F.PART_BOUNDARY;
                  } else if (c === HYPHEN) {
                    // HYPHEN = end boundary
      Severity: Major
      Found in modules/formidable-mini/src/multipart.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                      if (index === 0) {
                        dataCallback('onPartData', true);
                      }
        Severity: Major
        Found in modules/formidable-mini/src/multipart.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                    if (opts.autoCount && ch in res) {
                      res[ch] = res[ch] === true ? 2 : res[ch] + 1;
                    } else {
                      res[ch] = true;
                    }
          Severity: Major
          Found in yaro/yaro-parser/src/index.js - About 45 mins to fix

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

            export function checkCommit(commit, options) {
              const { error, value: headerObj } = validateHeader(commit.header, options);
              if (error) {
                throw error;
              }
            Severity: Minor
            Found in @packages/parse-commit-message/src/commit.js - 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 toFilePath has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function toFilePath(args) {
              if (arguments.length > 1) {
                // eslint-disable-next-line prefer-rest-params
                return toFilePath(arguments);
              }
            Severity: Minor
            Found in modules/to-file-path/src/index.js - 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;
            Severity: Major
            Found in yaro/yaro-create-cli/src/index.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

                Avoid too many return statements within this function.
                Open

                            return;
                Severity: Major
                Found in modules/formidable-mini/src/multipart.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 yield* next;
                    Severity: Major
                    Found in @packages/koa-better-body/src/utils.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return yield* next;
                      Severity: Major
                      Found in @packages/koa-better-body/src/utils.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          return 'green';
                        Severity: Major
                        Found in @tunnckocore/utils/src/index.js - About 30 mins 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
                            Severity
                            Category
                            Status
                            Source
                            Language