htdocs/assets/js/views/alerts/alert.js

Summary

Maintainability
D
1 day
Test Coverage

File alert.js has 357 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
define(function(require) {
    var _ = require('underscore'),
        View = require('view'),
        ModelView = require('views/model'),
Severity: Minor
Found in htdocs/assets/js/views/alerts/alert.js - About 4 hrs to fix

    Function _render has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _render: function() {
                var model_data = this.model.toJSON();
                var desc_parts = [];
    
                var alert = this.App.Data.Alerts.get(this.model.get('alert_id'));
    Severity: Major
    Found in htdocs/assets/js/views/alerts/alert.js - About 2 hrs to fix

      Function _render has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _render: function() {
                  this.App.setTitle('Alert: ' + this.model.get('id'));
                  this.registerView(new AlertNavbarView(this.App, {model: this.model}), true);
      
                  this.App.registerSelectableGroup(this);
      Severity: Major
      Found in htdocs/assets/js/views/alerts/alert.js - About 2 hrs to fix

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

                        assignee_name: Util.getAssigneeName(
                            this.model.get('assignee_type'), this.model.get('assignee'),
                            this.App.Data.Users, this.App.Data.Groups
                        )
        Severity: Major
        Found in htdocs/assets/js/views/alerts/alert.js and 1 other location - About 1 hr to fix
        htdocs/assets/js/views/alerts/alertgroup.js on lines 138..141

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

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

                initialize: function(options) {
                    this.key = options.key;
                    this.value = options.value;
                    this.temp = options.temp;
                },
        Severity: Major
        Found in htdocs/assets/js/views/alerts/alert.js and 3 other locations - About 1 hr to fix
        htdocs/assets/js/views/alerts/alertgroup.js on lines 38..42
        htdocs/assets/js/views/alerts/alertgroup.js on lines 124..128
        htdocs/assets/js/views/alerts/alerts.js on lines 273..277

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

        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

                    this.$el.html(this.template({
                        key: this.key, value: this.value, temp: this.temp
                    }));
        Severity: Minor
        Found in htdocs/assets/js/views/alerts/alert.js and 1 other location - About 50 mins to fix
        htdocs/assets/js/views/modal.js on lines 54..58

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

                _render: function() {
                    NavbarView.prototype._render.call(this);
        
                    this.App.registerSelectableKbdShortcut('d', 'delete', 'Delete the current item', false);
                },
        Severity: Minor
        Found in htdocs/assets/js/views/alerts/alert.js and 1 other location - About 35 mins to fix
        htdocs/assets/js/views/searches/searches.js on lines 110..114

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

        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

                selectAction: function(action) {
                    switch(action) {
                        case 'open': this.toggleEdit(); break;
                        case 'delete': this.delete(); break;
                    }
        Severity: Minor
        Found in htdocs/assets/js/views/alerts/alert.js and 2 other locations - About 30 mins to fix
        htdocs/assets/js/views/searches/searches.js on lines 198..203
        htdocs/assets/js/views/searches/searches.js on lines 264..269

        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