Showing 571 of 571 total issues

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

        it('should manage ES module default exports', () => {
            delete require.cache[require.resolve('./fixtures/lazyFunctionRequire/2')];

            const lazyFunction = lazyFunctionRequire(require)('./fixtures/lazyFunctionRequire/2');
            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 15..22

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

Function generateCommandDocumentation has 89 lines of code (exceeds 25 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: Major
Found in src/cli/commands/documentation/generateCommandDocumentation.js - About 3 hrs to fix

    Function runCli has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function runCli({
        info = { version: 'Unknown', name: 'Unknown' },
        commands: initialCommands,
        argv = process.argv,
        invoke = true,
    Severity: Minor
    Found in src/cli/runCli.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

        if (packageJSON.devDependencies) {
            Object.keys(packageJSON.devDependencies).forEach((dependency) => {
                if (
                    /alpha/.test(packageJSON.devDependencies[dependency]) &&
                    officialExtensions[dependency] !== packageJSON.devDependencies[dependency]
    src/context/dependencies/getAlphaExtensionsThatAreNotLocked.js on lines 54..63

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

    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 (packageJSON.dependencies) {
            Object.keys(packageJSON.dependencies).forEach((dependency) => {
                if (
                    /alpha/.test(packageJSON.dependencies[dependency]) &&
                    officialExtensions[dependency] !== packageJSON.dependencies[dependency]
    src/context/dependencies/getAlphaExtensionsThatAreNotLocked.js on lines 65..74

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

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

    export default function buildDocumentationObject(
        initalObject,
        initalMeta = {},
        initalFilter = [],
        markdown = false,
    Severity: Major
    Found in src/documentation/buildDocumentationObject.js - About 2 hrs to fix

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

      export default function getRocPluginDependencies(packageJSON) {
          return [
              ...Object.keys(packageJSON.dependencies || {}).sort(),
              ...Object.keys(packageJSON.devDependencies || {}).sort(),
          ]
      Severity: Major
      Found in src/helpers/getRocPluginDependencies.js and 1 other location - About 2 hrs to fix
      src/helpers/getRocPackageDependencies.js on lines 8..14

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

      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

      export default function getRocPackageDependencies(packageJSON) {
          return [
              ...Object.keys(packageJSON.dependencies || {}).sort(),
              ...Object.keys(packageJSON.devDependencies || {}).sort(),
          ]
      Severity: Major
      Found in src/helpers/getRocPackageDependencies.js and 1 other location - About 2 hrs to fix
      src/helpers/getRocPluginDependencies.js on lines 8..14

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

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

      function parseCommandOptions(command, notManaged) {
          let possibleCommandOptions = [];
          let possibleCommandOptionsShort = [];
          const parsedOptions = {
              managed: {},
      Severity: Major
      Found in src/cli/commands/parseOptions.js - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

                if (
                    !isAbstract(roc.name) &&
                    !roc.packages &&
                    !roc.plugins &&
                    !roc.hooks &&
        Severity: Critical
        Found in src/context/extensions/steps/getExtensions.js - About 2 hrs to fix

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

                              expect(processConfig('test', extension, { config: {}, meta: updatedMeta })).toEqual({
                                  settings: {
                                      group: {
                                          __extensions: [
                                              'test',
          Severity: Major
          Found in test/context/extensions/helpers/processConfig.js and 1 other location - About 2 hrs to fix
          test/context/extensions/helpers/processConfig.js on lines 31..64

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

          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(processConfig('test', extension, { config: {}, meta: {} })).toEqual({
                                  settings: {
                                      group: {
                                          __extensions: [
                                              'test',
          Severity: Major
          Found in test/context/extensions/helpers/processConfig.js and 1 other location - About 2 hrs to fix
          test/context/extensions/helpers/processConfig.js on lines 69..102

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

          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

                      it('should correctly format commands for project empty', () => {
                          const project = join(__dirname, '..', 'fixtures', 'projects', 'empty');
                          const context = getContext(project, defaultCommands);
          
                          expect(commandsToMarkdown('empty', context.extensionConfig, context.commands, '/docs/Settings.md'))
          Severity: Major
          Found in test/documentation/markdown/commandsToMarkdown.js and 1 other location - About 2 hrs to fix
          test/documentation/markdown/commandsToMarkdown.js on lines 27..33

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

          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

                      it('should correctly format extensions for project complex', () => {
                          const project = join(__dirname, '..', 'fixtures', 'projects', 'complex');
                          const context = getContext(project);
          
                          expect(extensionsToMarkdown('complex', context.usedExtensions, { context }))
          Severity: Major
          Found in test/documentation/markdown/extensionsToMarkdown.js and 1 other location - About 2 hrs to fix
          test/documentation/markdown/extensionsToMarkdown.js on lines 19..25

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

          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

                      it('should correctly format commands for project complex', () => {
                          const project = join(__dirname, '..', 'fixtures', 'projects', 'complex');
                          const context = getContext(project, defaultCommands);
          
                          expect(commandsToMarkdown('complex', context.extensionConfig, context.commands, '/docs/Settings.md'))
          Severity: Major
          Found in test/documentation/markdown/commandsToMarkdown.js and 1 other location - About 2 hrs to fix
          test/documentation/markdown/commandsToMarkdown.js on lines 19..25

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

          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

                      it('should correctly format extensions for project empty', () => {
                          const project = join(__dirname, '..', 'fixtures', 'projects', 'empty');
                          const context = getContext(project);
          
                          expect(extensionsToMarkdown('empty', context.usedExtensions, { context }))
          Severity: Major
          Found in test/documentation/markdown/extensionsToMarkdown.js and 1 other location - About 2 hrs to fix
          test/documentation/markdown/extensionsToMarkdown.js on lines 27..33

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

          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

                      it('should correctly format settings for project empty', () => {
                          const project = join(__dirname, '..', 'fixtures', 'projects', 'empty');
                          const context = getContext(project, defaultCommands);
          
                          expect(settingsToMarkdown('empty', context.extensionConfig, context.meta))
          Severity: Major
          Found in test/documentation/markdown/settingsToMarkdown.js and 1 other location - About 2 hrs to fix
          test/documentation/markdown/settingsToMarkdown.js on lines 27..33

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

          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

                      it('should correctly format settings for project complex', () => {
                          const project = join(__dirname, '..', 'fixtures', 'projects', 'complex');
                          const context = getContext(project, defaultCommands);
          
                          expect(settingsToMarkdown('complex', context.extensionConfig, context.meta))
          Severity: Major
          Found in test/documentation/markdown/settingsToMarkdown.js and 1 other location - About 2 hrs to fix
          test/documentation/markdown/settingsToMarkdown.js on lines 19..25

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

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

          export default function generateTable(initalDocumentationObject, header, settings) {
              const finalSettings = merge(defaultSettings, settings);
              const headerLengths = createLengthObject(header, header, {}, true);
              const lengths = createLengthObject(initalDocumentationObject, header, headerLengths);
          
          
          Severity: Minor
          Found in src/documentation/generateTable.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

          Function generateTable has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function generateTable(initalDocumentationObject, header, settings) {
              const finalSettings = merge(defaultSettings, settings);
              const headerLengths = createLengthObject(header, header, {}, true);
              const lengths = createLengthObject(initalDocumentationObject, header, headerLengths);
          
          
          Severity: Major
          Found in src/documentation/generateTable.js - About 2 hrs to fix
            Severity
            Category
            Status
            Source
            Language