squirrly/squirrly-seo

View on GitHub

Showing 200 of 200 total issues

Function getImageFromContent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getImageFromContent() {
        global $wp_query;
        $match = array();
        $post = $this->post;
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 addMeta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function addMeta($param = null) {
        if ($param)
            $this->meta = $param;

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

    function grabDescriptionFromPost($id = null) {
        global $wp_query;
        $post = null;
        $description = '';
        $advdescription = '';
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

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

    jQuery('#sq_password').bind('keypress', function(event) {

        if (event.keyCode == 13)
            jQuery('#sq_login').trigger('click');

Severity: Major
Found in themes/default/js/sq_blocklogin.js and 1 other location - About 1 hr to fix
themes/default/js/sq_blocklogin.js on lines 10..16

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

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

    jQuery('#sq_user').bind('keypress', function(event) {

        if (event.keyCode == 13)
            jQuery('#sq_login').trigger('click');

Severity: Major
Found in themes/default/js/sq_blocklogin.js and 1 other location - About 1 hr to fix
themes/default/js/sq_blocklogin.js on lines 18..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 60.

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

        arrowClick: function(post_id, _this, scroll) {
            //Load the brief information
            SQ.sq_eventsrank.loadBrief(post_id);

            if (jQuery('#sq_post-' + post_id).is(":visible")) {
Severity: Minor
Found in themes/default/js/sq_rank.js - About 1 hr to fix

    Method squirrlyRegister has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function squirrlyRegister() {
            global $current_user;
            //set return to null object as default
            $return = (object) NULL;
            //api responce variable
    Severity: Minor
    Found in core/SQ_Blocklogin/SQ_Blocklogin.php - About 1 hr to fix

      Function sq_submitSettings has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function sq_submitSettings() {
          jQuery.getJSON(
                  sqQuery.ajaxurl,
                  {
                      action: 'sq_settings_update',
      Severity: Minor
      Found in themes/default/js/sq_menu.js - About 1 hr to fix

        Method hookHead has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function hookHead() {
                global $sq_postID;
        
                parent::hookHead();
                $exists = false;
        Severity: Minor
        Found in core/SQ_Loading/SQ_Loading.php - About 1 hr to fix

          Function t has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                              var t = setInterval(function() {
                                  var pixels = config.width / 100;            // Define how many pixels go into 1%
          
                                  if (config.running_value > config.value) {
                                      if (config.running_value - config.increment < config.value) {
          Severity: Minor
          Found in themes/default/js/jquery.progressbar.js - About 1 hr to fix

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

                function action() {
                    $start = 0;
                    $nbr = 8;
                    $exclude = array();
            
            Severity: Minor
            Found in core/SQ_Blocksearch/SQ_Blocksearch.php - About 1 hr to fix

              Method squirrlyLogin has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function squirrlyLogin() {
                      //set return to null object as default
                      $return = (object) NULL;
                      //api responce variable
                      $responce = '';
              Severity: Minor
              Found in core/SQ_Blocklogin/SQ_Blocklogin.php - About 1 hr to fix

                Method getOtherKeywords has 29 lines of code (exceeds 25 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 1 hr to fix

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

                      public function getActions($cur_action) {
                  
                          /* if config allready in cache */
                          if (!isset(self::$config)) {
                              $config_file = _SQ_CORE_DIR_ . 'config.xml';
                  Severity: Minor
                  Found in classes/SQ_Action.php - About 1 hr to fix

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

                        private function getReferralKeyword() {
                            if (!function_exists('parse_url') || !function_exists('preg_match'))
                                return '';
                    
                            $keywords = '';
                    Severity: Minor
                    Found in classes/SQ_Traffic.php - About 1 hr to fix

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

                          public function getSERPZone($serp) {
                              $str = '';
                              $str .= '<ul class="sq_rank_ul_values">
                                      <li class="sq_rank_values">
                                          <table>
                      Severity: Minor
                      Found in models/SQ_PostsList.php - About 1 hr to fix

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

                            public function packStatus($progress) {
                                $str = '';
                                //Check show conditions
                                if (!$this->showPopup($progress))
                                    return;
                        Severity: Minor
                        Found in models/SQ_BlockStatus.php - About 1 hr to fix

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

                              public static function dump() {
                                  $output = '';
                                  $callee = array('file' => '', 'line' => '');
                                  if (function_exists('func_get_args')) {
                                      $arguments = func_get_args();
                          Severity: Minor
                          Found in classes/SQ_Tools.php - About 1 hr to fix

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

                                private function getGraph($div) {
                                    $traffic = SQ_ObjController::getController('SQ_Traffic', false)->getHistory($this->post_id, $this->interval, 'ASC');
                                    $rows = array();
                                    $table = array();
                                    $table['cols'] = array(
                            Severity: Minor
                            Found in models/SQ_PostsList.php - About 1 hr to fix

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

                                  public function processRanking(&$return, $post_id) {
                                      if (isset($return->seo) && is_object($return->seo)) {
                                          $return->global_rank = $this->findTodayRank($post_id, 'global_rank');
                                          $saved_keyword = $this->findTodayRank($post_id, 'keyword');
                              
                              Severity: Minor
                              Found in classes/SQ_Ranking.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