Showing 370 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

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            do {
                $query['alert_id'] = [ModelFinder::C_GT => $id];
                $alerts = AlertFinder::getByQuery($query, self::CHUNK_SIZE, 0, [['alert_id', ModelFinder::O_ASC]]);
    
                foreach($alerts as $alert) {
    Severity: Major
    Found in phplib/Job/Delete.php and 1 other location - About 3 hrs to fix
    phplib/Job/Sync.php on lines 35..46

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 150.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

            do {
                $query['alert_id'] = [ModelFinder::C_GT => $id];
                $alerts = AlertFinder::getByQuery($query, self::CHUNK_SIZE, 0, [['alert_id', ModelFinder::O_ASC]]);
    
                foreach($alerts as $alert) {
    Severity: Major
    Found in phplib/Job/Sync.php and 1 other location - About 3 hrs to fix
    phplib/Job/Delete.php on lines 28..39

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 150.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                users.each(function(model) {
                    if(model.get('real_name').toString().toLowerCase().indexOf(term) !== -1) {
                        results.push({id: '0,' + model.id, text: 'User: ' + model.get('real_name')});
                    }
                });
    Severity: Major
    Found in htdocs/assets/js/util.js and 1 other location - About 3 hrs to fix
    htdocs/assets/js/util.js on lines 352..356

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 102.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                groups.each(function(model) {
                    if(model.get('name').toString().toLowerCase().indexOf(term) !== -1) {
                        results.push({id: '1,' + model.id, text: 'Group: ' + model.get('name')});
                    }
                });
    Severity: Major
    Found in htdocs/assets/js/util.js and 1 other location - About 3 hrs to fix
    htdocs/assets/js/util.js on lines 347..351

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 102.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  results = results.concat(_.map(
                      users.filter(function(model) {
                          return model.get('real_name').toString().toLowerCase().indexOf(term) !== -1;
                      }),
                      function(model) {
      Severity: Major
      Found in htdocs/assets/js/util.js and 1 other location - About 3 hrs to fix
      htdocs/assets/js/util.js on lines 213..220

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 99.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  var results = _.map(
                      searches.filter(function(model) {
                          return model.get('name').toString().toLowerCase().indexOf(term) !== -1;
                      }),
                      function(model) {
      Severity: Major
      Found in htdocs/assets/js/util.js and 1 other location - About 3 hrs to fix
      htdocs/assets/js/util.js on lines 305..312

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 99.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      this.App.ajax({
                          url: Config.api_root + 'health',
                          success: this.cbLoaded(function(resp) {
                              this.data = resp;
                              this.render();
          Severity: Major
          Found in htdocs/assets/js/views/health.js and 1 other location - About 2 hrs to fix
          htdocs/assets/js/views/index.js on lines 20..27

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 94.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                          this.App.ajax({
                              url: Config.api_root + 'dashboard',
                              success: this.cbLoaded(function(resp) {
                                  this.data = resp;
                                  this.render();
          Severity: Major
          Found in htdocs/assets/js/views/index.js and 1 other location - About 2 hrs to fix
          htdocs/assets/js/views/health.js on lines 17..24

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 94.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function validateData(array $data) {
                            parent::validateData($data);
                    
                            $regex = $data['data']['key_regex'];
                            if(@preg_match("/$regex/", null) === false) {
                    Severity: Major
                    Found in phplib/Filter/MapValue.php and 1 other location - About 2 hrs to fix
                    phplib/Filter/MapKey.php on lines 22..36

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 135.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                        public function validateData(array $data) {
                            parent::validateData($data);
                    
                            $regex = $data['data']['key_regex'];
                            if(@preg_match("/$regex/", null) === false) {
                    Severity: Major
                    Found in phplib/Filter/MapKey.php and 1 other location - About 2 hrs to fix
                    phplib/Filter/MapValue.php on lines 22..36

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 135.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language