webgme/webgme-cli

View on GitHub

Showing 28 of 51 total issues

File utils.js has 347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*globals define*/
"use strict";

const childProcess = require("child_process");
const spawn = childProcess.exec;
Severity: Minor
Found in src/utils.js - About 4 hrs to fix

    Function getRequireJSPaths has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var getRequireJSPaths = function (config, startPath) {
      var componentTypes = Object.keys(config.dependencies),
        components,
        paths = [],
        names,
    Severity: Major
    Found in src/utils.js - About 2 hrs to fix

      File ComponentManager.js has 269 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*globals define*/
      /*
       * This is the basic structure for component managers
       *
       * In the component manager, all public functions (functions not preceded by a _)
      Severity: Minor
      Found in src/ComponentManager.js - About 2 hrs to fix

        Function new has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        SeedManager.prototype.new = function (args, callback) {
          var gmeConfigPath = utils.getGMEConfigPath(),
            gmeConfig = require(gmeConfigPath),
            projectName = args.project,
            name = (args.seedName || projectName).replace(/\.js(on)?$/, ""),
        Severity: Major
        Found in src/SeedManager.js - About 2 hrs to fix

          Function import has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          webgme.all.import = function (projectName, opts, callback) {
            let rootPath;
          
            opts = opts || {};
            return Q()
          Severity: Major
          Found in index.js - About 2 hrs to fix

            Function init has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            BaseManager.prototype.init = function (args, callback) {
              // Create new project
              var project, name, err;
            
              project = path.resolve(args.name || process.cwd());
            Severity: Major
            Found in src/BaseManager.js - About 2 hrs to fix

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

              DockerizeManager.prototype.dockerize = function (args) {
                utils.changeToRootDir();
              
                const tempToFileInfo = [];
                let outfiles = OUT_FILES.DEFAULT;
              Severity: Major
              Found in src/DockerizeManager.js - About 2 hrs to fix

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

                PluginManager.prototype.new = function (options, callback) {
                  // Set the config options from the command line flags
                  var self = this,
                    config = this._parseConfig(options),
                    pluginGenerator = new PluginGenerator(this._logger, config);
                Severity: Minor
                Found in src/PluginManager.js - About 1 hr to fix

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

                  SeedManager.prototype.new = function (args, callback) {
                    var gmeConfigPath = utils.getGMEConfigPath(),
                      gmeConfig = require(gmeConfigPath),
                      projectName = args.project,
                      name = (args.seedName || projectName).replace(/\.js(on)?$/, ""),
                  Severity: Minor
                  Found in src/SeedManager.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 createSubCommands has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var createSubCommands = function (dir, defArgs, descTs, opts) {
                    var components = getSupportedSubCommands(dir),
                      componentNames = {},
                      program,
                      inferrable,
                  Severity: Minor
                  Found in src/BinUtils.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 rm has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  ComponentManager.prototype.rm = function (args, callback) {
                    var name = args.name,
                      config = utils.getConfig(),
                      type =
                        config.components[this._group][name] !== undefined
                  Severity: Minor
                  Found in src/ComponentManager.js - About 1 hr to fix

                    Function createSubCommands has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var createSubCommands = function (dir, defArgs, descTs, opts) {
                      var components = getSupportedSubCommands(dir),
                        componentNames = {},
                        program,
                        inferrable,
                    Severity: Minor
                    Found in src/BinUtils.js - About 1 hr to fix

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

                      var getWebGMEConfigContent = function (startPath) {
                        var arrays,
                          config = getConfig(startPath),
                          paths = {},
                          categories = ["components", "dependencies"],
                      Severity: Minor
                      Found in src/utils.js - About 1 hr to fix

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

                        BaseManager.prototype._createPkgJson = function (project, name) {
                          var pkgJsonTemplatePath = path.join(
                              __dirname,
                              "res",
                              "package.template.json"
                        Severity: Minor
                        Found in src/BaseManager.js - About 1 hr to fix

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

                          ComponentManager.prototype._getJsonForConfig = function (
                            installInfo,
                            callback
                          ) {
                            var self = this;
                          Severity: Minor
                          Found in src/ComponentManager.js - About 1 hr to fix

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

                            VisualizerManager.prototype.new = function (options, callback) {
                              // Set the config options from the command line flags
                              var self = this,
                                visualizerGenerator = new VisualizerGenerator(this._logger, options),
                                id = options.visualizerID,
                            Severity: Minor
                            Found in src/VisualizerManager.js - About 1 hr to fix

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

                              Enableable.prototype._invokePlugin = function (args, action, callback) {
                                if (!(args.name && args.project)) {
                                  this._logger.error(
                                    "Usage: webgme " +
                                      action +
                              Severity: Minor
                              Found in src/mixins/Enableable/Enableable.js - About 1 hr to fix

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

                                VisualizerManager.prototype.import = function (options, callback) {
                                  var self = this;
                                  ComponentManager.prototype.import.call(this, options, function (err, result) {
                                    if (err) {
                                      return callback(err);
                                Severity: Minor
                                Found in src/VisualizerManager.js - About 1 hr to fix

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

                                  RouterManager.prototype.mount = function (options, callback) {
                                    var config = utils.getConfig(),
                                      routerName = options.name,
                                      mountPt = options.mountPt,
                                      types = Object.keys(config),
                                  Severity: Minor
                                  Found in src/RouterManager.js - About 1 hr to fix

                                    Function updateWebGMEConfig has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    var updateWebGMEConfig = function (startPath) {
                                      var root = getRootPath(startPath),
                                        content = getWebGMEConfigContent(startPath),
                                        templatePath = path.join(__dirname, "res", "config.template.js.ejs"),
                                        template = _.template(fs.readFileSync(templatePath)),
                                    Severity: Minor
                                    Found in src/utils.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language