ClusterLabs/hawk

View on GitHub
hawk/app/assets/javascripts/module/oplist.js

Summary

Maintainability
F
3 days
Test Coverage

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

  OpList.prototype.init = function() {
    var self = this;

    var content = {
      labels: self.options.labels,
Severity: Major
Found in hawk/app/assets/javascripts/module/oplist.js - About 1 day to fix

    Function OpList has 127 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function OpList(el, options) {
        this.$el = $(el);
    
        // defined actions: [{name, interval, ...}]
        this.values = this.$el.data('oplist');
    Severity: Major
    Found in hawk/app/assets/javascripts/module/oplist.js - About 5 hrs to fix

      File oplist.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright (c) 2009-2015 Tim Serong <tserong@suse.com>
      // See COPYING for license.
      
      // ops and values is:
      //
      Severity: Minor
      Found in hawk/app/assets/javascripts/module/oplist.js - About 4 hrs to fix

        Function show_operation_modal has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var show_operation_modal = function(edit_mode, id, name) {
              var submit_text = (edit_mode == MODAL_MODE_CREATE) ? content.labels.add : content.labels.apply;
              if (!name)
                name = id;
              var attrmapping = self.attr_mapping;
        Severity: Major
        Found in hawk/app/assets/javascripts/module/oplist.js - About 3 hrs to fix

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

              tgtnode.on('keyup change', 'input, select', function(e) {
                // Trigger the plus sign programmatically
                $('.addition .setter .create').click();
                $(e.delegateTarget)
                  .parents('form')
          Severity: Major
          Found in hawk/app/assets/javascripts/module/oplist.js and 1 other location - About 3 hrs to fix
          hawk/app/assets/javascripts/module/wizattrlist.js on lines 158..197

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

          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

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

                  $('[data-help-target]').each(function() {
                    $($(this).data('help-target')).hide().filter(filter).show();
                  });
          Severity: Major
          Found in hawk/app/assets/javascripts/module/oplist.js and 1 other location - About 1 hr to fix
          hawk/app/assets/javascripts/module/wizattrlist.js on lines 220..222

          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

                  var data = {
                    labels: content.labels,
                    prefix: content.prefix,
                    actions: content.actions,
                    values: content.values,
          Severity: Minor
          Found in hawk/app/assets/javascripts/module/oplist.js and 1 other location - About 55 mins to fix
          hawk/app/assets/javascripts/module/oplist.js on lines 243..250

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

          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

                var data = {
                  labels: content.labels,
                  prefix: content.prefix,
                  actions: content.actions,
                  values: content.values,
          Severity: Minor
          Found in hawk/app/assets/javascripts/module/oplist.js and 1 other location - About 55 mins to fix
          hawk/app/assets/javascripts/module/oplist.js on lines 317..324

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

          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

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

              $.templates({
                entryTemplate: this.options.entryTemplate,
                adderTemplate: this.options.adderTemplate,
                editTemplate: this.options.editTemplate
              });
          Severity: Minor
          Found in hawk/app/assets/javascripts/module/oplist.js and 1 other location - About 50 mins to fix
          hawk/app/assets/javascripts/module/recipientlist.js on lines 103..107

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

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

            $.fn.opList = function(options) {
              return this.each(function() {
                new OpList(this, options);
              });
            };
          Severity: Major
          Found in hawk/app/assets/javascripts/module/oplist.js and 6 other locations - About 30 mins to fix
          hawk/app/assets/javascripts/module/attrlist.js on lines 219..223
          hawk/app/assets/javascripts/module/constraint.js on lines 286..290
          hawk/app/assets/javascripts/module/monitor.js on lines 94..98
          hawk/app/assets/javascripts/module/recipientlist.js on lines 275..279
          hawk/app/assets/javascripts/module/status.js on lines 143..147
          hawk/app/assets/javascripts/module/wizattrlist.js on lines 247..251

          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

          There are no issues that match your filters.

          Category
          Status