tunnckoCore/gibon

View on GitHub

Showing 120 of 120 total issues

Identical blocks of code found in 4 locations. Consider refactoring.
Open

  default:
    if (moduleName === undefined) console.error('Missing parser module name');
    else console.error(`Invalid parser module name: ${moduleName}`);
    process.exit(1);
modules/formidable-mini/benchmark/bench-multipart-fields-100mb-big.js on lines 140..143
modules/formidable-mini/benchmark/bench-urlencoded-fields-100pairs-small.js on lines 93..96
modules/formidable-mini/benchmark/bench-urlencoded-fields-900pairs-small-alt.js on lines 82..85

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

  default:
    if (moduleName === undefined) console.error('Missing parser module name');
    else console.error(`Invalid parser module name: ${moduleName}`);
    process.exit(1);
modules/formidable-mini/benchmark/bench-multipart-fields-100mb-big.js on lines 140..143
modules/formidable-mini/benchmark/bench-multipart-fields-100mb-small.js on lines 141..144
modules/formidable-mini/benchmark/bench-urlencoded-fields-100pairs-small.js on lines 93..96

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

  default:
    if (moduleName === undefined) console.error('Missing parser module name');
    else console.error(`Invalid parser module name: ${moduleName}`);
    process.exit(1);
modules/formidable-mini/benchmark/bench-multipart-fields-100mb-big.js on lines 140..143
modules/formidable-mini/benchmark/bench-multipart-fields-100mb-small.js on lines 141..144
modules/formidable-mini/benchmark/bench-urlencoded-fields-900pairs-small-alt.js on lines 82..85

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

  default:
    if (moduleName === undefined) console.error('Missing parser module name');
    else console.error(`Invalid parser module name: ${moduleName}`);
    process.exit(1);
modules/formidable-mini/benchmark/bench-multipart-fields-100mb-small.js on lines 141..144
modules/formidable-mini/benchmark/bench-urlencoded-fields-100pairs-small.js on lines 93..96
modules/formidable-mini/benchmark/bench-urlencoded-fields-900pairs-small-alt.js on lines 82..85

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    parser
      .on('field', (name, val, info) => {
        ++calls.partBegin;
        ++calls.partData;
        ++calls.partEnd;
modules/formidable-mini/benchmark/bench-multipart-fields-100mb-small.js on lines 52..61

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 50.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

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

      function pathJoin(...paths) {
        if (paths.length === 0) return '.';
        let joined;
      
        // eslint-disable-next-line no-plusplus
      Severity: Minor
      Found in asia/asia/src/cache.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

        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

        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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              parser
                .on('field', (name, val, info) => {
                  ++calls.partBegin;
                  ++calls.partData;
                  ++calls.partEnd;
          modules/formidable-mini/benchmark/bench-multipart-fields-100mb-big.js on lines 49..59

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 50.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          const calls = {
            partBegin: 0,
            headerField: 0,
            headerValue: 0,
            headerEnd: 0,
          modules/formidable-mini/benchmark/bench-multipart-fields-100mb-small.js on lines 28..37

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          createToken(
            'FULLPLAIN',
            `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`,
          );
          Severity: Minor
          Found in @tunnckocore/semver-increment/src/re.js and 1 other location - About 40 mins to fix
          @tunnckocore/semver-increment/src/re.js on lines 117..122

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

          const calls = {
            partBegin: 0,
            headerField: 0,
            headerValue: 0,
            headerEnd: 0,
          modules/formidable-mini/benchmark/bench-multipart-fields-100mb-big.js on lines 25..34

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          createToken(
            'LOOSEPLAIN',
            `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${
              src[t.BUILD]
            }?`,
          Severity: Minor
          Found in @tunnckocore/semver-increment/src/re.js and 1 other location - About 40 mins to fix
          @tunnckocore/semver-increment/src/re.js on lines 107..110

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 48.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              const parser = busboy({
                limits: {
                  fieldSizeLimit: Number.POSITIVE_INFINITY,
                },
                headers: {
          modules/formidable-mini/benchmark/bench-multipart-fields-100mb-small.js on lines 44..51

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 47.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Severity
          Category
          Status
          Source
          Language