azukiapp/azk

View on GitHub

Showing 135 of 207 total issues

Function _scale has 65 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _scale(system, instances = {}, opts = undefined) {
    var flags    = {};
    var _subscription = subscribe('#.status', (event) => {
      if (!event) { return; }
      var type;
Severity: Major
Found in src/cmds/scale.js - About 2 hrs to fix

    Function _make_options has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _make_options(daemon, options = {}, image_conf = {}) {
        // Default values
        options = _.defaults(options, {
          workdir: this.options.workdir,
          mounts: {},
    Severity: Major
    Found in src/system/index.js - About 2 hrs to fix

      Function __convertFoldersToSystems has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        __convertFoldersToSystems() {
          let systems = {};
          let not_version = [];
      
          _.forEach(this.__folder_evidences_suggestion, function(folder_evidence_suggestion) {
      Severity: Major
      Found in src/generator/court.js - About 2 hrs to fix

        Function waitService has 62 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          waitService(uri, opts = {}) {
            opts = _.defaults(opts, {
              timeout: 10000,      // maximum timeout - this may be override
              retry_if: () => { return promiseResolve(true); },
              publish_retry: true,
        Severity: Major
        Found in src/utils/net.js - About 2 hrs to fix

          Function watch has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            watch(origin, destination, opts) {
              var id = this.calculate_id(origin, destination);
          
              let promise = defer((resolve, reject) => {
                log.info('[sync] Adding watcher, from: %s, to: %s, opts: %j', origin, destination, opts, {});
          Severity: Major
          Found in src/sync/watcher.js - About 2 hrs to fix

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

              static status(cli, manifest, systems, opts = {}) {
                return async(cli, function* () {
                  // Force types if not interactive or narrow console
                  if (cli.ui.outputColumns() === -1) {
                    opts.text = true;
            Severity: Major
            Found in src/cmds/status.js - About 2 hrs to fix

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

                list(cli) {
                  let key_param  = cli['config-key'];
                  let configList = this.configuration.listAll();
              
                  if (key_param) {
              Severity: Major
              Found in src/cmds/config.js - About 2 hrs to fix

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

                      this.loggerSubscription = subscribe(subscribe_topic, function (data, envelope) {
                        try {
                          var final_string = '';
                
                          //  timespan
                Severity: Major
                Found in src/utils/postal.js - About 2 hrs to fix

                  File court.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { _, log, fsAsync } from 'azk';
                  import { async, mapPromises } from 'azk/utils/promises';
                  import { UIProxy } from 'azk/cli/ui';
                  import { SugestionChooser } from 'azk/generator/sugestion_chooser';
                  
                  
                  Severity: Minor
                  Found in src/generator/court.js - About 2 hrs to fix

                    Function promise has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        let promise = defer((resolve, reject) => {
                          log.info('[sync] Adding watcher, from: %s, to: %s, opts: %j', origin, destination, opts, {});
                          if (this.workers[id]) {
                            this.workers[id].count++;
                            this.publish('init', { status: 'exists' });
                    Severity: Major
                    Found in src/sync/watcher.js - About 2 hrs to fix

                      File errors.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { _, t, os } from 'azk';
                      
                      var BASE_CODE_ERROR     = 1;
                      var MANIFEST_CODE_ERROR = 2;
                      var SYSTEMS_CODE_ERROR  = 3;
                      Severity: Minor
                      Found in src/utils/errors.js - About 2 hrs to fix

                        File config.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { _, envs, mergeConfig } from 'azk/utils';
                        var path = require('path');
                        var os   = require('os');
                        
                        // Configs paths
                        Severity: Minor
                        Found in src/config.js - About 2 hrs to fix

                          File net.js has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { _, fs, lazy_require, config, set_config } from 'azk';
                          import { publish } from 'azk/utils/postal';
                          import { async, defer, ninvoke, promiseResolve } from 'azk/utils/promises';
                          import { envDefaultArray, isBlank } from 'azk/utils';
                          
                          
                          Severity: Minor
                          Found in src/utils/net.js - About 2 hrs to fix

                            Balancer has 21 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            var Balancer = {
                              memcached : null,
                              hipache   : null,
                              mem_client: null,
                            
                            
                            Severity: Minor
                            Found in src/agent/balancer.js - About 2 hrs to fix

                              Configure has 21 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              export class Configure extends UIProxy {
                                constructor(user_interface) {
                                  super(user_interface);
                                  this.dns_tab   = ports_tabs[os.platform()];
                                  this.docker_ip = null;
                              Severity: Minor
                              Found in src/agent/configure.js - About 2 hrs to fix

                                Utils has 21 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                var Utils = {
                                  get default () { return Utils; },
                                  get _       () { return _; },
                                  get net     () { return require('azk/utils/net'); },
                                  get docker  () { return require('azk/utils/docker'); },
                                Severity: Minor
                                Found in src/utils/index.js - About 2 hrs to fix

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

                                    vmStartProgress(cmd) {
                                      return (event) => {
                                        if (!event) {
                                          return;
                                        }
                                  Severity: Major
                                  Found in src/cli/helpers.js - About 2 hrs to fix

                                    Function parseCommandOptions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                      static parseCommandOptions(opts) {
                                        var is_start      = opts.start;
                                        var system_name   = opts.system;
                                        var git_repo      = opts['git-repo'];
                                        var git_ref       = opts['git-ref'];
                                    Severity: Minor
                                    Found in src/manifest/get_project.js - About 2 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 callAgent has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      callAgent(opts) {
                                        var params = {
                                          action: _.head(this.route.actions) || opts.action
                                        };
                                        // Create a progress output
                                    Severity: Major
                                    Found in src/cmds/agent.js - About 2 hrs to fix

                                      Function parseCommandOptions has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                        static parseCommandOptions(opts) {
                                          var is_start      = opts.start;
                                          var system_name   = opts.system;
                                          var git_repo      = opts['git-repo'];
                                          var git_ref       = opts['git-ref'];
                                      Severity: Minor
                                      Found in src/manifest/get_project.js - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language