Showing 571 of 571 total issues

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

describe('documentation', () => {
    describe('markdown', () => {
        describe('actionsToMarkdown', () => {
            it('should correctly format actions when no actions', () => {
                expect(actionsToMarkdown('name'))
Severity: Major
Found in test/documentation/markdown/actionsToMarkdown.js and 1 other location - About 1 day to fix
test/documentation/markdown/hooksToMarkdown.js on lines 10..35

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

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

describe('documentation', () => {
    describe('markdown', () => {
        describe('hooksToMarkdown', () => {
            it('should correctly format hooks when no hooks', () => {
                expect(hooksToMarkdown('name'))
Severity: Major
Found in test/documentation/markdown/hooksToMarkdown.js and 1 other location - About 1 day to fix
test/documentation/markdown/actionsToMarkdown.js on lines 10..35

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

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

export default function processRocObject(
    { roc, newContext = {} },
    state,
    allowNewDependencies = true,
    allowUpdateDependencies = true,
Severity: Minor
Found in src/context/extensions/helpers/processRocObject.js - About 7 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

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

    if (plugins.length > 0) {
        plugins.forEach((plugin) => {
            rows.push(`### ${plugin.name} — [v${plugin.version}](https://www.npmjs.com/package/${plugin.name})`);
            const description = isFunction(plugin.description) ?
                plugin.description(commandObject, extension) :
Severity: Major
Found in src/documentation/markdown/extensionsToMarkdown.js and 1 other location - About 6 hrs to fix
src/documentation/markdown/extensionsToMarkdown.js on lines 22..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 167.

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

    if (packages.length > 0) {
        packages.forEach((pkg) => {
            rows.push(`### ${pkg.name} — [v${pkg.version}](https://www.npmjs.com/package/${pkg.name})`);
            const description = isFunction(pkg.description) ?
                pkg.description(commandObject, extension) :
Severity: Major
Found in src/documentation/markdown/extensionsToMarkdown.js and 1 other location - About 6 hrs to fix
src/documentation/markdown/extensionsToMarkdown.js on lines 40..55

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

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

export default function createResolveRequest(exports, directory, dependencyContext) {
    const log = require('debug')('roc:core:require'); // eslint-disable-line

    const contextCache = {};
    // Matches a module request, getting the module and a possible scope
Severity: Minor
Found in src/require/createResolveRequest.js - About 6 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

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

                    expect(normalizeCommands('test', '/path', commandsObject)).toEqual({
                        meta: {
                            docs: {
                                command: commandsObject.meta.docs.command,
                                __context: '/path',
Severity: Major
Found in test/context/extensions/helpers/processCommands.js and 1 other location - About 5 hrs to fix
test/context/extensions/helpers/processCommands.js on lines 67..106

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

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

                    expect(normalizeCommands('test', '/path', commandsObject, initalStateCommands)).toEqual({
                        meta: {
                            docs: {
                                command: commandsObject.meta.docs.command,
                                __context: '/path',
Severity: Major
Found in test/context/extensions/helpers/processCommands.js and 1 other location - About 5 hrs to fix
test/context/extensions/helpers/processCommands.js on lines 23..62

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

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

        if (plugins.length > 0) {
            plugins.forEach((plugin) => {
                rows.push(`#### ${plugin.name} — [v${plugin.version}](https://www.npmjs.com/package/${plugin.name})`);
                const description = isFunction(plugin.description) ?
                    plugin.description(commandObject, extension) :
Severity: Major
Found in src/documentation/markdown/createReadme.js and 1 other location - About 5 hrs to fix
src/documentation/markdown/createReadme.js on lines 33..44

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

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

        if (packages.length > 0) {
            packages.forEach((pkg) => {
                rows.push(`#### ${pkg.name} — [v${pkg.version}](https://www.npmjs.com/package/${pkg.name})`);
                const description = isFunction(pkg.description) ?
                    pkg.description(commandObject, extension) :
Severity: Major
Found in src/documentation/markdown/createReadme.js and 1 other location - About 5 hrs to fix
src/documentation/markdown/createReadme.js on lines 47..58

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

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 createResolveRequest has 133 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function createResolveRequest(exports, directory, dependencyContext) {
    const log = require('debug')('roc:core:require'); // eslint-disable-line

    const contextCache = {};
    // Matches a module request, getting the module and a possible scope
Severity: Major
Found in src/require/createResolveRequest.js - About 5 hrs to fix

    Function initContext has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function initContext({
        verbose = false,
        commands: baseCommands = {},
        directory = process.cwd(),
        projectConfigPath,
    Severity: Minor
    Found in src/context/initContext.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 getExtensions.js has 362 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { _findPath } from 'module';
    import { join, dirname, isAbsolute } from 'path';
    
    import resolve from 'resolve';
    import { bold, underline } from 'chalk';
    Severity: Minor
    Found in src/context/extensions/steps/getExtensions.js - About 4 hrs to fix

      Function buildCommand has 115 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function buildCommand(cli, command, commandData, allSettingGroups, printGroup, parents, level) {
          let rows = [];
      
          rows.push(`##${'#'.repeat(level)} ${command}`);
      
      
      Severity: Major
      Found in src/documentation/markdown/commandsToMarkdown.js - About 4 hrs to fix

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

        describe('helpers', () => {
            describe('getRocPackageDependencies', () => {
                it('should correctly fetch all the Roc dependencies', () => {
                    const packageJson = {
                        dependencies: {
        Severity: Major
        Found in test/helpers/getRocPackageDependencies.js and 1 other location - About 4 hrs to fix
        test/helpers/getRocPluginDependencies.js on lines 5..26

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

        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

        describe('helpers', () => {
            describe('getRocPluginDependencies', () => {
                it('should correctly fetch all the Roc dependencies', () => {
                    const packageJson = {
                        dependencies: {
        Severity: Major
        Found in test/helpers/getRocPluginDependencies.js and 1 other location - About 4 hrs to fix
        test/helpers/getRocPackageDependencies.js on lines 5..26

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

        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 hooksToMarkdown has 105 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function hooksToMarkdown(name, hooks = {}, mode) {
            const rows = [];
        
            rows.push(`# Hooks for \`${name}\``, '');
        
        
        Severity: Major
        Found in src/documentation/markdown/hooksToMarkdown.js - About 4 hrs to fix

          Function buildCommand has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

          function buildCommand(cli, command, commandData, allSettingGroups, printGroup, parents, level) {
              let rows = [];
          
              rows.push(`##${'#'.repeat(level)} ${command}`);
          
          
          Severity: Minor
          Found in src/documentation/markdown/commandsToMarkdown.js - About 3 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

          Function generateCommandDocumentation has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
          Open

          export default function generateCommandDocumentation(settings, metaSettings, metaCommands, command, name, parents) {
              const rows = [];
              rows.push(`Usage: ${name} ${parents.concat(command).join(' ')}` +
                  getCommandArgumentsAsString(metaCommands[command]));
              rows.push('');
          Severity: Minor
          Found in src/cli/commands/documentation/generateCommandDocumentation.js - About 3 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

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

                  it('should manage CommonJS default exports', () => {
                      delete require.cache[require.resolve('./fixtures/lazyFunctionRequire/1')];
          
                      const lazyFunction = lazyFunctionRequire(require)('./fixtures/lazyFunctionRequire/1');
                      expect(global.lazyFunctionRequire).toBe(undefined);
          Severity: Major
          Found in test/helpers/lazyFunctionRequire.js and 1 other location - About 3 hrs to fix
          test/helpers/lazyFunctionRequire.js on lines 24..31

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

          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