Showing 370 of 370 total issues

Method whitelistAlerts has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function whitelistAlerts($data) {
        if(!$this->allowUpdate()) {
            throw new ForbiddenException;
        }

Severity: Minor
Found in phplib/REST/Alerts.php - About 1 hr to fix

    Method afterStore has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function afterStore($model, $data, $new, $delete) {
            $fields = ['tags', 'priority', 'category', 'owner'];
    
            // Trigger a job to delete all Alerts if the Search was deleted.
            if($delete) {
    Severity: Minor
    Found in phplib/REST/Searches.php - About 1 hr to fix

      Method process has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function process(Alert $alert, $date) {
              $site = SiteFinder::getCurrent();
      
              $alert_url = $site->urlFor('/');
              if(!$alert->isNew()) {
      Severity: Minor
      Found in phplib/Target/PagerDuty.php - About 1 hr to fix

        Method generateClauses has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected static function generateClauses($count=null, $offset=null, $sort=[], $group=[], $reverse=null) {
                $MODEL = 'FOO\\' . static::$MODEL;
        
                $clauses = [];
                $order = [];
        Severity: Minor
        Found in phplib/Model.php - About 1 hr to fix

          Method generateSchema has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected static function generateSchema() {
                  return [
                      'name' => [self::T_STR, null, ''],
                      'source' => [self::T_STR, null, ''],
                      'query_data' => [self::T_OBJ, null, []],
          Severity: Minor
          Found in phplib/Search.php - About 1 hr to fix

            Function initTimeSelect has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var initTimeSelect = function(elems, options) {
                    options = options || {};
            
                    var fmt = options.format || formatTime;
                    var intvs = [1, 5, 10, 15, 30, 60, 90, 120, 180, 360, 720, 1440, 2880, 4320, 10080, 20160];
            Severity: Minor
            Found in htdocs/assets/js/util.js - About 1 hr to fix

              Method sendAlerts has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function registerView has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        registerView: function(view, init, sel, str) {
                            if(_.isUndefined(str)) str = view.cid;
                            if(_.isUndefined(sel)) sel = this.$el;
                            var arr = str.substr(-2) === '[]';
                            if(this.childViewNamesToIDs[str] && !arr) {
                Severity: Minor
                Found in htdocs/assets/js/view.js - About 1 hr to fix

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

                          _render: function() {
                              var search = this.App.Data.Searches.get(this.model.get('search_id'));
                              var vars = this.model.toJSON();
                              _.extend(vars, {
                                  preview: this.preview,
                  Severity: Minor
                  Found in htdocs/assets/js/views/alerts/alertgroup.js - About 1 hr to fix

                    Method generateWhere has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected static function generateWhere(array $query) {
                            $MODEL = 'FOO\\' . static::$MODEL;
                    
                            $clauses = [];
                            $vals = [];
                    Severity: Minor
                    Found in phplib/Model.php - About 1 hr to fix

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

                          public function afterStore($model, $data, $new, $delete) {
                              $fields = ['tags', 'priority', 'category', 'owner'];
                      
                              // Trigger a job to delete all Alerts if the Search was deleted.
                              if($delete) {
                      Severity: Minor
                      Found in phplib/REST/Searches.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 process has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function process(Alert $alert, $date) {
                              $data = $this->obj['data'];
                              $include = Util::get($data, 'include', true);
                              $keys = [Util::get($data, 'key', '*')];
                              if ($keys[0] == '*') {
                      Severity: Minor
                      Found in phplib/Filter/Regex.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 POST has a Cognitive Complexity of 10 (exceeds 5 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

                      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 generateClauses has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected static function generateClauses($count=null, $offset=null, $sort=[], $group=[], $reverse=null) {
                              $MODEL = 'FOO\\' . static::$MODEL;
                      
                              $clauses = [];
                              $order = [];
                      Severity: Minor
                      Found in phplib/Model.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 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 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 _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

                          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 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 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
                                Severity
                                Category
                                Status
                                Source
                                Language