meteor/meteor

View on GitHub
tools/cli/commands.js

Summary

Maintainability
F
2 wks
Test Coverage

File commands.js has 2245 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var main = require('./main.js');
var _ = require('underscore');
var files = require('../fs/files');
var deploy = require('../meteor-services/deploy.js');
var buildmessage = require('../utils/buildmessage.js');
Severity: Major
Found in tools/cli/commands.js - About 6 days to fix

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

    var buildCommand = function (options) {
      Console.setVerbose(!!options.verbose);
      if (options.headless) {
        // There's no point in spinning the spinner when we're running
        // automated builds.
    Severity: Major
    Found in tools/cli/commands.js - About 7 hrs to fix

      Function doTestCommand has 171 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function doTestCommand(options) {
        // This "metadata" is accessed in a few places. Using a global
        // variable here was more expedient than navigating the many layers
        // of abstraction across the the build process.
        //
      Severity: Major
      Found in tools/cli/commands.js - About 6 hrs to fix

        Function doTestCommand has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
        Open

        function doTestCommand(options) {
          // This "metadata" is accessed in a few places. Using a global
          // variable here was more expedient than navigating the many layers
          // of abstraction across the the build process.
          //
        Severity: Minor
        Found in tools/cli/commands.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

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

        var buildCommand = function (options) {
          Console.setVerbose(!!options.verbose);
          if (options.headless) {
            // There's no point in spinning the spinner when we're running
            // automated builds.
        Severity: Minor
        Found in tools/cli/commands.js - About 4 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 doRunCommand has 108 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function doRunCommand(options) {
          Console.setVerbose(!!options.verbose);
        
          // Additional args are interpreted as run targets
          const runTargets = parseRunTargets(options.args);
        Severity: Major
        Found in tools/cli/commands.js - About 4 hrs to fix

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

          function doRunCommand(options) {
            Console.setVerbose(!!options.verbose);
          
            // Additional args are interpreted as run targets
            const runTargets = parseRunTargets(options.args);
          Severity: Minor
          Found in tools/cli/commands.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 runTestAppForPackages has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var runTestAppForPackages = function (projectContext, options) {
            var buildOptions = {
              minifyMode: options.production ? 'production' : 'development'
            };
            buildOptions.buildMode = "test";
          Severity: Major
          Found in tools/cli/commands.js - About 2 hrs to fix

            Function runTestAppForPackages has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            var runTestAppForPackages = function (projectContext, options) {
              var buildOptions = {
                minifyMode: options.production ? 'production' : 'development'
              };
              buildOptions.buildMode = "test";
            Severity: Minor
            Found in tools/cli/commands.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 setup has 40 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              const setup = async () => {
                // meteor create app-name
                if (options.args.length === 1) {
                  const appPathAsEntered = options.args[0];
                  const skeletonExplicitOption =
            Severity: Minor
            Found in tools/cli/commands.js - About 1 hr to fix

              Function getTestPackageNames has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var getTestPackageNames = function (projectContext, packageNames) {
                var packageNamesSpecifiedExplicitly = ! _.isEmpty(packageNames);
                if (_.isEmpty(packageNames)) {
                  // If none specified, test all local packages. (We don't have tests for
                  // non-local packages.)
              Severity: Minor
              Found in tools/cli/commands.js - About 1 hr to fix

                Function deployCommand has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                function deployCommand(options, { rawOptions }) {
                  const site = options.args[0];
                
                  if (options.delete) {
                    return deploy.deleteApp(site);
                Severity: Minor
                Found in tools/cli/commands.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 normalizeInspectOptions has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function normalizeInspectOptions(options) {
                  const result = Object.create(null);
                
                  if (_.has(options, "debug-port")) {
                    console.log(
                Severity: Minor
                Found in tools/cli/commands.js - About 1 hr to fix

                  Function setup has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    const setup = async (arg0) => {
                      if (arg0 === undefined) {
                        const ask = createPrompt();
                        // the ANSI color chart is here: https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
                        const scaffoldName = await ask(`What is the name of your ${yellow`model`}? `);
                  Severity: Minor
                  Found in tools/cli/commands.js - About 1 hr to fix

                    Function normalizeInspectOptions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function normalizeInspectOptions(options) {
                      const result = Object.create(null);
                    
                      if (_.has(options, "debug-port")) {
                        console.log(
                    Severity: Minor
                    Found in tools/cli/commands.js - About 35 mins to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    Avoid too many return statements within this function.
                    Open

                          return 1;
                    Severity: Major
                    Found in tools/cli/commands.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        return selftest.runTests({
                          // filtering options
                          onlyChanged: options.changed,
                          offline: offline,
                          includeSlowTests: options.slow,
                      Severity: Major
                      Found in tools/cli/commands.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return 1;
                        Severity: Major
                        Found in tools/cli/commands.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return 0;
                          Severity: Major
                          Found in tools/cli/commands.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return deploy.listAuthorized(site);
                            Severity: Major
                            Found in tools/cli/commands.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return 0;
                              Severity: Major
                              Found in tools/cli/commands.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return 0;
                                Severity: Major
                                Found in tools/cli/commands.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return deploy.changeAuthorized(site, "transfer", options.transfer);
                                  Severity: Major
                                  Found in tools/cli/commands.js - About 30 mins to fix

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

                                        onBuilt: function () {
                                          // Opens a browser window when it finishes building
                                          if (options.open) {
                                            console.log("=> Opening your app in a browser...");
                                            if (process.env.ROOT_URL) {
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 2 hrs to fix
                                    tools/cli/commands.js on lines 2248..2258

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

                                    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

                                          onBuilt: function () {
                                            // Opens a browser window when it finishes building
                                            if (options.open) {
                                              console.log("=> Opening your app in a browser...");
                                              if (process.env.ROOT_URL) {
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 2 hrs to fix
                                    tools/cli/commands.js on lines 470..480

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

                                    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 toCamelCase = (str) => {
                                        if(!str.includes('-')) return str.charAt(0).toLowerCase() + str.slice(1);
                                        else return str.split('-').map(toPascalCase).join('');
                                      }
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 2 hrs to fix
                                    tools/cli/commands.js on lines 2813..2816

                                    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

                                      const toPascalCase = (str) => {
                                        if(!str.includes('-')) return str.charAt(0).toUpperCase() + str.slice(1);
                                        else return str.split('-').map(toPascalCase).join('');
                                      }
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 2 hrs to fix
                                    tools/cli/commands.js on lines 2817..2820

                                    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

                                        if (typeof replaceFn !== 'function') {
                                          Console.error(red`You must provide a valid function transformContents.`);
                                          Console.error(yellow`The function should be named transformContents and should be exported.`);
                                          throw new main.ExitWithCode(2);
                                        }
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 1 hr to fix
                                    tools/cli/commands.js on lines 2786..2790

                                    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

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

                                        if (typeof replaceFn !== 'function') {
                                          Console.error(red`You must provide a valid function transformFilename.`);
                                          Console.error(yellow`The function should be named transformFilename and should be exported.`);
                                          throw new main.ExitWithCode(2);
                                        }
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 1 hr to fix
                                    tools/cli/commands.js on lines 2800..2804

                                    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

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

                                      var projectContext = new projectContextModule.ProjectContext({
                                        projectDir: options.appDir,
                                        serverArchitectures: _.uniq([bundleArch, archinfo.host()]),
                                        allowIncompatibleUpdate: options['allow-incompatible-update']
                                      });
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 1 hr to fix
                                    tools/cli/commands.js on lines 1669..1673

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 57.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

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

                                          const arePublications = await ask(`There will be publications [${green`Y`}/${red`n`}]? press enter for ${green`yes`}  `);
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 1 hr to fix
                                    tools/cli/commands.js on lines 2720..2720

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 57.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

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

                                          const areMethods = await ask(`There will be methods [${green`Y`}/${red`n`}]? press enter for ${green`yes`}  `);
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 1 hr to fix
                                    tools/cli/commands.js on lines 2722..2722

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 57.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

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

                                      const projectContext = new projectContextModule.ProjectContext({
                                        projectDir: options.appDir,
                                        serverArchitectures: _.uniq([buildArch, archinfo.host()]),
                                        allowIncompatibleUpdate: options['allow-incompatible-update']
                                      });
                                    Severity: Major
                                    Found in tools/cli/commands.js and 1 other location - About 1 hr to fix
                                    tools/cli/commands.js on lines 1101..1105

                                    Duplicated Code

                                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                    Tuning

                                    This issue has a mass of 57.

                                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                    Refactorings

                                    Further Reading

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

                                        console.log(`${yellow`$`} ${ purple`mongosh` } ${ blue(mongoUrl) }`);
                                    Severity: Minor
                                    Found in tools/cli/commands.js and 1 other location - About 45 mins to fix
                                    tools/cli/commands.js on lines 1508..1512

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

                                    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

                                            console.log(`
                                         Since version v5.0.5 the mongo shell has been superseded by the mongosh
                                         below there is the url to use with mongosh
                                         ${yellow`$`} ${ purple`mongosh` } ${ blue(mongoUrl) }
                                         `)
                                    Severity: Minor
                                    Found in tools/cli/commands.js and 1 other location - About 45 mins to fix
                                    tools/cli/commands.js on lines 1497..1497

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

                                    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

                                      if (allNonWordRegex.test(scaffoldName)) {
                                        Console.error(red('You must provide a valid name for your model.'));
                                        Console.error(yellow('Model names should not contain special characters except _ and -'));
                                        throw new main.ExitWithCode(2);
                                      }
                                    Severity: Minor
                                    Found in tools/cli/commands.js and 2 other locations - About 30 mins to fix
                                    tools/cli/commands.js on lines 2678..2682
                                    tools/cli/commands.js on lines 2684..2688

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

                                    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

                                      if (scaffoldName === '') {
                                        Console.error(red('You must provide a name for your model.'));
                                        Console.error(yellow('Model names should not be empty.'));
                                        throw new main.ExitWithCode(2);
                                      }
                                    Severity: Minor
                                    Found in tools/cli/commands.js and 2 other locations - About 30 mins to fix
                                    tools/cli/commands.js on lines 2684..2688
                                    tools/cli/commands.js on lines 2691..2695

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

                                    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

                                      if (scaffoldName.includes('/')) {
                                        Console.error(red('You must provide a valid name for your model.'));
                                        Console.error(yellow('Model names should not contain slashes.'));
                                        throw new main.ExitWithCode(2);
                                      }
                                    Severity: Minor
                                    Found in tools/cli/commands.js and 2 other locations - About 30 mins to fix
                                    tools/cli/commands.js on lines 2678..2682
                                    tools/cli/commands.js on lines 2691..2695

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

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status