squirrly/squirrly-seo

View on GitHub

Showing 149 of 200 total issues

Function getRanks has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        getRanks: function(posts) {
            jQuery.getJSON(
                    sqQuery.ajaxurl,
                    {
                        action: 'sq_posts_rank',
Severity: Major
Found in themes/default/js/sq_rank.js - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

            if (is_home() || (isset($wp_query->query) && empty($wp_query->query)) || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search()) {
    
                $title = $this->getCustomTitle();
                if (isset($title) && !empty($title) && $title <> '') {
                    $buffer = @preg_replace('/<title[^<>]*>([^<>]*)<\/title>/si', sprintf("<title>%s</title>", $title), $buffer, 1, $count);
    Severity: Critical
    Found in models/SQ_Frontend.php - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

              if (is_home() || (isset($wp_query->query) && empty($wp_query->query)) || is_single() || is_preview() || is_page() || is_archive() || is_category() || is_author() || is_tag() || is_search()) {
      
      
                  /* Meta setting */
                  $this->title = $this->clearTitle($this->getCustomTitle());
      Severity: Critical
      Found in models/SQ_Frontend.php - About 2 hrs to fix

        File SQ_Ranking.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        /**
         * Class for Google Ranking Record
         */
        Severity: Minor
        Found in classes/SQ_Ranking.php - About 2 hrs to fix

          Function getOtherKeywords has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getOtherKeywords($post_id) {
                  global $wpdb;
                  $other_keywords = array();
                  $sql = "SELECT count(kw.`keyword`) as searched, kw.`keyword`
                                 FROM `" . $this->keyword_table . "` kw
          Severity: Minor
          Found in classes/SQ_Ranking.php - About 2 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

          Function loadBrief has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  loadBrief: function(post_id) {
                      if (jQuery('#sq_post-' + post_id).length == 0) {
          
                          jQuery('#post-' + post_id).after('<tr id="sq_post-' + post_id + '" style="display:none"><td colspan="' + (jQuery('#post-' + post_id + ' td').length + 1) + '" class="sq_post_rank_row"><div  class="sq_post_rank_title">' + __sq_article_rank + '</div><div class="sq_post_rank_content sq_loading"></div><div class="sq_post_arrow_details"></div><div class="sq_post_rank_close">x</div><div class="sq_post_rank_refresh">' + __sq_refresh + '</div></td></tr>');
                      } else {
          Severity: Major
          Found in themes/default/js/sq_rank.js - About 2 hrs to fix

            File SQ_Sitemap.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            /**
             * Class for Sitemap Generator
             */
            Severity: Minor
            Found in classes/SQ_Sitemap.php - About 2 hrs to fix

              Method getCustomTitle has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getCustomTitle() {
                      global $wp_query;
                      $count = 0;
                      $title = '';
                      $optitle = '';
              Severity: Major
              Found in models/SQ_Frontend.php - About 2 hrs to fix

                Method checkImage has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function checkImage($post_id) {
                        @set_time_limit(90);
                        $local_file = false;
                
                        $content = stripslashes(SQ_Tools::getValue('post_content'));
                Severity: Major
                Found in controllers/SQ_Post.php - About 2 hrs to fix

                  Method saveVisit has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function saveVisit() {
                          global $wpdb, $wp_query;
                          $post_id = 0;
                          $home = 0;
                          $sql = '';
                  Severity: Minor
                  Found in classes/SQ_Traffic.php - About 1 hr to fix

                    Method calcDensity has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function calcDensity($text, $title = '', $description = '') {
                            $keywords = array();
                            $text = $title . '. ' . $text;
                            $text = @preg_replace('/[^a-zA-Z0-9-.]/', ' ', $text);
                            $title = explode(" ", $title);
                    Severity: Minor
                    Found in models/SQ_Frontend.php - About 1 hr to fix

                      Function resizeImage has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          function resizeImage($maxwidth, $maxheight, $preserveAspect = true) {
                              $width = @imagesx($this->imgH);
                              $height = @imagesy($this->imgH);
                      
                              if ($width > $maxwidth && $height > $maxheight) {
                      Severity: Minor
                      Found in models/SQ_Menu.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 getAdvancedMeta has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getAdvancedMeta($post_id, $meta = 'title') {
                              global $wpdb;
                              $field = '';
                              $cond = '';
                      
                      Severity: Minor
                      Found in models/SQ_Frontend.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 packBriefProgress has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          private function packBriefProgress($history) {
                              if (!is_array($history) || count($history) == 0)
                                  return false;
                      
                      
                      Severity: Minor
                      Found in models/SQ_PostsList.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 getOtherPluginsMeta has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getOtherPluginsMeta($post_id, $meta = 'title') {
                              global $wpdb;
                              $field = '';
                              $cond = '';
                      
                      Severity: Minor
                      Found in models/SQ_Frontend.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 hookMenu has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function hookMenu() {
                              $this->upgradeRedirect();
                              $first_page = preg_replace('/\s/', '_', _SQ_NAME_);
                      
                              SQ_Tools::checkErrorSettings(true);
                      Severity: Minor
                      Found in controllers/SQ_Menu.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

                      Method getBrowserInfo has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function getBrowserInfo() {
                              $u_agent = $_SERVER['HTTP_USER_AGENT'];
                              $bname = 'Unknown';
                              $platform = 'Unknown';
                              $version = "";
                      Severity: Minor
                      Found in classes/SQ_Tools.php - About 1 hr to fix

                        Function addSubmenu has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function addSubmenu($param = null) {
                                if ($param)
                                    $this->menu = $param;
                        
                                if (is_array($this->menu)) {
                        Severity: Minor
                        Found in models/SQ_Menu.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 checkFavebookInsightsCode has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function checkFavebookInsightsCode($code) {
                                if ($code <> '') {
                                    if (strpos($code, 'content') !== false) {
                                        preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
                                        if (isset($result[1]) && !empty($result[1]))
                        Severity: Minor
                        Found in models/SQ_Menu.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 setMetaInBuffer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                        Open

                            private function setMetaInBuffer($buffer) {
                                global $wp_query;
                                $this->post = $wp_query->get_queried_object();
                        
                                if (is_home() || (isset($wp_query->query) && empty($wp_query->query)) || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search()) {
                        Severity: Minor
                        Found in models/SQ_Frontend.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

                        Severity
                        Category
                        Status
                        Source
                        Language