azukiapp/azk

View on GitHub

Showing 207 of 207 total issues

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

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

      export class ImageNotAvailable extends AzkError {
        constructor(system, image) {
          super('image_not_available');
          this.system = system;
          this.image  = image;
      Severity: Major
      Found in src/utils/errors.js and 1 other location - About 1 hr to fix
      src/utils/errors.js on lines 200..208

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

      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

      export class SystemNotFoundError extends AzkError {
        constructor(manifest, system) {
          super('system_not_found');
      
          this.manifest = manifest;
      Severity: Major
      Found in src/utils/errors.js and 1 other location - About 1 hr to fix
      src/utils/errors.js on lines 170..177

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

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

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

          gulp.task('replace-font-path-en', function(){
            return gulp.src(['./content/_book/en/gitbook/print.css',
                      './content/_book/en/gitbook/style.css',])
              .pipe(replace(/\.\/\/fonts/g, './fonts'))
              .pipe(gulp.dest('./content/_book/en/gitbook/'));
          Severity: Major
          Found in docs/gulpfile.js and 1 other location - About 1 hr to fix
          docs/gulpfile.js on lines 11..16

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

          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

          gulp.task('replace-font-path-pt-BR', function(){
            return gulp.src(['./content/_book/pt-BR/gitbook/print.css',
                      './content/_book/pt-BR/gitbook/style.css',])
              .pipe(replace(/\.\/\/fonts/g, './fonts'))
              .pipe(gulp.dest('./content/_book/pt-BR/gitbook/'));
          Severity: Major
          Found in docs/gulpfile.js and 1 other location - About 1 hr to fix
          docs/gulpfile.js on lines 18..23

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

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

                    Function watch has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      watch(origin, destination, opts = {}) {
                        this.unwatch();
                        this.status = WATCH_INIT;
                    
                        return async(this, function* () {
                    Severity: Minor
                    Found in src/sync/worker.js - About 1 hr to fix

                      Function stop has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        stop(system, instances, options = {}) {
                          options = _.defaults(options, {
                            kill: false,
                            remove: true,
                          });
                      Severity: Minor
                      Found in src/system/run.js - About 1 hr to fix

                        Function runDaemon has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          runDaemon(system, options = {}) {
                            return async(this, function* () {
                              // TODO: add instances and dependencies options
                              // Prepare options
                              var image = yield this._check_image(system, options);
                        Severity: Minor
                        Found in src/system/run.js - About 1 hr to fix

                          Function constructor has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            constructor(...args) {
                              super(...args);
                          
                              var name    = 'ruby';
                              // Readable name for this suggestion
                          Severity: Minor
                          Found in src/generator/suggestions/ruby.js - About 1 hr to fix

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

                                  if (!_.isNumber(system.options.wait) && !_.isObject(system.options.wait)) {
                                    return errors.concat(
                                      this._entry('fail', 'invalid_option_type', manifest, {
                                        option: 'wait',
                                        value: system.options.wait,
                            Severity: Major
                            Found in src/manifest/validate.js and 1 other location - About 1 hr to fix
                            src/manifest/validate.js on lines 94..103

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

                            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 (_.isNumber(system.options.wait) && system.options.wait <= 0) {
                                    return errors.concat(
                                      this._entry('fail', 'invalid_option_value', manifest, {
                                        option: 'wait',
                                        value: system.options.wait,
                            Severity: Major
                            Found in src/manifest/validate.js and 1 other location - About 1 hr to fix
                            src/manifest/validate.js on lines 106..115

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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language