Showing 224 of 370 total issues

Function process has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function process() {
        Logger::info('Worker run', [], self::LOG_NAMESPACE);
        cli_set_process_title('411] Worker');
        print "[+] Worker\n";
        $timer = new Timer();
Severity: Minor
Found in phplib/Worker.php - About 1 hr 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 processResults has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            var processResults = this.cbRendered(function(resp) {
                this.collections = [];

                for(var i = 0; i < resp.length; ++i) {
                    var c = resp[i].count;
Severity: Minor
Found in htdocs/assets/js/views/alerts/alerts.js - About 1 hr to fix

    Function loadMoreAlerts has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            loadMoreAlerts: function(e) {
                var elem = $(e.currentTarget).closest('.alerts-load').find('input').get(0);
                var n = parseInt(elem.value, 10);
    
                var data = {
    Severity: Minor
    Found in htdocs/assets/js/views/alerts/alertgroup.js - About 1 hr to fix

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

              readForm: function() {
                  var data = SearchView.SearchView.prototype.readForm.call(this);
      
                  if("result_type" in data) {
                      data.query_data.result_type = parseInt(data.result_type, 10);
      Severity: Minor
      Found in htdocs/assets/js/views/searches/search/elasticsearch.js - About 1 hr to fix

        Function save has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                save: function(data, options) {
                    if(_.isUndefined(data)) {
                        data = [];
                        for(var k in this.models) {
                            var attrs = this.models[k].toJSON();
        Severity: Minor
        Found in htdocs/assets/js/collection.js - About 1 hr to fix

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

                  _render: function() {
                      NavbarView.prototype._render.call(this);
          
                      var default_search = this.App.Data.User.get('settings')['default'];
                      var query = Util.parseQuery(window.location.href);
          Severity: Minor
          Found in htdocs/assets/js/views/alerts/alerts.js - About 1 hr to fix

            Method POST has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function POST(array $get, array $data) {
                    $cfg = new DBConfig();
            
                    foreach(self::$FIELDS as $field=>$type) {
                        $val = Util::get($data, $field);
            Severity: Minor
            Found in phplib/REST/Admin.php - About 1 hr to fix

              Method constructQuery has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function constructQuery() {
                      $query = Util::get($this->obj['query_data'], 'query');
                      $fields = Util::get($this->obj['query_data'], 'fields', []);
                      $parser = new \ESQuery\Parser;
                      list($settings, $query_list) = $parser->parse($query);
              Severity: Minor
              Found in phplib/Search/Elasticsearch.php - About 1 hr to fix

                Function parseKeyStr has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        parseKeyStr: function(keyStr) {
                            var tkeys = [];
                            var keys = keyStr.split('+');
                            for(var i = 0; i < keys.length; ++i) {
                                var tkey = keys[i];
                Severity: Minor
                Found in htdocs/assets/js/views/help.js - About 1 hr to fix

                  Function initSearchSelect has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      var initSearchSelect = function(elems, searches, search, options) {
                          options = options || {};
                  
                          var search_search = function(q) {
                              var term = q.term.toLowerCase();
                  Severity: Minor
                  Found in htdocs/assets/js/util.js - About 1 hr to fix

                    Function autoProcess has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        Renderer.autoProcess = function(App, in_mapping, callback) {
                            // Rank all renderers to determine whether they should run.
                            var out_mapping = {};
                    
                            // First loop over each group of views.
                    Severity: Minor
                    Found in htdocs/assets/js/views/renderer.js - About 1 hr to fix

                      Function beforeRoute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              beforeRoute: function(route) {
                                  if(this.View.Current) {
                                      var val = this.View.Current.onExit();
                                      // onExit returned false, deny.
                                      var deny = _.isBoolean(val) && !val;
                      Severity: Minor
                      Found in htdocs/assets/js/app.js - About 1 hr to fix

                        Method test has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function test($get, $data) {
                                if(!$this->allowCreate()) {
                                    throw new ForbiddenException;
                                }
                        
                        
                        Severity: Minor
                        Found in phplib/REST/Searches.php - About 1 hr to fix

                          Method read has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function read($data) {
                                  if(!$this->allowRead()) {
                                      throw new ForbiddenException;
                                  }
                          
                          
                          Severity: Minor
                          Found in phplib/REST/Models.php - About 1 hr to fix

                            Method GET has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function GET(array $get) {
                                    $jira_data = [
                                        'Issues' => [],
                                        'Users' => [],
                                    ];
                            Severity: Minor
                            Found in phplib/REST/Data/Jira.php - About 1 hr to fix

                              Method sendRollupEmail has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public static function sendRollupEmail($to, $new_alerts, $actions, $searches, $action_alerts, $active_alerts, $content_only=false, $debug_data=[]) {
                              Severity: Major
                              Found in phplib/Notification.php - About 1 hr to fix

                                Method search has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                    public function search($date, $settings, $query_list, $fields, $date_field, $date_type, $result_type, $filter_range) {
                                Severity: Major
                                Found in phplib/Search/Elasticsearch.php - About 1 hr to fix

                                  Function GET has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function GET(array $get) {
                                          $jira_data = [
                                              'Issues' => [],
                                              'Users' => [],
                                          ];
                                  Severity: Minor
                                  Found in phplib/REST/Data/Jira.php - About 55 mins 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 preview has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public function preview($get, $data) {
                                          if(!$this->allowCreate()) {
                                              throw new ForbiddenException;
                                          }
                                  
                                  
                                  Severity: Minor
                                  Found in phplib/REST/Searches.php - About 55 mins 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 getTypes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      public static function getTypes() {
                                          static $type_map = null;
                                          if(is_null($type_map)) {
                                              $type_map = [];
                                              // Populate the list of types.
                                  Severity: Minor
                                  Found in phplib/TypeModel.php - About 55 mins 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