Showing 224 of 370 total issues

Avoid too many return statements within this function.
Open

            return token_error(stream, state);
Severity: Major
Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

              return token_(state, "builtin");
    Severity: Major
    Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return tokenize(stream, state);
      Severity: Major
      Found in htdocs/assets/js/views/searches/syntax/ecl.js - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return self::format($this->update($get, $data));
        Severity: Major
        Found in phplib/REST/Alerts.php - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                    return token_(state, "keyword");
          Severity: Major
          Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return tok;
            Severity: Major
            Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                        return token_(state, "bracket");
              Severity: Major
              Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return token_(state, "meta");
                Severity: Major
                Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return 'bracket';
                  Severity: Major
                  Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return token_error(stream, state);
                    Severity: Major
                    Found in htdocs/assets/js/views/searches/syntax/elasticsearch.js - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return;
                      Severity: Major
                      Found in phplib/Cookie.php - About 30 mins to fix

                        Function PUT has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function PUT(array $get, array $data) {
                                $target_id = (int) Util::get($get, 'id');
                                // Only an admin user or the user themself should be able to modify a user!
                                // That check is done here. Note that the strict compare is necessary as getUserId()
                                // can return null.
                        Severity: Minor
                        Found in phplib/REST/Users.php - About 25 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 process has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function process(Alert $alert, $date) {
                                $data = $this->obj['data'];
                                $key_regex = Util::get($data, 'key_regex', '');
                                $expression = Util::get($data, 'key_expr', '');
                                $keys = array_keys($alert['content']);
                        Severity: Minor
                        Found in phplib/Filter/MapKey.php - About 25 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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

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

                            public function process(Alert $alert, $date) {
                                $data = $this->obj['data'];
                                $key_regex = Util::get($data, 'key_regex', '');
                                $expression = Util::get($data, 'value_expr', '');
                                $keys = array_keys($alert['content']);
                        Severity: Minor
                        Found in phplib/Filter/MapValue.php - About 25 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 toArray has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function toArray(array $keys=null) {
                                $ret = [];
                                if(is_null($keys)) {
                                    $keys = array_keys($this->obj);
                                } else {
                        Severity: Minor
                        Found in phplib/Model.php - About 25 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 isWorking has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function isWorking($date) {
                                $cfg = $this->getConfig();
                                $client = ESClient::getClient($this->getClientConfigKey());
                        
                                $working = false;
                        Severity: Minor
                        Found in phplib/Search/Elasticsearch.php - About 25 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 shouldRun has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function shouldRun($date, $backfill=false) {
                                $due = false;
                                $job = JobFinder::getLastByQuery(['type' => Search_Job::$TYPE, 'target_id' => $this->obj[static::$PKEY]]);
                        
                                $last_scheduled_date = is_null($job) ? 0:$job['target_date'];
                        Severity: Minor
                        Found in phplib/Search.php - About 25 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 constructQuery has a Cognitive Complexity of 6 (exceeds 5 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 25 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 prompt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function prompt($str) {
                                $ret = '';
                                while(true) {
                                    printf("%s: ", $str);
                                    $ret = fgets(STDIN);
                        Severity: Minor
                        Found in phplib/Util.php - About 25 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