Showing 224 of 370 total issues

Method backtrace has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static function backtrace($label, $desc, $file, $line, $bt=null, $skip=0, $ns='NONE') {
Severity: Major
Found in phplib/Logger.php - About 50 mins to fix

    Method generateQuery has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static function generateQuery(array $fields, array $query=[], $count=null, $offset=null, $sort=[], $group=[], $reverse=null) {
    Severity: Major
    Found in phplib/Model.php - About 50 mins to fix

      Method query has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private function query($query, $fields=null, $from=null, $to=null, $scroll=false, $offset=null, $count=null) {
      Severity: Major
      Found in phplib/ESClient.php - About 50 mins to fix

        Method sendSummaryEmail has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public static function sendSummaryEmail($to, $start_date, $stats, $leaders, $noisy_searches, $quiet_searches, $debug_data=[]) {
        Severity: Major
        Found in phplib/Notification.php - About 50 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if(!(k in final_ret)) {
                                      final_ret[k] = [];
                                  }
          Severity: Major
          Found in htdocs/assets/js/queryparser.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        for(var m in searches) {
                                            // Active
                                            var states = searches[m];
                                            for(var n in states) {
                                                var collection = states[n];
            Severity: Major
            Found in htdocs/assets/js/views/alerts/alerts.js - About 45 mins to fix

              Function getAssigneeName has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  var getAssigneeName = function(assignee_type, assignee, users, groups, def_ret, prefix) {
              Severity: Minor
              Found in htdocs/assets/js/util.js - About 45 mins to fix

                Function whitelistAlerts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function whitelistAlerts($data) {
                        if(!$this->allowUpdate()) {
                            throw new ForbiddenException;
                        }
                
                
                Severity: Minor
                Found in phplib/REST/Alerts.php - About 45 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 deserialize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    Renderer.deserialize = function(App, mapping, model_id, in_mapping, callback, preview) {
                Severity: Minor
                Found in htdocs/assets/js/views/renderer.js - About 45 mins to fix

                  Method entry has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      public static function entry($type, $action, $target=0, $actor=0, $a=0, $b=0) {
                  Severity: Minor
                  Found in phplib/SLog.php - About 45 mins to fix

                    Function processTargets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function processTargets(array $alerts, array $targets, $date) {
                            $errors = [];
                            foreach($targets as $target) {
                                // Call process on each Target -> Alert.
                                foreach($alerts as $alert) {
                    Severity: Minor
                    Found in phplib/Job/Search.php - About 45 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 sendAlerts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function sendAlerts($data) {
                            if(!$this->allowUpdate()) {
                                throw new ForbiddenException;
                            }
                    
                    
                    Severity: Minor
                    Found in phplib/REST/Alerts.php - About 45 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 processFilters has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function processFilters(array $alerts, array $filters, $date) {
                            $errors = [];
                    
                            foreach($filters as $filter) {
                                $new_alerts = [];
                    Severity: Minor
                    Found in phplib/Job/Search.php - About 45 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

                    Avoid deeply nested control flow statements.
                    Open

                                                if(vtok.length === 0) {
                                                    throw new ParseException('Empty group: "' + ktok + '"');
                                                }
                    Severity: Major
                    Found in htdocs/assets/js/queryparser.js - About 45 mins to fix

                      Method setAlertFields has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          private function setAlertFields($data, $fields, $alog_action, $slog_action, $a=0, $b=0) {
                      Severity: Minor
                      Found in phplib/REST/Alerts.php - About 45 mins to fix

                        Function constructQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected function constructQuery() {
                                $query = Util::get($this->obj['query_data'], 'query', '');
                                $range = Util::get($this->obj['query_data'], 'range', 10);
                                $type = Util::get($this->obj['query_data'], 'type', '');
                        
                        
                        Severity: Minor
                        Found in phplib/Search/ThreatExchange.php - About 45 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 getEmails has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function getEmails($type, $entry, $update=true, $all=false) {
                                $emails = [];
                                switch($type) {
                                    case self::T_USER:
                                        $user = UserFinder::getById($entry);
                        Severity: Minor
                        Found in phplib/Assignee.php - About 45 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 getClient has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function getClient($config_name='alerts', $index=false) {
                                $escfg = Config::get('elasticsearch')[$config_name];
                                $cb = \Elasticsearch\ClientBuilder::create();
                                if($index && count($escfg['index_hosts']) > 0) {
                                    $cb->setHosts($escfg['index_hosts']);
                        Severity: Minor
                        Found in phplib/ESClient.php - About 45 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

                        Method sendAlertActionEmail has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public static function sendAlertActionEmail($to, $action, $searches, $alerts, $content_only=false, $debug_data=[]) {
                        Severity: Minor
                        Found in phplib/Notification.php - About 45 mins to fix

                          Function processSearches has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              private function processSearches($date, $search_health, $backfill) {
                                  foreach(SearchFinder::getByQuery(['enabled' => 1]) as $search) {
                                      // If the search doesn't need to run OR
                                      // the search type is failing and isn't time based
                                      // skip it!
                          Severity: Minor
                          Found in phplib/Scheduler.php - About 45 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