Showing 370 of 370 total issues

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

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

    define(function(require) {
        var $ = require('jquery'),
            _ = require('underscore'),
            Backbone = require('backbone'),
            Model = require('model'),
    Severity: Major
    Found in htdocs/assets/js/models/target.js and 1 other location - About 1 day to fix
    htdocs/assets/js/models/filter.js on lines 2..35

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

    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

    define(function(require) {
        var $ = require('jquery'),
            _ = require('underscore'),
            Backbone = require('backbone'),
            Model = require('model'),
    Severity: Major
    Found in htdocs/assets/js/models/filter.js and 1 other location - About 1 day to fix
    htdocs/assets/js/models/target.js on lines 2..35

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

    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 search has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

        public function search($date, $settings, $query_list, $fields, $date_field, $date_type, $result_type, $filter_range) {
            // If we're looking for no results, set filter to (< 1)
            if($result_type == self::R_NO_RESULTS) {
                $filter_range = [0, 0];
            }
    Severity: Minor
    Found in phplib/Search/Elasticsearch.php - About 1 day 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

        var initFilterSelect = function(elems, filters, options) {
            options = options || {};
    
            var filter_search = function(q) {
                var term = q.term.toLowerCase();
    Severity: Major
    Found in htdocs/assets/js/util.js and 1 other location - About 7 hrs to fix
    htdocs/assets/js/util.js on lines 418..439

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

    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 initTargetSelect = function(elems, targets, options) {
            options = options || {};
    
            var target_search = function(q) {
                var term = q.term.toLowerCase();
    Severity: Major
    Found in htdocs/assets/js/util.js and 1 other location - About 7 hrs to fix
    htdocs/assets/js/util.js on lines 395..415

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

    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 exports has 187 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function(grunt) {
      grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        jshint: {
          app: {
    Severity: Major
    Found in Gruntfile.js - About 7 hrs to fix

      File util.js has 474 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      "use strict";
      define(function(require) {
          var $ = require('jquery'),
              _ = require('underscore'),
              URI = require('uri'),
      Severity: Minor
      Found in htdocs/assets/js/util.js - About 7 hrs to fix

        File ESClient.php has 456 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace FOO;
        
        /**
        Severity: Minor
        Found in phplib/ESClient.php - About 6 hrs to fix

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

              var ListEntryView = View.extend({
                  tagName: 'tr',
                  template: Templates['lists/listentry'],
                  _render: function() {
                      var vars = this.model.toJSON();
          Severity: Major
          Found in htdocs/assets/js/views/lists/lists.js and 1 other location - About 6 hrs to fix
          htdocs/assets/js/views/groups/groups.js on lines 18..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 165.

          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 GroupEntryView = View.extend({
                  tagName: 'tr',
                  template: Templates['groups/groupentry'],
                  _render: function() {
                      var vars = this.model.toJSON();
          Severity: Major
          Found in htdocs/assets/js/views/groups/groups.js and 1 other location - About 6 hrs to fix
          htdocs/assets/js/views/lists/lists.js on lines 18..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 165.

          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

          File alerts.js has 428 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

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

            File alertgroup.js has 426 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

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

              File actions.js has 425 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                File Model.php has 416 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace FOO;
                
                /**
                Severity: Minor
                Found in phplib/Model.php - About 6 hrs to fix

                  Function update has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function update($get, $data, $set_fields=[]) {
                          if(!$this->allowUpdate()) {
                              throw new ForbiddenException;
                          }
                          $id = Util::get($get, 'id');
                  Severity: Minor
                  Found in phplib/REST/Models.php - About 5 hrs 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 3 locations. Consider refactoring.
                  Open

                      var ReportsView = View.extend({
                          _load: function() {
                              this.loadCollections([this.App.Data.Users]);
                          },
                          _render: function() {
                  Severity: Major
                  Found in htdocs/assets/js/views/reports/reports.js and 2 other locations - About 5 hrs to fix
                  htdocs/assets/js/views/groups/groups.js on lines 49..62
                  htdocs/assets/js/views/lists/lists.js on lines 50..63

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

                  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

                      var GroupsView = View.extend({
                          _load: function() {
                              this.loadCollections([this.App.Data.Users]);
                          },
                          _render: function() {
                  Severity: Major
                  Found in htdocs/assets/js/views/groups/groups.js and 2 other locations - About 5 hrs to fix
                  htdocs/assets/js/views/lists/lists.js on lines 50..63
                  htdocs/assets/js/views/reports/reports.js on lines 72..85

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

                  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

                      var ListsView = View.extend({
                          _load: function() {
                              this.loadCollections([this.App.Data.Users]);
                          },
                          _render: function() {
                  Severity: Major
                  Found in htdocs/assets/js/views/lists/lists.js and 2 other locations - About 5 hrs to fix
                  htdocs/assets/js/views/groups/groups.js on lines 49..62
                  htdocs/assets/js/views/reports/reports.js on lines 72..85

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

                  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 processSite has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function processSite($site, $date) {
                          $base_title = sprintf('411] Time: %d Site: %d', $date, $site['id']);
                          cli_set_process_title($base_title);
                          print "[+] Worker: $date\n";
                          $timer = new Timer();
                  Severity: Minor
                  Found in phplib/Worker.php - About 5 hrs 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

                  Severity
                  Category
                  Status
                  Source
                  Language