squirrly/squirrly-seo

View on GitHub

Showing 200 of 200 total issues

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

    function hookInit() {
        $browser = SQ_Tools::getBrowserInfo();

        if ($browser['name'] == 'IE' && (int) $browser['version'] < 9 && (int) $browser['version'] > 0)
            return;
Severity: Minor
Found in controllers/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 getGoogleRank has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    function getGoogleRank($post_id = 0, $keyword = "", $country = "com", $language = "en") {
        global $wpdb;
        $this->keyword = $keyword;

        $keyword = str_replace(" ", "+", urlencode(strtolower($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

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

    private function checkDebug() {
        //if debug is called
        if (self::getIsset('sq_debug')) {

Severity: Minor
Found in classes/SQ_Tools.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 getGoogleExtension has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function getGoogleExtension($language) {
        switch ($language) {
            case 'en':
                $country = '';
                break;
Severity: Minor
Found in classes/SQ_Ranking.php - About 1 hr to fix

    Method resizeImage has 27 lines of code (exceeds 25 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

      Method getRank has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getRank($post_id = "") {
              global $wpdb;
      
              //Check if ranks is saved in database
              $sql = "SELECT analytics.`id`,analytics.`indexed`,analytics.`global_rank`,analytics.`local_rank`, analytics.`keyword`,analytics.`other_keywords`,analytics.`date`
      Severity: Minor
      Found in classes/SQ_Ranking.php - About 1 hr to fix

        Method sq_remote_get has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function sq_remote_get($url, $param = array()) {
                $cookies = '';
                $post_preview = false;
                $cookies = array();
                $cookie_string = '';
        Severity: Minor
        Found in classes/SQ_Tools.php - About 1 hr to fix

          Method getGoogleRank has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function getGoogleRank($post_id = 0, $keyword = "", $country = "com", $language = "en") {
                  global $wpdb;
                  $this->keyword = $keyword;
          
                  $keyword = str_replace(" ", "+", urlencode(strtolower($keyword)));
          Severity: Minor
          Found in classes/SQ_Ranking.php - About 1 hr to fix

            Method add_row has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function add_row($column, $post_id) {
                    $title = '';
                    $description = '';
                    $frontend = null;
                    $cached = false;
            Severity: Minor
            Found in controllers/SQ_PostsList.php - About 1 hr to fix

              Method getAverage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function getAverage($interval = null, $post_id = 0) {
                      global $wpdb;
              
                      $average = array('count' => 0, 'unique' => 0, 'old' => 0);
                      $days = 0;
              Severity: Minor
              Found in classes/SQ_Traffic.php - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                        if (get_query_var('m')) {
                            $m = @preg_replace('/[^0-9]/', '', get_query_var('m'));
                            switch (strlen($m)) {
                                case 4:
                                    $link = get_year_link($m);
                Severity: Major
                Found in models/SQ_Frontend.php - About 1 hr to fix

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

                      function action() {
                          $start = 0;
                          $nbr = 8;
                          $exclude = array();
                  
                  Severity: Minor
                  Found in core/SQ_Blocksearch/SQ_Blocksearch.php - About 55 mins 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 grabTitleFromPost has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function grabTitleFromPost($id = null) {
                          global $wp_query;
                          $post = null;
                          $title = '';
                          $advtitle = '';
                  Severity: Minor
                  Found in models/SQ_Frontend.php - About 55 mins 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 getUniqueKeywords has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function getUniqueKeywords($keywords) {
                          $all = array();
                          if (is_array($keywords))
                              foreach ($keywords as $word) {
                                  if (function_exists('mb_strtolower'))
                  Severity: Minor
                  Found in models/SQ_Frontend.php - About 55 mins 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 hookSavePost has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      function hookSavePost($post_id) {
                          $file_name = false;
                  
                  
                          // unhook this function so it doesn't loop infinitely
                  Severity: Minor
                  Found in controllers/SQ_Post.php - About 55 mins 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 getPublisher has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function getPublisher() {
                          $author = SQ_Tools::$options['sq_google_plus'];
                          if ($author == '')
                              $author = $this->getAuthorLinkFromBlog();
                          elseif (!$author)
                  Severity: Minor
                  Found in models/SQ_Frontend.php - About 45 mins 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

                  Avoid deeply nested control flow statements.
                  Open

                                              if (!in_array($row, $urls)) {
                                                  $urls[] = $row;
                                              }
                  Severity: Major
                  Found in controllers/SQ_Post.php - About 45 mins to fix

                    Function getSnippet has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public static function getSnippet($url) {
                            if ($url == '' || !function_exists('preg_match'))
                                return;
                            $snippet = array();
                            $length = array('title' => 66,
                    Severity: Minor
                    Found in classes/SQ_Tools.php - About 45 mins 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.getJSON(
                                sqQuery.ajaxurl,
                                {
                                    action: 'sq_support',
                                    message: jQuery("textarea[name=sq_support_message]").val(),
                    Severity: Minor
                    Found in themes/default/js/sq_blocksupport.js and 1 other location - About 45 mins to fix
                    themes/default/js/sq_blocklogin.js on lines 110..145

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

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

                        private function checkAdvMeta($post_id) {
                            $meta = array();
                            if (SQ_Tools::getIsset('sq_fp_title') || SQ_Tools::getIsset('sq_fp_description') || SQ_Tools::getIsset('sq_fp_keywords')) {
                                if (SQ_Tools::getIsset('sq_fp_title'))
                                    $meta[] = array('key' => 'sq_fp_title',
                    Severity: Minor
                    Found in controllers/SQ_Post.php - About 45 mins 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