azukiapp/azk

View on GitHub

Showing 207 of 207 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  copyVMFile(name, origin, target) {
    return this.make_ssh(name).then((ssh) => { return ssh.getFile(origin, target); });
  },
Severity: Minor
Found in src/agent/vm.js and 1 other location - About 40 mins to fix
src/agent/vm.js on lines 504..506

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                } else if (!_.isEmpty(dns_port) && unmatched_dns_port) {
                  fail_data = { file, old: nameserver.port, new: services_ports.dns };
                  this.fail('configure.errors.unmatched_dns_port', fail_data);
                } else {
                  this.warning('configure.vm_ip_msg');
      Severity: Minor
      Found in src/agent/configure.js and 1 other location - About 35 mins to fix
      src/agent/configure.js on lines 357..365

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                if (!_.isEmpty(conflict)) {
                  fail_data = { ip, inter_name: conflict.name, inter_ip: conflict.ip };
                  this.fail('configure.errors.invalid_current_ip', fail_data);
                } else if (!_.isEmpty(dns_port) && unmatched_dns_port) {
                  fail_data = { file, old: nameserver.port, new: services_ports.dns };
      Severity: Minor
      Found in src/agent/configure.js and 1 other location - About 35 mins to fix
      src/agent/configure.js on lines 360..365

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 47.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

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

        parse() {
          var content  = fs.readFileSync(this.file);
          let err_file = path.relative(this.cwd_search, this.file);
          var err  = check(content.toString(), this.file);
          if (err) {
      Severity: Minor
      Found in src/manifest/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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          return bug_sender.send(options)
          .timeout(4000)
          .then((result) => {
            log.debug(`[crash-report] bug report send to ${options.url}. result bellow:`);
            log.debug(result);
      Severity: Minor
      Found in src/utils/crash_report.js and 1 other location - About 35 mins to fix
      src/utils/crash_report.js on lines 66..77

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 46.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Avoid too many return statements within this function.
      Open

            return errors;
      Severity: Major
      Found in src/manifest/validate.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                  return errors.concat(
                    this._entry('fail', 'invalid_option_value', manifest, {
                      option: 'wait.timeout',
                      value: system.options.wait.timeout,
                      system_name: system.name,
        Severity: Major
        Found in src/manifest/validate.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return errors.concat(
                      this._entry('fail', 'invalid_option_type', manifest, {
                        option: 'wait.retry',
                        value: system.options.wait.retry,
                        system_name: system.name,
          Severity: Major
          Found in src/manifest/validate.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                      return errors.concat(
                        this._entry('fail', 'invalid_option_type', manifest, {
                          option: 'wait.timeout',
                          value: system.options.wait.timeout,
                          system_name: system.name,
            Severity: Major
            Found in src/manifest/validate.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return errors.concat(
                        this._deprecate((system.image || {}), manifest, system.name, 'wait', 'wait')
                      );
              Severity: Major
              Found in src/manifest/validate.js - About 30 mins to fix

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  getVersion(content) {
                    // https://regex101.com/r/jQ6eE8/4
                    var regex = /elixir[\s]*\:[\s]*\"(?:[~> ]*)?([0-9.]+)(?:(?:[or ~>]*)?([0-9.]+))?(?:.*)?\".*/gm;
                    var versions = Versions.match(regex, content);
                    return versions && last(versions);
                Severity: Minor
                Found in src/generator/rules/elixir.js and 1 other location - About 30 mins to fix
                src/generator/rules/elixir_phoenix.js on lines 15..20

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 45.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  getFrameworkVersion(content) {
                    // https://regex101.com/r/yG4cG2/2
                    var regex = /\:phoenix[\s]*\,[\s]*\"(?:[~> ]*)?([0-9.]+)(?:(?:[or ~>]*)?([0-9.]+))?(?:.*)?\".*/gm;
                    var versions = Versions.match(regex, content);
                    return versions && last(versions);
                Severity: Minor
                Found in src/generator/rules/elixir_phoenix.js and 1 other location - About 30 mins to fix
                src/generator/rules/elixir.js on lines 26..31

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 45.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Function stop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  stop() {
                    if (this.server || this.api_ws) {
                      log.debug("[api] stopping server api");
                      return thenAll([
                        (this.api_ws) ? this.api_ws.stop() : promiseResolve(),
                Severity: Minor
                Found in src/agent/api/index.js - About 25 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 getFrameworkVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                  getFrameworkVersion(content) {
                    var parsedJson, version;
                    try {
                      parsedJson = JSON.parse(content);
                    } catch (err) {
                Severity: Minor
                Found in src/generator/rules/php_cakephp.js - About 25 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