CleverStack/cleverstack-cli

View on GitHub

Showing 84 of 84 total issues

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

  if (!!program.verbose || process.mainModule.filename.match('build')) {
    readline
      .createInterface({
        input    : posixProc.stdout,
        terminal : false
Severity: Major
Found in lib/util/bower.js and 1 other location - About 1 hr to fix
lib/project.js on lines 170..179

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

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

        function installNpmDependencies(callback) {
          var opts = {cwd: moduleDir, env: process.env}
            , args = ['install', '--prefix', projectFolder].concat(deps)
            , cmd  = !isWin ? 'npm' : 'npm.cmd';

Severity: Minor
Found in lib/project.js - About 1 hr to fix

    Function runDBMigrations has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function runDBMigrations(projectFolder) {
      lib.utils.warn('Running database migrations...');
    
      return new Promise(function(resolve, reject) {
        var env        = process.env
    Severity: Minor
    Found in lib/util/grunt.js - About 1 hr to fix

      Function get has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var get = exports.get = function( useCWD, fn ) {
        return new Promise( function( resolve, reject ) {
          if ( typeof useCWD === 'function' ) {
            fn      = useCWD;
            useCWD  = false;
      Severity: Minor
      Found in lib/util/locations.js - About 1 hr to fix

        Function checkFiles has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.checkFiles = function(project, dirs, tmpls, names) {
          return new Promise(function(resolve, reject) {
            var found = false;
        
            async.each(
        Severity: Minor
        Found in lib/generate/fs.js - About 1 hr to fix

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

          function addPeerDependenciesToMain(backendPath) {
            return new Promise(function(resolve, reject) {
              var pkgPath      = path.join(backendPath.moduleDir, 'package.json')
                , projectPkg   = require(pkgPath)
                , dependencies = {}
          Severity: Minor
          Found in lib/util/dependencies.js - About 1 hr to fix

            Function installWithNpm has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.installWithNpm = function(location, packages) {
              return new Promise(function(resolve, reject) {
                async.each(
                  packages,
                  function(pkg, next) {
            Severity: Minor
            Found in lib/packages.js - About 1 hr to fix

              Function walkChildren has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function walkChildren( list, seedFound, callback ) {
                        var newList = [];
              
                        if ( !!seedFound ) {
                          newList.push( seedFound );
              Severity: Minor
              Found in lib/util/locations.js - About 1 hr to fix

                Function eachFile has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            function eachFile(dir, __next) {
                              var _files        = []
                                , templateHome  = paths.getTemplatePath(project, tmpl)
                                , finder        = require('findit')(templateHome);
                
                
                Severity: Minor
                Found in lib/generate/render.js - About 1 hr to fix

                  Function scaffold has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports.scaffold = function(name, filterOut, fn) {
                    name      = Array.isArray(name) ? name : [ name ];
                    filterOut = Array.isArray(filterOut) ? filterOut : [];
                  
                    // Just for easability, we'll add an 's' to the end of the filters to cover a quasi-plural form
                  Severity: Minor
                  Found in lib/generator.js - About 1 hr to fix

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

                      Modules.prototype.action = function() {
                        if (!this.table.length) {
                          this.indexModules();
                        }
                    
                    
                    Severity: Major
                    Found in lib/repl/commands/modules.js and 3 other locations - About 1 hr to fix
                    lib/repl/commands/commands.js on lines 32..38
                    lib/repl/commands/models.js on lines 71..77
                    lib/repl/commands/services.js on lines 61..67

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

                      Services.prototype.action = function() {
                        if (!this.table.length) {
                          this.indexServices();
                        }
                    
                    
                    Severity: Major
                    Found in lib/repl/commands/services.js and 3 other locations - About 1 hr to fix
                    lib/repl/commands/commands.js on lines 32..38
                    lib/repl/commands/models.js on lines 71..77
                    lib/repl/commands/modules.js on lines 34..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 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 4 locations. Consider refactoring.
                    Open

                      Commands.prototype.action = function() {
                        if (!this.table.length) {
                          this.indexCommands();
                        }
                    
                    
                    Severity: Major
                    Found in lib/repl/commands/commands.js and 3 other locations - About 1 hr to fix
                    lib/repl/commands/models.js on lines 71..77
                    lib/repl/commands/modules.js on lines 34..40
                    lib/repl/commands/services.js on lines 61..67

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

                      Models.prototype.action = function() {
                        if (!this.table.length) {
                          this.indexModels();
                        }
                    
                    
                    Severity: Major
                    Found in lib/repl/commands/models.js and 3 other locations - About 1 hr to fix
                    lib/repl/commands/commands.js on lines 32..38
                    lib/repl/commands/modules.js on lines 34..40
                    lib/repl/commands/services.js on lines 61..67

                    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

                    Function findAvailableCommands has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    exports.findAvailableCommands = function ( ) {
                      return new Promise( function( resolve, reject ) {
                        get()
                          .then( function( locations ) {
                            var useNPM    = false
                    Severity: Minor
                    Found in lib/util/locations.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 exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function(Table, env, lib, repl, local) {
                      function Commands() {
                        this.help    = 'Lists all of the REPL commands';
                        this.aliases = ['h', 'help'];
                        this.table   = new Table({
                    Severity: Minor
                    Found in lib/repl/commands/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 exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports = function (thePath, program, cmd, args) {
                      if (arguments.length < 4) {
                        args    = cmd;
                        cmd     = program;
                        program = require(path.join(__dirname, 'program'));
                    Severity: Minor
                    Found in lib/command.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

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

                        Object.keys(jsonFile.dependencies).forEach(function(k) {
                          deps.push(k + '@' + jsonFile.dependencies[ k ]);
                        });
                    Severity: Major
                    Found in lib/project.js and 1 other location - About 1 hr to fix
                    lib/project.js on lines 148..150

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

                    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

                        Object.keys(jsonFile.devDependencies).forEach(function(k) {
                          deps.push(k + '@' + jsonFile.devDependencies[ k ]);
                        });
                    Severity: Major
                    Found in lib/project.js and 1 other location - About 1 hr to fix
                    lib/project.js on lines 144..146

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

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

                    exports.install = function(modulePath, options, fn) {
                      var additionalOptions = [ ]
                        , params = { cwd: modulePath };
                    
                      if (typeof options === 'function') {
                    Severity: Minor
                    Found in lib/util/bower.js - About 55 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

                    Severity
                    Category
                    Status
                    Source
                    Language