htdocs/assets/js/views/searches/search.js

Summary

Maintainability
F
3 days
Test Coverage

File search.js has 706 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";
define(function(require) {
    var _ = require('underscore'),
        Model = require('model'),
        Dragula = require('dragula'),
Severity: Major
Found in htdocs/assets/js/views/searches/search.js - About 1 day to fix

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

            _render: function() {
                this.App.setTitle('Search: ' + (this.model.isNew() ? 'New':this.model.get('id')));
                this.registerView(new SearchNavbarView(this.App, {model: this.model}), true);
                this.listenTo(this.App.Bus, 'stats', this.showStatistics);
                this.listenTo(this.App.Bus, 'changelog', this.showChangelog);
    Severity: Major
    Found in htdocs/assets/js/views/searches/search.js - About 3 hrs to fix

      Function readForm has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              readForm: function() {
                  var form = this.$('#search-form');
                  var data = Util.serializeForm(form);
      
                  // schedule_type is an int.
      Severity: Minor
      Found in htdocs/assets/js/views/searches/search.js - About 1 hr to fix

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

                processCustomTest: function() {
                    var modal = new ExecutionConfigModalView(this.App);
                    this.App.setModal(modal);
                    this.listenTo(modal, 'run', $.proxy(function(data) {
                        this.processPreview(false, data);
        Severity: Major
        Found in htdocs/assets/js/views/searches/search.js and 1 other location - About 2 hrs to fix
        htdocs/assets/js/views/searches/search.js on lines 712..718

        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

                processCustomExecute: function() {
                    var modal = new ExecutionConfigModalView(this.App);
                    this.App.setModal(modal);
                    this.listenTo(modal, 'run', $.proxy(function(data) {
                        this.processPreview(true, data);
        Severity: Major
        Found in htdocs/assets/js/views/searches/search.js and 1 other location - About 2 hrs to fix
        htdocs/assets/js/views/searches/search.js on lines 702..708

        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

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

                showDelete: function() {
                    var view = this.App.setModal(new ModelView.DeleteModalView(this.App, this.modelName));
                    this.listenTo(view, 'button:delete', this.destroyModel);
                },
        Severity: Major
        Found in htdocs/assets/js/views/searches/search.js and 4 other locations - About 1 hr to fix
        htdocs/assets/js/views/groups/group.js on lines 172..175
        htdocs/assets/js/views/lists/list.js on lines 91..94
        htdocs/assets/js/views/reports/report.js on lines 195..198
        htdocs/assets/js/views/users/user.js on lines 106..109

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

        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

                            var cdata = {
                                labels: chartdata[0],
                                datasets: [_.extend({lineTension:0, data: chartdata[1], label: 'Created'}, ChartView.colors[0])],
                            };
        Severity: Major
        Found in htdocs/assets/js/views/searches/search.js and 1 other location - About 1 hr to fix
        htdocs/assets/js/views/index.js on lines 55..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 55.

        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.registerView(
                            new TargetsListView(this.App, {collection: this.targets, model: this.model}),
                            true, this.$('#target-list'), 'targets'
                        );
        Severity: Minor
        Found in htdocs/assets/js/views/searches/search.js and 1 other location - About 45 mins to fix
        htdocs/assets/js/views/searches/search.js on lines 546..549

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

        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.registerView(
                            new FiltersListView(this.App, {collection: this.filters, model: this.model}),
                            true, this.$('#filter-list'), 'filters'
                        );
        Severity: Minor
        Found in htdocs/assets/js/views/searches/search.js and 1 other location - About 45 mins to fix
        htdocs/assets/js/views/searches/search.js on lines 550..553

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

        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 FiltersListView = ElementsListView.extend({
                title: 'Filters',
                subClass: Filter,
                subView: FilterView,
                editView: FilterEditModalView,
        Severity: Minor
        Found in htdocs/assets/js/views/searches/search.js and 1 other location - About 40 mins to fix
        htdocs/assets/js/views/searches/search.js on lines 448..455

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

        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 TargetsListView = ElementsListView.extend({
                title: 'Targets',
                subClass: Target,
                subView: TargetView,
                editView: TargetEditModalView,
        Severity: Minor
        Found in htdocs/assets/js/views/searches/search.js and 1 other location - About 40 mins to fix
        htdocs/assets/js/views/searches/search.js on lines 439..446

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

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

                    this.App.setTitle('Search: ' + (this.model.isNew() ? 'New':this.model.get('id')));
        Severity: Major
        Found in htdocs/assets/js/views/searches/search.js and 4 other locations - About 40 mins to fix
        htdocs/assets/js/views/groups/group.js on lines 135..135
        htdocs/assets/js/views/lists/list.js on lines 53..53
        htdocs/assets/js/views/reports/report.js on lines 119..119
        htdocs/assets/js/views/users/user.js on lines 34..34

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

        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

                initializeSubView: function(model) {
                    var view = TableView.prototype.initializeSubView.call(this, model);
        
                    this.listenTo(view, 'button:delete', this.deleteModel);
                    return view;
        Severity: Minor
        Found in htdocs/assets/js/views/searches/search.js and 1 other location - About 40 mins to fix
        htdocs/assets/js/views/model.js on lines 154..158

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

        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

                    Util.initAssigneeSelect(
                        this.registerElement('input[name=assignee]'),
                        this.App.Data.Users, this.App.Data.Groups, false
                    );
        Severity: Major
        Found in htdocs/assets/js/views/searches/search.js and 3 other locations - About 35 mins to fix
        htdocs/assets/js/views/alerts/actions.js on lines 153..155
        htdocs/assets/js/views/alerts/alerts.js on lines 52..55
        htdocs/assets/js/views/searches/searches.js on lines 61..64

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

        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

                showChangelog: function() {
                    this.App.setModal(new ChangelogModalView(this.App, {model: this.model}));
                },
        Severity: Minor
        Found in htdocs/assets/js/views/searches/search.js and 2 other locations - About 35 mins to fix
        htdocs/assets/js/views/searches/search.js on lines 783..785
        htdocs/assets/js/views/searches/search.js on lines 795..797

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

        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

                showJobs: function() {
                    this.App.setModal(new JobsModalView(this.App, {model: this.model}));
                },
        Severity: Minor
        Found in htdocs/assets/js/views/searches/search.js and 2 other locations - About 35 mins to fix
        htdocs/assets/js/views/searches/search.js on lines 783..785
        htdocs/assets/js/views/searches/search.js on lines 789..791

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

        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

                showStatistics: function() {
                    this.App.setModal(new StatisticsModalView(this.App, {model: this.model}));
                },
        Severity: Minor
        Found in htdocs/assets/js/views/searches/search.js and 2 other locations - About 35 mins to fix
        htdocs/assets/js/views/searches/search.js on lines 789..791
        htdocs/assets/js/views/searches/search.js on lines 795..797

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

        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