Showing 224 of 370 total issues

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

    Method processSite has 81 lines of code (exceeds 25 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: Major
    Found in phplib/Worker.php - About 3 hrs to fix

      File Alerts.php has 299 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        Method _run has 79 lines of code (exceeds 25 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: Major
        Found in phplib/Job/Search.php - About 3 hrs to fix

          Function query has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function query($query, array $params=[], $ret_type=self::ALL) {
                  self::keepAlive();
                  list($query) = Hook::call('db.query', [$query]);
          
                  $stmt = self::$dbh->prepare($query);
          Severity: Minor
          Found in phplib/DB.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

          Method getActiveAlertCounts has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getActiveAlertCounts() {
                  $client = self::getClient();
          
                  $filter = [
                      [
          Severity: Major
          Found in phplib/ESClient.php - About 2 hrs to fix

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

                public function GET(array $get) {
                    $users = $this->generateUsers();
            
                    $search_types = $this->generateTypeNames(Search::getTypes());
                    $target_types = $this->generateTypeNames(Target::getTypes());
            Severity: Major
            Found in phplib/REST/Data.php - About 2 hrs to fix

              Function ___render has 71 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      ___render: function() {
                          var projects = Data.Jira.Issues;
                          var users = Data.Jira.Users;
                          var issuetypes = {};
              
              
              Severity: Major
              Found in htdocs/assets/js/views/target/jira.js - About 2 hrs to fix

                File Search.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  Function initializeCollectionData has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          initializeCollectionData: function(params) {
                              var frag = document.createDocumentFragment();
                              this.destroyViews();
                  
                              var data = {};
                  Severity: Major
                  Found in htdocs/assets/js/views/alerts/alerts.js - About 2 hrs to fix

                    Alerts_REST has 24 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Alerts_REST extends Models_REST {
                        const SLOG_TYPE = SLog::T_ALERT;
                    
                        public static $MODEL = 'Alert';
                        public static $CREATABLE = [];
                    Severity: Minor
                    Found in phplib/REST/Alerts.php - About 2 hrs to fix

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

                          public function GET(array $get) {
                              $data = [];
                              $meta = new DBMeta;
                              $cfg = new DBConfig;
                              $client = new ESClient;
                      Severity: Major
                      Found in phplib/REST/Dashboard.php - About 2 hrs to fix

                        Function offsetSet has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function offsetSet($key, $value) {
                                $schema = static::getSchema();
                                if(array_key_exists($key, $this->obj)) {
                                    switch($schema[$key][0]) {
                                        case static::T_BOOL:
                        Severity: Minor
                        Found in phplib/Model.php - About 2 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 _execute has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function _execute($date, $constructed_qdata) {
                                // If our last_success_date is within 10 seconds of the start time, use that
                                // as the start time.
                                $from = $date - ($this->obj['range'] * 60);
                                if(abs($this->obj['last_success_date'] - $from) < 10) {
                        Severity: Minor
                        Found in phplib/Search/ECL.php - About 2 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

                        Method query has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function query($query, $fields=null, $from=null, $to=null, $scroll=false, $offset=null, $count=null) {
                                $client = self::getClient();
                        
                                $filter = [];
                                $conds = [];
                        Severity: Major
                        Found in phplib/ESClient.php - About 2 hrs to fix

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

                                  _render: function() {
                                      this.groups = [];
                          
                                      if(this.settings.count > 0) {
                                          // Always allow these.
                          Severity: Major
                          Found in htdocs/assets/js/views/alerts/actions.js - About 2 hrs to fix

                            Model has 23 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Model implements \JsonSerializable, \ArrayAccess {
                                // Field types
                                /** Boolean field type. */
                                const T_BOOL = 0;
                                /** Numeric (int/float) field type. */
                            Severity: Minor
                            Found in phplib/Model.php - About 2 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

                                Method run has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function run() {
                                        switch($this->obj['target_id']) {
                                        case static::I_HOURLY:
                                            $type = Search::NT_HOURLY;
                                            $range = 1 * 60 * 60;
                                Severity: Major
                                Found in phplib/Job/Rollup.php - About 2 hrs to fix

                                  Search has 22 functions (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  abstract class Search extends TypeModel {
                                      public static $TYPES = [
                                          Null_Search::class,
                                          ES_Search::class,
                                          ECL_Search::class,
                                  Severity: Minor
                                  Found in phplib/Search.php - About 2 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language