squirrly/squirrly-seo

View on GitHub

Showing 200 of 200 total issues

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

    public function checkBingWTCode($code) {
        if ($code <> '') {
            if (strpos($code, 'content') !== false) {
                preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
                if (isset($result[1]) && !empty($result[1]))
Severity: Major
Found in models/SQ_Menu.php and 2 other locations - About 5 hrs to fix
models/SQ_Menu.php on lines 141..159
models/SQ_Menu.php on lines 194..212

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

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 progressBar has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        progressBar: new function() {

            this.defaults = {
                steps: 2, // steps taken to reach target
                stepDuration: 2,
Severity: Major
Found in themes/default/js/jquery.progressbar.js - About 5 hrs to fix

    Function addFavicon has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addFavicon($file, $path = ABSPATH) {
            $out = array();
            $out['name'] = strtolower(basename($file['name']));
            $out['tmp'] = _SQ_CACHE_DIR_ . strtolower(basename($file['name']));
            $out['favicon'] = $path . "/" . 'favicon.ico';
    Severity: Minor
    Found in models/SQ_Menu.php - About 5 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 3 locations. Consider refactoring.
    Open

        jQuery("#sq_feedback_3").bind('click',function() {
            jQuery("#sq_feedback_submit").trigger('click');
            for(i=0;i<5;i++) jQuery('#sq_options_feedback').find('.sq_icon').removeClass('sq_label_feedback_' + i);
            jQuery('#sq_options_feedback').find('.sq_icon').addClass('sq_label_feedback_3');
    
    
    Severity: Major
    Found in themes/default/js/sq_blocksupport.js and 2 other locations - About 5 hrs to fix
    themes/default/js/sq_blocksupport.js on lines 33..41
    themes/default/js/sq_blocksupport.js on lines 51..59

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

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

        jQuery("#sq_feedback_4").bind('click',function() {
            jQuery("#sq_feedback_submit").trigger('click');
            for(i=0;i<5;i++) jQuery('#sq_options_feedback').find('.sq_icon').removeClass('sq_label_feedback_' + i);
            jQuery('#sq_options_feedback').find('.sq_icon').addClass('sq_label_feedback_4');
    
    
    Severity: Major
    Found in themes/default/js/sq_blocksupport.js and 2 other locations - About 5 hrs to fix
    themes/default/js/sq_blocksupport.js on lines 33..41
    themes/default/js/sq_blocksupport.js on lines 42..50

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

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

        jQuery("#sq_feedback_2").bind('click',function() {
            jQuery("#sq_feedback_submit").trigger('click');
            for(i=0;i<5;i++) jQuery('#sq_options_feedback').find('.sq_icon').removeClass('sq_label_feedback_' + i);
            jQuery('#sq_options_feedback').find('.sq_icon').addClass('sq_label_feedback_2');
    
    
    Severity: Major
    Found in themes/default/js/sq_blocksupport.js and 2 other locations - About 5 hrs to fix
    themes/default/js/sq_blocksupport.js on lines 42..50
    themes/default/js/sq_blocksupport.js on lines 51..59

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

    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_Tools.php has 386 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Handles the parameters and url
     *
    Severity: Minor
    Found in classes/SQ_Tools.php - About 5 hrs to fix

      Function getCustomDescription has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getCustomDescription() {
              global $wp_query;
              $sep = '|';
              $description = '';
      
      Severity: Minor
      Found in models/SQ_Frontend.php - About 4 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 calcDensity has a Cognitive Complexity of 33 (exceeds 5 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 4 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 construct has 117 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  this.construct = function(arg1, arg2) {
                      var argvalue = null;
                      var argconfig = null;
      
                      if (arg1 != null) {
      Severity: Major
      Found in themes/default/js/jquery.progressbar.js - About 4 hrs to fix

        File SQ_Menu.php has 351 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <div id="sq_settings" >
            <form id="sq_settings_form" name="settings" action="" method="post" enctype="multipart/form-data">
        
                <div id="sq_settings_title" ><?php _e('Squirrly settings', _PLUGIN_NAME_); ?> <input type="submit" name="sq_update" value="<?php _e('Save settings', _PLUGIN_NAME_) ?> &raquo;" /> <a href="post-new.php" id="sq_goto_newpost" <?php echo (($view->options['sq_api'] <> '') ? '' : 'style="display:none"') ?> /><?php _e('Optimize with Squirrly', _PLUGIN_NAME_) ?></a></div>
                <div id="sq_settings_body">
        Severity: Minor
        Found in themes/default/SQ_Menu.php - About 4 hrs to fix

          File SQ_PostsList.php has 342 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          class Model_SQ_PostsList {
          
              /** @var integer */
          Severity: Minor
          Found in models/SQ_PostsList.php - About 4 hrs to fix

            Method action has 99 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function action() {
            
                    parent::action();
            
                    switch (SQ_Tools::getValue('action')) {
            Severity: Major
            Found in controllers/SQ_PostsList.php - About 3 hrs to fix

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

                      if (parseInt(jQuery('.sq_count').html()) > 0) {
                          var notif = (parseInt(jQuery('.sq_count').html()) - 1);
                          if (notif > 0) {
                              jQuery('.sq_count').html(notif);
                          } else {
              Severity: Major
              Found in themes/default/js/sq_menu.js and 1 other location - About 3 hrs to fix
              themes/default/js/sq_menu.js on lines 136..144

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

              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 (parseInt(jQuery('.sq_count').html()) > 0) {
                          var notif = (parseInt(jQuery('.sq_count').html()) - 1);
                          if (notif > 0) {
                              jQuery('.sq_count').html(notif);
                          } else {
              Severity: Major
              Found in themes/default/js/sq_menu.js and 1 other location - About 3 hrs to fix
              themes/default/js/sq_menu.js on lines 109..117

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

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

                  public function getCustomTitle() {
                      global $wp_query;
                      $count = 0;
                      $title = '';
                      $optitle = '';
              Severity: Minor
              Found in models/SQ_Frontend.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

              Function action has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function action() {
                      parent::action();
              
                      switch (SQ_Tools::getValue('action')) {
                          case 'sq_feedback':
              Severity: Minor
              Found in core/SQ_BlockSupport/SQ_BlockSupport.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

              SQ_Tools has 28 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class SQ_Tools extends SQ_FrontController {
              
                  /** @var array Saved options in database */
                  public static $options = array();
              
              Severity: Minor
              Found in classes/SQ_Tools.php - About 3 hrs to fix

                Method getCanonicalUrl has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function getCanonicalUrl() {
                        global $wp_query;
                
                        if (!isset($wp_query) || $wp_query->is_404 || $wp_query->is_search) {
                            return false;
                Severity: Major
                Found in models/SQ_Frontend.php - About 3 hrs to fix

                  Method hookMenu has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function hookMenu() {
                          $this->upgradeRedirect();
                          $first_page = preg_replace('/\s/', '_', _SQ_NAME_);
                  
                          SQ_Tools::checkErrorSettings(true);
                  Severity: Major
                  Found in controllers/SQ_Menu.php - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language