Showing 571 of 571 total issues

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

            it('should correctly format config for project complex', () => {
                const project = join(__dirname, '..', 'fixtures', 'projects', 'complex');
                const context = getContext(project);

                expect(configurationToMarkdown('complex', context.extensionConfig, context.meta))
Severity: Major
Found in test/documentation/markdown/configurationToMarkdown.js and 1 other location - About 2 hrs to fix
test/documentation/markdown/configurationToMarkdown.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 83.

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 config for project empty', () => {
                const project = join(__dirname, '..', 'fixtures', 'projects', 'empty');
                const context = getContext(project);

                expect(configurationToMarkdown('empty', context.extensionConfig, context.meta))
Severity: Major
Found in test/documentation/markdown/configurationToMarkdown.js and 1 other location - About 2 hrs to fix
test/documentation/markdown/configurationToMarkdown.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 83.

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

                const initAction = (currentAction) => (post = false) => {
                    // Run actions in a semi-managed way
                    let step = 'first';
                    try {
                        const createAction = currentAction({
Severity: Major
Found in src/hooks/runHookDirectly.js - About 2 hrs to fix

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

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

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

    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 ROC.md for project empty', () => {
                    const project = join(__dirname, '..', 'fixtures', 'projects', 'empty');
                    const context = getContext(project, defaultCommands);
    
                    expect(createReadme('empty', 'docs', false, { context }))
    Severity: Major
    Found in test/documentation/markdown/createReadme.js and 1 other location - About 2 hrs to fix
    test/documentation/markdown/createReadme.js on lines 22..28

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

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

    export default function dependenciesToMarkdown(name, extension, dependencies = {}) {
        const rows = [];
    
        rows.push(`# Dependencies for \`${name}\``, '');
    
    
    Severity: Major
    Found in src/documentation/markdown/dependenciesToMarkdown.js - About 2 hrs to fix

      File commandsToMarkdown.js has 261 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import redent from 'redent';
      import stripAnsi from 'strip-ansi';
      import trimNewlines from 'trim-newlines';
      
      import generateTable from '../generateTable';
      Severity: Minor
      Found in src/documentation/markdown/commandsToMarkdown.js - About 2 hrs to fix

        Function getDefaultCommands has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getDefaultCommands(directory) {
            if (directory === undefined || validRocProject(directory)) {
                return {
                    meta: {
                        __meta: {
        Severity: Major
        Found in src/context/helpers/getDefaults.js - About 2 hrs to fix

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

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

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

          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 dependencies for project complex', () => {
                          const project = join(__dirname, '..', 'fixtures', 'projects', 'complex');
                          const context = getContext(project);
          
                          expect(dependenciesToMarkdown('complex', true, context.dependencies))
          Severity: Major
          Found in test/documentation/markdown/dependenciesToMarkdown.js and 1 other location - About 2 hrs to fix
          test/documentation/markdown/dependenciesToMarkdown.js on lines 18..24

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

          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 3 locations. Consider refactoring.
          Open

          export default function isRegExp(value, info) {
              if (info) {
                  return createInfoObject({
                      validator: 'RegExp',
                      converter: () => toRegExp,
          Severity: Major
          Found in src/validation/validators/isRegExp.js and 2 other locations - About 2 hrs to fix
          src/validation/validators/isBoolean.js on lines 13..26
          src/validation/validators/isInteger.js on lines 13..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 77.

          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 3 locations. Consider refactoring.
          Open

          export default function isBoolean(value, info) {
              if (info) {
                  return createInfoObject({
                      validator: 'Boolean',
                      converter: () => toBoolean,
          Severity: Major
          Found in src/validation/validators/isBoolean.js and 2 other locations - About 2 hrs to fix
          src/validation/validators/isInteger.js on lines 13..26
          src/validation/validators/isRegExp.js on lines 13..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 77.

          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

                  const packages =
                      context.packageJSON.roc && context.packageJSON.roc.packages && context.packageJSON.roc.packages.length ?
                          context.packageJSON.roc.packages :
                          getRocPackageDependencies(context.packageJSON);
          Severity: Major
          Found in src/context/initContext.js and 1 other location - About 2 hrs to fix
          src/context/initContext.js on lines 68..71

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

          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 3 locations. Consider refactoring.
          Open

          export default function isInteger(value, info) {
              if (info) {
                  return createInfoObject({
                      validator: 'Integer',
                      converter: () => toInteger,
          Severity: Major
          Found in src/validation/validators/isInteger.js and 2 other locations - About 2 hrs to fix
          src/validation/validators/isBoolean.js on lines 13..26
          src/validation/validators/isRegExp.js on lines 13..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 77.

          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

                  const plugins =
                      context.packageJSON.roc && context.packageJSON.roc.plugins && context.packageJSON.roc.plugins.length ?
                          context.packageJSON.roc.plugins :
                          getRocPluginDependencies(context.packageJSON);
          Severity: Major
          Found in src/context/initContext.js and 1 other location - About 2 hrs to fix
          src/context/initContext.js on lines 63..66

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

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

          export default function keyboardDistance(char, possible = []) {
              if (char.length > 1) {
                  throw new Error('First argument must be a single character.');
              }
          
          
          Severity: Minor
          Found in src/helpers/keyboardDistance.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 build has 52 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function build(cli, commands, allSettingGroups, printGroup, hideCommands, statefulAnchor, parents = [], level = 0) {
              let tableOfContent = [];
              let content = [];
          
              Object.keys(commands)
          Severity: Major
          Found in src/documentation/markdown/commandsToMarkdown.js - About 2 hrs to fix

            Function createReadme has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function createReadme(name, dir, extension, commandObject) {
                const projectExtensions = commandObject.context.projectExtensions;
                const rows = [];
            
                rows.push(`# ${name}`, '');
            Severity: Major
            Found in src/documentation/markdown/createReadme.js - About 2 hrs to fix

              Function getProjectConfig has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function getProjectConfig(projectConfigPath, directory = process.cwd(), verbose = false) {
                  if (projectConfigPath === false) {
                      return {};
                  }
              
              
              Severity: Major
              Found in src/configuration/getProjectConfig.js - About 2 hrs to fix

                Function resolveRequestAsync has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function resolveRequestAsync(identifier = 'No identifier') {
                        const resolveCache = {};
                        const defaultResolver = (request, context, callback) => resolve(request, { basedir: context }, callback);
                        const completeResolve = (callback, request, module) => (error, newRequest) => {
                            if (error) {
                Severity: Minor
                Found in src/require/createResolveRequest.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language