azukiapp/azk

View on GitHub

Showing 135 of 207 total issues

Function remove has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  remove(vm_name) {
    return Tools.async_status("vm", this, function* (status_change) {
      var info = yield vm.info(vm_name);

      if (info.name == vm_name) {
Severity: Minor
Found in src/agent/vm.js - About 1 hr to fix

    Function _checkAndSaveIp has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _checkAndSaveIp(nameserver, file, use_vm, services_ports) {
        return async(this, function* () {
          // Not exist or invalid content
          var dns_port = _.isObject(nameserver) ? nameserver.port : null;
          var unmatched_dns_port = dns_port !== services_ports.dns;
    Severity: Minor
    Found in src/agent/configure.js - About 1 hr to fix

      Function set has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        set(cmd) {
          let key_param = cmd['config-key'];
          let value_param = cmd['config-value'];
      
          if (key_param && value_param) {
      Severity: Minor
      Found in src/cmds/config.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

      Function _system_validate has a Cognitive Complexity of 9 (exceeds 5 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 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

      Function _addOrRemove has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        _addOrRemove(system, container, method) {
          return async(this, function* () {
            if (system.balanceable) {
              var data = yield container.inspect();
              if (data.State.Running) {
      Severity: Minor
      Found in src/system/balancer.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

      Function mount has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      function mount(data) {
        if (_.isString(data)) { return json(data); }
        var options = _.reduce(data, (opts, value, key) => {
          if (key != 'value' && key != 'type') {
            opts[key] = value;
      Severity: Minor
      Found in src/generator/index.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

      Function getEvidence has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

        getEvidence(path, content) {
          var framework;
      
          if (this.type === 'framework') {
            framework = this.getFrameworkVersion(content);
      Severity: Minor
      Found in src/generator/rules.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

      Function daemonOptions has a Cognitive Complexity of 9 (exceeds 5 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 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

      Function _parse_provider has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        _parse_provider(options) {
          var provider = null;
      
          var hasProvider = options.hasOwnProperty('provider');
          if (hasProvider) {
      Severity: Minor
      Found in src/images/index.js - About 45 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

      Function _status has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        _status(label, second, ...args) {
          var message;
      
          if (second instanceof Error) {
            if (second instanceof AzkError) {
      Severity: Minor
      Found in src/cli/ui.js - About 45 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

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

        constructor(cwd, file = null, required = false) {
          if (typeof file == "boolean") {
            [required, file] = [file, null];
          }
      
      
      Severity: Minor
      Found in src/manifest/index.js - About 45 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

      Function _include_and_except has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        _include_and_except(origin, src, dest, opts) {
          let include = opts.include;
          let except  = opts.except;
      
          if (origin !== src) {
      Severity: Minor
      Found in src/sync/worker.js - About 45 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

      Function _wait_available has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        _wait_available(system, port_data, container, timeout, options, image_conf) {
      Severity: Minor
      Found in src/system/run.js - About 45 mins to fix

        Function throwRunError has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          throwRunError(system, container, command, data = null, stop = false, options = {}) {
        Severity: Minor
        Found in src/system/run.js - About 45 mins to fix

          Function run has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          export function run(docker, Container, image, cmd, opts = { }) {
          Severity: Minor
          Found in src/docker/run.js - About 35 mins to fix

            Function clone has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              clone(git_url, git_branch_tag_commit, dest_folder, is_new_git, scanFunction) {
            Severity: Minor
            Found in src/utils/git_helper.js - About 35 mins to fix

              Function _parse_option has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _parse_option(option, regex, split, fail, key_index = 0, format = null) {
                  var result = {};
                  for (var j = 0; j < option.length; j++) {
                    var opt = option[j];
                    if (opt.match(regex)) {
              Severity: Minor
              Found in src/cmds/shell.js - About 35 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

              Function _getNetworkIp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _getNetworkIp(suggestion) {
                  var question = {
                    name    : 'ip',
                    message : 'configure.ip_question',
                    // default : config('agent:vm:ip'),
              Severity: Minor
              Found in src/agent/configure.js - About 35 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

              Function _daemon_command has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                _daemon_command(options, image_conf) {
                  var command         = options.command || this.command;
                  var empty_img_cmd   = _.isEmpty(image_conf.Cmd);
                  var empty_img_entry = _.isEmpty(image_conf.Entrypoint);
                  var empty_cmd       = _.isEmpty(command);
              Severity: Minor
              Found in src/system/index.js - About 35 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

              Function processStateHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                processStateHandler() {
                  var gracefullExit = (signal) => {
                    if (!this.stopping) {
                      var catch_err = (err) => log.error('[agent] stop error' + err.stack || err);
                      try {
              Severity: Minor
              Found in src/agent/index.js - About 35 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