Showing 571 of 571 total issues

Function normalizeCommandsHelper has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    const normalizeCommandsHelper = (newCommands, existingCommands = {}, oldPath = '') => {
        const localCommands = { ...newCommands };
        Object.keys(localCommands).forEach((command) => {
            const newPath = oldPath + command;

Severity: Minor
Found in src/context/extensions/helpers/processCommands.js - About 1 hr to fix

    Function isObject has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function isObject(...args) {
        const validator = isPlainObject(args[0]) ? undefined : args[0];
        const { unmanaged = false } = (isPlainObject(args[0]) ? args[0] : args[1]) || {};
    
        return (input, info) => {
    Severity: Minor
    Found in src/validation/validators/isObject.js - About 1 hr to fix

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

                  const settings = {
                      groupTitleWrapper: (groupName, level) => `${pad(level + 3, '#')} ${
                          groupName.charAt(0).toUpperCase() + groupName.slice(1)
                      }`,
                  };
      Severity: Major
      Found in src/documentation/markdown/hooksToMarkdown.js and 1 other location - About 1 hr to fix
      src/documentation/markdown/commandsToMarkdown.js on lines 37..40

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

      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 40 lines of code (exceeds 25 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 1 hr to fix

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

        const settings = {
            groupTitleWrapper: (groupName, level) => `${pad(level + 3, '#')} ${
                groupName.charAt(0).toUpperCase() + groupName.slice(1)}`,
        };
        Severity: Major
        Found in src/documentation/markdown/commandsToMarkdown.js and 1 other location - About 1 hr to fix
        src/documentation/markdown/hooksToMarkdown.js on lines 133..137

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

        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 handle collisions when the wrong override has been provided', () => {
                            const initalStateCommands = normalizeCommands('test', '/path', commandsObject);
                            expect(() => processCommands('test2', '/path2', {
                                run: {
                                    command: 'git status',
        Severity: Major
        Found in test/context/extensions/helpers/processCommands.js and 1 other location - About 1 hr to fix
        test/context/extensions/helpers/processCommands.js on lines 189..197

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

        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 handle collisions when the wrong override has been provided', () => {
                            const initalStateCommands = normalizeCommands('test', '/path', commandsObject);
                            expect(() => processCommands('test2', '/path2', {
                                run: {
                                    command: 'git status',
        Severity: Major
        Found in test/context/extensions/helpers/processCommands.js and 1 other location - About 1 hr to fix
        test/context/extensions/helpers/processCommands.js on lines 179..187

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

        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 function error(label, text) {
            const title = text ? `  ${red(text)}` : '';
            return bgRed(white(`  ${label}  `)) + title;
        }
        Severity: Major
        Found in src/log/helpers/labels.js and 2 other locations - About 1 hr to fix
        src/log/helpers/labels.js on lines 27..30
        src/log/helpers/labels.js on lines 40..43

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

        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 function warn(label, text) {
            const title = text ? `  ${yellow(text)}` : '';
            return bgYellow(black(`  ${label}  `)) + title;
        }
        Severity: Major
        Found in src/log/helpers/labels.js and 2 other locations - About 1 hr to fix
        src/log/helpers/labels.js on lines 14..17
        src/log/helpers/labels.js on lines 40..43

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

        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 function log(label, text) {
            const title = text ? `  ${green(text)}` : '';
            return bgGreen(white(`  ${label}  `)) + title;
        }
        Severity: Major
        Found in src/log/helpers/labels.js and 2 other locations - About 1 hr to fix
        src/log/helpers/labels.js on lines 14..17
        src/log/helpers/labels.js on lines 27..30

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

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

        export default function settingsToText({ settings }, { settings: meta }, filter = []) {
            const documentationObject = sortOnProperty('name', buildDocumentationObject(settings, meta, filter));
        
            const header = {
                description: {
        Severity: Minor
        Found in src/documentation/text/settingsToText.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 parseArguments has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export default function parseArguments(command, commands = {}, args) {
            // If the command supports options
            if (commands[command] && commands[command].arguments) {
                const parsedArguments = {};
                objectToArray(commands[command].arguments).forEach((argument, index) => {
        Severity: Minor
        Found in src/cli/commands/parseArguments.js - About 1 hr to fix

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

                      expect([...data].sort(onProperty('a')))
                          .toEqual([{
                              a: 1,
                              b: 'e',
                              c: 3,
          Severity: Major
          Found in test/helpers/onProperty.js and 2 other locations - About 1 hr to fix
          test/helpers/onProperty.js on lines 29..38
          test/helpers/onProperty.js on lines 40..49

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

          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

                      expect([...data].sort(onProperty('b')))
                          .toEqual([{
                              a: 3,
                              b: 'e',
                              c: 1,
          Severity: Major
          Found in test/helpers/onProperty.js and 2 other locations - About 1 hr to fix
          test/helpers/onProperty.js on lines 18..27
          test/helpers/onProperty.js on lines 40..49

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

          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

                      expect([...data].sort(onProperty('c')))
                          .toEqual([{
                              a: 3,
                              b: 'e',
                              c: 1,
          Severity: Major
          Found in test/helpers/onProperty.js and 2 other locations - About 1 hr to fix
          test/helpers/onProperty.js on lines 18..27
          test/helpers/onProperty.js on lines 29..38

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

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

          export default function extensionsToMarkdown(name, usedExtensions = [], commandObject, extension) {
              const rows = [];
          
              const packages = usedExtensions.filter((extn) => extn.type === 'package' &&
                  // Do no list the package itself, this is based on the name of the extension and the current name of the
          Severity: Minor
          Found in src/documentation/markdown/extensionsToMarkdown.js - About 1 hr to fix

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

                    afterEach(() => {
                        logErrorSpy.restore();
                        logInfoSpy.restore();
                        global.roc.context.config = undefined;
                        delete process.env.ROC_CONFIG_SETTINGS;
            Severity: Major
            Found in test/configuration/manageConfig.js and 1 other location - About 1 hr to fix
            test/configuration/manageSettings.js on lines 23..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 64.

            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

                    afterEach(() => {
                        logErrorSpy.restore();
                        logInfoSpy.restore();
                        global.roc.context.config = undefined;
                        delete process.env.ROC_CONFIG_SETTINGS;
            Severity: Major
            Found in test/configuration/manageSettings.js and 1 other location - About 1 hr to fix
            test/configuration/manageConfig.js on lines 23..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 64.

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

            export default function createReadme(name, dir, extension, commandObject) {
                const projectExtensions = commandObject.context.projectExtensions;
                const rows = [];
            
                rows.push(`# ${name}`, '');
            Severity: Minor
            Found in src/documentation/markdown/createReadme.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 getCompleteExtension has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getCompleteExtension(extensionPath) {
                const getPathAndPackageJSON = (path) => {
                    const dir = dirname(path);
                    if (dir === path) {
                        throw new Error(`Could not find package.json for the extension at ${extensionPath}`);
            Severity: Minor
            Found in src/context/extensions/steps/getExtensions.js - About 1 hr to fix
              Severity
              Category
              Status
              Source
              Language