tunnckoCore/gibon

View on GitHub

Showing 164 of 164 total issues

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

  if (opts.verbose) {
    console.log('');
    console.log('Preparing to publish:');
    wsResolved.map((pkgPath) => console.log('-', pkgPath));
  }
Severity: Major
Found in @hela/preset-workspaces/src/commands/publish.js and 1 other location - About 1 hr to fix
@hela/preset-workspaces/src/commands/publish.js on lines 112..116

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 57.

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 exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = utils.errorBase('UsefulError', function (message, options) {
  if (typeof message === 'object') {
    options = message;
    message = false;
  }
Severity: Minor
Found in modules/formidable-mini/fixture.js - 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 packageJson has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default async function packageJson(packageName, endpoint) {
  const { name, version } = parsePkgName(packageName);
  const tag = version === '' ? 'latest' : version;
  const uri =
    typeof endpoint === 'function'
Severity: Minor
Found in @tunnckocore/package-json/src/index.js - 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 stringToHeader has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function stringToHeader(val, options) {
  const opts = { caseSensitive: false, ...options };

  /* eslint-disable unicorn/no-unsafe-regex */
  const defaultRegex = opts.caseSensitive
Severity: Minor
Found in @packages/parse-commit-message/src/utils.js - About 1 hr to fix

    Function tryCatch has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    async function tryCatch(code, meta, fn) {
      let result = null;
      try {
        result = await fn(meta.argv);
      } catch (err) {
    Severity: Minor
    Found in yaro/yaro-create-cli/src/index.js - About 1 hr to fix

      Function each has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function each(items, mapper, options = {}) {
        if (typeof mapper !== 'function') {
          options = mapper;
          mapper = (x) => x;
        }
      Severity: Minor
      Found in @tunnckocore/p-all/src/index.js - About 1 hr to fix

        Function exports has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = utils.errorBase('UsefulError', function (message, options) {
          if (typeof message === 'object') {
            options = message;
            message = false;
          }
        Severity: Minor
        Found in modules/formidable-mini/fixture.js - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

            if (err && has && !err.cmdUsage) {
              const isRootFailed = /ROOT_COMMAND_FAILED/.test(err.code);
              const cmdErr = err.meta.matchedCommand?.cli || meta.cliInfo;
          
              cmdErr.usage = cmdErr.usage.trim();
          Severity: Major
          Found in yaro/yaro-create-cli/src/utils.js - About 1 hr to fix

            Function stringToHeader has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export function stringToHeader(val, options) {
              const opts = { caseSensitive: false, ...options };
            
              /* eslint-disable unicorn/no-unsafe-regex */
              const defaultRegex = opts.caseSensitive
            Severity: Minor
            Found in @packages/parse-commit-message/src/utils.js - 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 parseFunction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function parseFunction(opts = {}) {
              const plugins = [];
              const app = {
                /**
                 * > Parse a given `code` and returns a `result` object
            Severity: Minor
            Found in @packages/parse-function/src/index.js - 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 stringifyGithubShortUrl has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function stringifyGithubShortUrl(owner, name, branch, npm) {
              if (owner && typeof owner === 'object') {
                const params = owner;
                owner = params.owner || params.user;
                name = params.name || params.repo;
            Severity: Minor
            Found in @packages/stringify-github-short-url/src/index.js - 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 tryCatch has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            async function tryCatch(code, meta, fn) {
              let result = null;
              try {
                result = await fn(meta.argv);
              } catch (err) {
            Severity: Minor
            Found in yaro/yaro-create-cli/src/index.js - 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 testCoverage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            function testCoverage(rootDir, testCovPath) {
              const {
                packageJsonPath,
                packageJson: pkg,
                isMonorepo: isMono,
            Severity: Minor
            Found in @tunnckocore/utils/src/index.js - 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

            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-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-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

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

                  for (const name of wspc.packages) {
                    if (!res.has(name) && packages.includes(name)) {
                      res.set(name, wspc.graph[name]);
                    }
                  }
            Severity: Minor
            Found in @hela/preset-workspaces/src/commands/publish.js and 1 other location - About 55 mins to fix
            @hela/preset-workspaces/src/commands/version.js on lines 83..87

            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

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

                  for (const name of wspc.packages) {
                    if (!res.has(name) && names.includes(name)) {
                      res.set(name, wspc.graph[name]);
                    }
                  }
            Severity: Minor
            Found in @hela/preset-workspaces/src/commands/version.js and 1 other location - About 55 mins to fix
            @hela/preset-workspaces/src/commands/publish.js on lines 78..82

            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 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

            Severity
            Category
            Status
            Source
            Language