azukiapp/azk

View on GitHub

Showing 207 of 207 total issues

Function runProvision has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  runProvision(system, options = {}) {
    return async(this, function* () {
      var steps = system.provision_steps;

      options = _.clone(options);
Severity: Minor
Found in src/system/run.js - About 1 hr to fix

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

    dhcp.getByNetworkName = function(name) {
      return this.list_servers().then((list) => {
        return _.find(list, (server) => server.NetworkName == name);
      });
    };
    Severity: Major
    Found in src/agent/vm.js and 1 other location - About 1 hr to fix
    src/agent/vm.js on lines 74..78

    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 65.

    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

    hostonly.getByName = function(name) {
      return this.list().then((list) => {
        return _.find(list, (net) => net.Name == name);
      });
    };
    Severity: Major
    Found in src/agent/vm.js and 1 other location - About 1 hr to fix
    src/agent/vm.js on lines 80..84

    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 65.

    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 _clean_sync_folder has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _clean_sync_folder(system, syncs) {
        return async(this, function* () {
          var local_user = config('agent:vm:user');
          var uid, gid;
          if (config('agent:requires_vm')) {
    Severity: Minor
    Found in src/system/run.js - About 1 hr to fix

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

        init() {
          return defer((resolve, reject) => {
            if (this._status === 'connecting' || this._status === 'connected') {
              return resolve();
            }
      Severity: Minor
      Found in src/agent/client.js - About 1 hr to fix

        Function start has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          start(manifest, systems, opts) {
            return async(this, function* () {
              var result = yield this._scale(systems, 'start', opts);
        
              // if flag --open
        Severity: Minor
        Found in src/cmds/start.js - About 1 hr to fix

          Function installVM has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            installVM(start = false) {
              var vm_name = config("agent:vm:name");
              return async(this, function* () {
                var installed  = yield VM.isInstalled(vm_name);
                var running    = (installed) ? yield VM.isRunnig(vm_name) : false;
          Severity: Minor
          Found in src/agent/server.js - About 1 hr to fix

            Function _checkGitError has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _checkGitError(git_repo, git_branch_tag_commit, git_destination_path) {
                return function (err) {
                  var original_error = err.message;
                  var stack_trace = err.stack || '';
                  var error_type;
            Severity: Minor
            Found in src/manifest/get_project.js - About 1 hr to fix

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

              Module.prototype.require = function(file, ...args) {
                var result, require = () => {
                  return original.apply(this, [file, ...args]);
                };
              
              
              Severity: Minor
              Found in src/utils/require_debug.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 _findDockerfile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                _findDockerfile(dockerfile_path) {
                  var msg;
              
                  if (this.system.hasOwnProperty('manifest') && this.system.manifest.cwd) {
                    var dockerfile_cwd = path.resolve(this.system.manifest.cwd, dockerfile_path);
              Severity: Minor
              Found in src/images/index.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 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
                                Severity
                                Category
                                Status
                                Source
                                Language