ClusterLabs/hawk

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

Summary

Maintainability
D
2 days
Test Coverage

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

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

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

    Function RecipientList has 92 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Function show_modal has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var show_modal = function(edit_mode, id, recipient) {
            var modal = $('#modal');
            var modalinput = {
              id: id,
              value: recipient.value,
      Severity: Major
      Found in hawk/app/assets/javascripts/module/recipientlist.js - About 2 hrs to fix

        File recipientlist.js has 255 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // Copyright (c) 2016 Kristoffer Gronlund <kgronlund@suse.com>
        // See COPYING for license.
        
        ;(function($) {
          'use strict';
        Severity: Minor
        Found in hawk/app/assets/javascripts/module/recipientlist.js - About 2 hrs to fix

          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/recipientlist.js and 1 other location - About 50 mins to fix
          hawk/app/assets/javascripts/module/oplist.js on lines 170..174

          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.recipientList = function(options) {
              return this.each(function() {
                new RecipientList(this, options);
              });
            };
          Severity: Major
          Found in hawk/app/assets/javascripts/module/recipientlist.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/oplist.js on lines 416..420
          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