azukiapp/azk

View on GitHub

Showing 135 of 207 total issues

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

  constructor(extra_values, tracker, configuration = null) {
    extra_values = _.merge({}, {
      meta: {},
      server: {},
    }, extra_values);
Severity: Minor
Found in src/utils/crash_report.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 _subscription has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var _subscription = subscribe('#.status', (event) => {
      if (!event) { return; }
      var type;
      if (event.type === "pull_msg") {
        this.view('image_pull').render(event);
Severity: Minor
Found in src/cmds/scale.js - About 1 hr to fix

    Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render(msg) {
        if (msg.type !== "pull_msg") {
          return msg;
        }
    
    
    Severity: Minor
    Found in src/cli/views/image_pull_view.js - About 1 hr to fix

      Function _veredict has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _veredict() {
          _.forEach(this.__folder_evidences_suggestion, function(folder_evidence_suggestion) {
            var systemName = '';
            var folderName = folder_evidence_suggestion.path;
            var evidences_suggestion = folder_evidence_suggestion.suggestions;
      Severity: Minor
      Found in src/generator/court.js - About 1 hr to fix

        Function _system_validate has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _system_validate(name, properties) {
            var msg, opts;
            // system_name must not contain anything not valid in docker container name
            if (!name.match(/^[a-zA-Z0-9-]+$/)) {
              msg = t("manifest.system_name_invalid", { system: name });
        Severity: Minor
        Found in src/manifest/index.js - About 1 hr to fix

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

            _scale(systems, action, opts) {
              var args = this.normalized_params.arguments;
              var args_systems = (args.system || '').split(',');
              args_systems = _.map(args_systems, (s) => (s || '').trim());
          
          
          Severity: Minor
          Found in src/cmds/start.js - About 1 hr to fix

            Function systemsInOrder has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              systemsInOrder(requireds = []) {
                var edges = [];
                _.each(this.systems, (system, name) => {
                  if (_.isEmpty(system.depends)) {
                    edges.push(["__", name]);
            Severity: Minor
            Found in src/manifest/index.js - About 1 hr to fix

              Function suggestion has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                get suggestion() {
                  let name = this.name;
                  let upper_name = name.toUpperCase();
                  let suggestion = _.extend({}, example_system, {
                    __type  : 'postgres',
              Severity: Minor
              Found in src/generator/suggestions/postgres.js - About 1 hr to fix

                Function throwRunError has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  throwRunError(system, container, command, data = null, stop = false, options = {}) {
                    data = data ? promiseResolve(data) : container.inspect();
                    return data.then((data) => {
                      // Get container log
                      var promise = container.logs({stdout: true, stderr: true}).then((stream) => {
                Severity: Minor
                Found in src/system/run.js - About 1 hr to fix

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

                    mount(vm_name, share, point, opts = {}) {
                      _.defaults(opts, {
                        umask: "0000",
                        gid  : "vboxsf",
                        uid  : config("agent:vm:user"),
                  Severity: Minor
                  Found in src/agent/vm.js - About 1 hr to fix

                    Function daemonOptions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      daemonOptions(options = {}, image_conf = {}) {
                        // Merge ports
                        options.ports = _.merge({}, this.ports, options.ports);
                        options.ports_order = _.map(options.ports, (port, name) => {
                          return !_.isEmpty(port) && name;
                    Severity: Minor
                    Found in src/system/index.js - About 1 hr to fix

                      Function index has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        index() {
                          return async(this, function* () {
                            yield Helpers.requireAgent(this.ui);
                      
                            // Get deploy [commands] avaible
                      Severity: Minor
                      Found in src/cmds/deploy.js - About 1 hr to fix

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

                          escapeCapture(callback) {
                            // Escape sequence
                            var escapeBuffer = false;
                            var escape = false;
                        
                        
                        Severity: Minor
                        Found in src/cli/helpers.js - About 1 hr to fix

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

                            _checkDockerVersion(force = null) {
                              var versions = {
                                required: config('docker:min_version'),
                                current : force || config('docker:version'),
                              };
                          Severity: Minor
                          Found in src/agent/configure.js - About 1 hr to fix

                            Function nameServers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                            Open

                              nameServers(custom_dns_servers, options={}) {
                                var dns_servers;
                                var nameservers     = config(cache_key);
                                var env_dns_servers = envDefaultArray('AZK_DNS_SERVERS', []);
                            
                            
                            Severity: Minor
                            Found in src/utils/net.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 add_logo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              add_logo(data) {
                                let final = (`
                                           ##########
                                       ##################
                                     ######################
                            Severity: Minor
                            Found in src/cli/views/version_view.js - About 1 hr to fix

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

                                runShell(system, options = {}) {
                                  return async(this, function* () {
                                    options = _.defaults(options, {
                                      remove: false,
                                      sequencies: yield this._getSequencies(system)
                              Severity: Minor
                              Found in src/system/run.js - About 1 hr to fix

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

                                  expandExportEnvs(data) {
                                    var ports, envs = {};
                                
                                    // Defaults options
                                    data = _.defaults(data, { envs: {}, net: {}, });
                                Severity: Minor
                                Found in src/system/index.js - About 1 hr to fix

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

                                    static _have_dollar_sign_string_interpotation(manifest) {
                                      // https://regex101.com/r/eZ4mQ6/3
                                      var dollar_check = /((?:[$]{|<%|#{-|#{=)[=|-]?)(.*\..*)(}|%>)/;
                                      return _.reduce(manifest.systems, (errors, system) => {
                                        var raw = system.options.raw;
                                  Severity: Minor
                                  Found in src/manifest/validate.js - About 1 hr to fix

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

                                      waitForwardingService(host, port, retry = 15, timeout = 10000) {
                                        return defer((resolve, reject) => {
                                          var client   = null;
                                          var attempts = 1, max = retry;
                                          var connect  = () => {
                                    Severity: Minor
                                    Found in src/utils/net.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language