squirrly/squirrly-seo

View on GitHub

Showing 200 of 200 total issues

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

    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

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

                  if( response.status == 200 && response.responseText.indexOf('{') > 0){
                          response.responseText = response.responseText.substr(response.responseText.indexOf('{'),response.responseText.lastIndexOf('}'));
                          try {
                              response = jQuery.parseJSON(response.responseText);
                              jQuery('#sq_support_submit').removeAttr("disabled");
      Severity: Major
      Found in themes/default/js/sq_blocksupport.js and 1 other location - About 2 hrs to fix
      themes/default/js/sq_blocksupport.js on lines 90..109

      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 80.

      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

                  if( response.status == 200 && response.responseText.indexOf('{') > 0){
                          response.responseText = response.responseText.substr(response.responseText.indexOf('{'),response.responseText.lastIndexOf('}'));
                          try {
                              response = jQuery.parseJSON(response.responseText);
                              jQuery('#sq_feedback_submit').removeAttr("disabled");
      Severity: Major
      Found in themes/default/js/sq_blocksupport.js and 1 other location - About 2 hrs to fix
      themes/default/js/sq_blocksupport.js on lines 136..154

      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 80.

      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

      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

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

                                if (typeof response.token != 'undefined'){
                                  __token = response.token;
                                  sq_reload(response);
                                }else
                                  if(typeof response.error != 'undefined')
        Severity: Major
        Found in themes/default/js/sq_blocklogin.js and 1 other location - About 2 hrs to fix
        themes/default/js/sq_blocklogin.js on lines 61..66

        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 77.

        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

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

                   if (typeof response.token != 'undefined'){
                     __token = response.token;
                     sq_reload(response);
                   }else
                       if(typeof response.error != 'undefined')
        Severity: Major
        Found in themes/default/js/sq_blocklogin.js and 1 other location - About 2 hrs to fix
        themes/default/js/sq_blocklogin.js on lines 77..82

        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 77.

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

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

                                  if (typeof response.message != 'undefined'){
                                   jQuery('#sq_options_feedback_error').removeClass('sq_error').addClass('sq_message').html(response.message);
                                  }else
                                   jQuery('#sq_options_feedback_error').removeClass('sq_error').html('');
          Severity: Major
          Found in themes/default/js/sq_blocksupport.js and 3 other locations - About 2 hrs to fix
          themes/default/js/sq_blocksupport.js on lines 82..85
          themes/default/js/sq_blocksupport.js on lines 128..131
          themes/default/js/sq_blocksupport.js on lines 143..146

          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 76.

          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 4 locations. Consider refactoring.
          Open

                     if (typeof response.message != 'undefined'){
                      jQuery('#sq_options_support_error').removeClass('sq_error').addClass('sq_message').html(response.message);
                     }else
                      jQuery('#sq_options_support_error').removeClass('sq_error').html('');
          Severity: Major
          Found in themes/default/js/sq_blocksupport.js and 3 other locations - About 2 hrs to fix
          themes/default/js/sq_blocksupport.js on lines 82..85
          themes/default/js/sq_blocksupport.js on lines 98..101
          themes/default/js/sq_blocksupport.js on lines 143..146

          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 76.

          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 4 locations. Consider refactoring.
          Open

                     if (typeof response.message != 'undefined'){
                      jQuery('#sq_options_feedback_error').removeClass('sq_error').addClass('sq_message').html(response.message);
                     }else
                      jQuery('#sq_options_feedback_error').removeClass('sq_error').html('');
          Severity: Major
          Found in themes/default/js/sq_blocksupport.js and 3 other locations - About 2 hrs to fix
          themes/default/js/sq_blocksupport.js on lines 98..101
          themes/default/js/sq_blocksupport.js on lines 128..131
          themes/default/js/sq_blocksupport.js on lines 143..146

          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 76.

          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 4 locations. Consider refactoring.
          Open

                                  if (typeof response.message != 'undefined'){
                                   jQuery('#sq_options_support_error').removeClass('sq_error').addClass('sq_message').html(response.message);
                                  }else
                                   jQuery('#sq_options_support_error').removeClass('sq_error').html('');
          Severity: Major
          Found in themes/default/js/sq_blocksupport.js and 3 other locations - About 2 hrs to fix
          themes/default/js/sq_blocksupport.js on lines 82..85
          themes/default/js/sq_blocksupport.js on lines 98..101
          themes/default/js/sq_blocksupport.js on lines 128..131

          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 76.

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

                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

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language