Showing 224 of 370 total issues

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

    public static function sendAlertEmail($to, $search, $alerts, $content_only, $debug_data=[]) {
        $alertkeys = [];
        $long = false;
        foreach($alerts as $alert) {
            if(count($alert['content']) >= 10) {
Severity: Minor
Found in phplib/Notification.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 initAssigneeSelect has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    var initAssigneeSelect = function(elems, users, groups, search, options) {
Severity: Minor
Found in htdocs/assets/js/util.js - About 35 mins to fix

    Method getByQuery has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

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

      Method countByQuery has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

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

        Function loadCollectionsAndModel has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                loadCollectionsAndModel: function(collections, collection, id, func, deferred) {
        Severity: Minor
        Found in htdocs/assets/js/views/model.js - About 35 mins to fix

          Method generateClauses has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              protected static function generateClauses($count=null, $offset=null, $sort=[], $group=[], $reverse=null) {
          Severity: Minor
          Found in phplib/Model.php - About 35 mins to fix

            Method sendAlertEmail has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public static function sendAlertEmail($to, $search, $alerts, $content_only, $debug_data=[]) {
            Severity: Minor
            Found in phplib/Notification.php - About 35 mins to fix

              Method getAlerts has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function getAlerts($query, $from, $to, $offset, $count) {
              Severity: Minor
              Found in phplib/ESClient.php - About 35 mins to fix

                Method mail has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public static function mail($to, $from, $title, $message, $file=null) {
                Severity: Minor
                Found in phplib/Notification.php - About 35 mins to fix

                  Function read has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

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

                      protected function filterByKeys($keys, $srcs) {
                          $ret = [];
                          foreach($keys as $key) {
                              foreach($srcs as $src) {
                                  if(Util::exists($src, $key)) {
                  Severity: Minor
                  Found in phplib/REST/Models.php - About 35 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 delete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function delete($hard=false) {
                          if($this->new) {
                              return false;
                          }
                  
                  
                  Severity: Minor
                  Found in phplib/Model.php - About 35 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 test has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

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

                      private function generateSearchTimeBased() {
                          $time_based = [];
                          if(Auth::isAuthenticated()) {
                              foreach(Search::getTypes() as $type) {
                                  if($type::$SOURCES) {
                  Severity: Minor
                  Found in phplib/REST/Data.php - About 35 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 getSearchHealth has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getSearchHealth() {
                          $search_health = [];
                          foreach(Search::getTypes() as $MODEL) {
                              $sources = $MODEL::getSources();
                              if(is_null($sources)) {
                  Severity: Minor
                  Found in phplib/REST/Health.php - About 35 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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function init() {
                          $user = null;
                          $auth_config = Config::get('auth');
                          $api_auth = Util::get($auth_config['api'], 'enabled', false);
                          $proxy_auth = Util::get($auth_config['proxy'], 'enabled', false);
                  Severity: Minor
                  Found in phplib/Auth.php - About 35 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 POST has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function POST(array $get, array $data) {
                          $ret = null;
                          $name = Util::get($data, 'name');
                          $pass = Util::get($data, 'password');
                          if($name && $pass) {
                  Severity: Minor
                  Found in phplib/REST/Login.php - About 35 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 GET has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function GET(array $get) {
                          $data = [];
                          $meta = new DBMeta;
                          $cfg = new DBConfig;
                          $client = new ESClient;
                  Severity: Minor
                  Found in phplib/REST/Dashboard.php - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function _execute($date, $constructed_qdata) {
                          $gcfg = $this->getConfig();
                          if(is_null($gcfg['host'])) {
                              throw new SearchException('Graphite not configured');
                          }
                  Severity: Minor
                  Found in phplib/Search/Graphite.php - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getEmails($update, $all) {
                          $targets = GroupTargetFinder::getByGroup($this->obj[static::$PKEY]);
                          $ret = array_map(function($x) {
                              return $x->getEmail();
                          }, $targets);
                  Severity: Minor
                  Found in phplib/Group.php - About 35 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