CleverStack/cleverstack-cli

View on GitHub

Showing 60 of 84 total issues

Function find has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

var find = exports.find = function() {
  return new Promise( function( resolve, reject ) {
    var cwd      = process.cwd();

    lib.utils.running( 'Finding seeds to target...' );
Severity: Minor
Found in lib/util/locations.js - About 6 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 find has 116 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var find = exports.find = function() {
  return new Promise( function( resolve, reject ) {
    var cwd      = process.cwd();

    lib.utils.running( 'Finding seeds to target...' );
Severity: Major
Found in lib/util/locations.js - About 4 hrs to fix

    Function installModule has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    exports.installModule = function(project, modulePath) {
      return new Promise(function(resolve, reject) {
        var projectFolder   = project.moduleDir
          , moduleDir       = path.join(project.moduleDir, project.modulePath)
          , jsonPath        = path.resolve(path.join(modulePath, 'package.json'))
    Severity: Minor
    Found in lib/project.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 installModule has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.installModule = function(project, modulePath) {
      return new Promise(function(resolve, reject) {
        var projectFolder   = project.moduleDir
          , moduleDir       = path.join(project.moduleDir, project.modulePath)
          , jsonPath        = path.resolve(path.join(modulePath, 'package.json'))
    Severity: Major
    Found in lib/project.js - About 3 hrs to fix

      Function exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(Table, env, lib, repl, local, util, _) {
        var ormFuncs = [
          'all', 'find', 'create', 'update', 'describe', 'findAll', 'findOrCreate',
          'findAndCountAll', 'findAllJoin', 'findOrInitialize', 'findOrBuild', 'bulkCreate',
          'destroy', 'aggregate', 'build', 'count', 'min', 'max'
      Severity: Major
      Found in lib/repl/commands/models.js - About 2 hrs to fix

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

        module.exports = function(Table, env, lib, repl, local, util, _) {
          var serviceFuncs = ['find', 'findAll', 'create', 'update', 'destroy'];
        
          function Services() {
            this.help      = 'Lists all of the services within this project';
        Severity: Major
        Found in lib/repl/commands/services.js - About 2 hrs to fix

          Function installBowerComponents has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.installBowerComponents = function(projectFolder) {
            return new Promise(function(resolve, reject) {
              var bowerRC     = path.join(projectFolder.moduleDir, '.bowerrc')
                , _bowerRC    = fs.readFileSync(bowerRC);
          
          
          Severity: Major
          Found in lib/project.js - About 2 hrs to fix

            Function runTasks has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.runTasks = function(projectFolder, modulePath) {
              return new Promise(function(resolve, reject) {
                var originalCwd = process.cwd();
                process.chdir(projectFolder);
            
            
            Severity: Major
            Found in lib/util/grunt.js - About 2 hrs to fix

              Function installBackendModules has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function installBackendModules(backendPath, npm) {
                return new Promise(function(resolve, reject) {
                  npm = npm.map(function(n) {
                    return n.name;
                  });
              Severity: Major
              Found in lib/install.js - About 2 hrs to fix

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

                exports.template = function(dirs, names, tmpls, project, fn) {
                  var files = [];
                
                  async.each(
                    names,
                Severity: Major
                Found in lib/generate/render.js - About 2 hrs to fix

                  Function install has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.install = function(modulePath, options, fn) {
                    var additionalOptions = [ ]
                      , params = { cwd: modulePath };
                  
                    if (typeof options === 'function') {
                  Severity: Major
                  Found in lib/util/bower.js - About 2 hrs to fix

                    Function findConfigAndVersionForModule has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.findConfigAndVersionForModule = function( locations, moduleName, moduleVersion, check ) {
                      return new Promise( function( resolve ) {
                    
                        var _module = {};
                    
                    
                    Severity: Minor
                    Found in lib/util/module.js - About 1 hr to fix

                      Function install has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function install(repos) {
                        return new Promise(function(resolve, reject) {
                          util.locations
                            .findAvailableCommands()
                            .spread(function(locations) {
                      Severity: Minor
                      Found in lib/install.js - About 1 hr to fix

                        Function reverseMatchIfStillNotFound has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                function reverseMatchIfStillNotFound( list, callback ) {
                                  var behind  = cwd.split( path.sep )
                                    , found   = false
                                    , newList = [];
                        
                        
                        Severity: Minor
                        Found in lib/util/locations.js - About 1 hr to fix

                          Function exports has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          module.exports = function(env, lib, repl, local) {
                            function ReplHistory() {
                              this.help    = 'Shows command history';
                          
                              var maxSize  = 10240
                          Severity: Minor
                          Found in lib/repl/commands/history.js - About 1 hr to fix

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

                            module.exports = function(Table, env, lib, repl, local) {
                              function Modules() {
                                this.help  = 'Lists all of the modules within this project';
                                this.table = new Table({
                                  head: [
                            Severity: Minor
                            Found in lib/repl/commands/modules.js - About 1 hr to fix

                              Function exports has 40 lines of code (exceeds 25 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

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

                                var searchNPMRegistry = exports.npmRegistry = function(queries) {
                                  return new Promise(function(resolve, reject) {
                                    var repos = [];
                                
                                    async.each(
                                Severity: Minor
                                Found in lib/search.js - About 1 hr to fix

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

                                    function Models() {
                                      this.help   = 'Lists all of the models within this project';
                                      this.models = {};
                                      this.table = new Table({
                                        head: [
                                  Severity: Minor
                                  Found in lib/repl/commands/models.js - About 1 hr to fix

                                    Function aggregate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    exports.aggregate = function(args) {
                                      return new Promise(function(resolve, reject) {
                                        var all = [];
                                    
                                        utils.info('  Searching for modules...');
                                    Severity: Minor
                                    Found in lib/search.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language