azukiapp/azk

View on GitHub

Showing 207 of 207 total issues

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

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

              constructor(ui) {
                super(ui);
                this.type      = "framework";
                this.name      = "php_cakephp";
                this.rule_name = "php_cakephp";
            Severity: Major
            Found in src/generator/rules/php_cakephp.js and 1 other location - About 2 hrs to fix
            src/generator/rules/php_laravel.js on lines 5..15

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

            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

              constructor(ui) {
                super(ui);
                this.type      = "framework";
                this.name      = "php_laravel";
                this.rule_name = "php_laravel";
            Severity: Major
            Found in src/generator/rules/php_laravel.js and 1 other location - About 2 hrs to fix
            src/generator/rules/php_cakephp.js on lines 5..15

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

            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

            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

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

                      getFrameworkVersion(content) {
                        // http://regex101.com/r/qP4gG7/2
                        // version will be on the first group
                        var regex   = /^\s*gem ['"]rails['"],\s+['"](.+?)['"]\s*$/gm;
                        var match   = regex.exec(content);
                    Severity: Major
                    Found in src/generator/rules/ruby_on_rails.js and 2 other locations - About 2 hrs to fix
                    src/generator/rules/python.js on lines 22..29
                    src/generator/rules/ruby.js on lines 25..32

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

                    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 3 locations. Consider refactoring.
                    Open

                      getVersion(content) {
                        // Ruby Version
                        // http://regex101.com/r/rO8iA0/3
                        var regex = /\s*\bruby ['"]?(\d+\.\d+\.\d+)['"]?/gm;
                        var match   = regex.exec(content);
                    Severity: Major
                    Found in src/generator/rules/ruby.js and 2 other locations - About 2 hrs to fix
                    src/generator/rules/python.js on lines 22..29
                    src/generator/rules/ruby_on_rails.js on lines 17..24

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

                    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 3 locations. Consider refactoring.
                    Open

                      getVersion(content) {
                        // Pyhton Version
                        // http://regex101.com/r/hH2uY1/1
                        var regex   = /^python-(\d+\.\d+\.\d+)/gm;
                        var match   = regex.exec(content);
                    Severity: Major
                    Found in src/generator/rules/python.js and 2 other locations - About 2 hrs to fix
                    src/generator/rules/ruby.js on lines 25..32
                    src/generator/rules/ruby_on_rails.js on lines 17..24

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

                    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

                    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

                              Severity
                              Category
                              Status
                              Source
                              Language