Showing 224 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

    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

    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

          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

                  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

                  Function token has 139 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      function token(stream, state) {
                        var ch = stream.peek();
                  
                        // Errors are terminal!
                        if(state.error) {
                  Severity: Major
                  Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 5 hrs to fix

                    File app.js has 377 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

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

                      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

                        Method search has 107 lines of code (exceeds 25 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: Major
                        Found in phplib/Search/Elasticsearch.php - About 4 hrs to fix

                          Function setAlertFields has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function setAlertFields($data, $fields, $alog_action, $slog_action, $a=0, $b=0) {
                                  if(!$this->allowUpdate()) {
                                      throw new ForbiddenException;
                                  }
                          
                          
                          Severity: Minor
                          Found in phplib/REST/Alerts.php - About 3 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

                          Function _parse has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              QueryParser.prototype._parse = function(tokens) {
                                  var ret = {};
                                  var stk = 0;
                                  var node = ret;
                                  var node = {};
                          Severity: Major
                          Found in htdocs/assets/js/queryparser.js - About 3 hrs to fix

                            Function _run has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function _run($commit, Search $search, $disable_search_commit=false) {
                                    $alerts = [];
                                    $errors = [];
                            
                                    // Don't allow saving Alerts if the Search isn't in the DB.
                            Severity: Minor
                            Found in phplib/Job/Search.php - About 3 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

                            File searches.js has 319 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/searches/searches.js - About 3 hrs to fix

                              Method update has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function update($get, $data, $set_fields=[]) {
                                      if(!$this->allowUpdate()) {
                                          throw new ForbiddenException;
                                      }
                                      $id = Util::get($get, 'id');
                              Severity: Major
                              Found in phplib/REST/Models.php - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language