squirrly/squirrly-seo

View on GitHub

Showing 149 of 200 total issues

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

        private static function getBadLinkStructure() {
            global $wp_rewrite;
            if (function_exists('apache_get_modules')) {
                //Check if mod_rewrite is installed in apache
                if (!in_array('mod_rewrite', apache_get_modules()))
    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

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

        public function checkIndexed(&$return, $post_id) {
            $return->indexed = $this->findHistoryIndexed($post_id);
    
            //If is indexed search is a keyword is indexed
            if ($return->indexed == 1) {
    Severity: Minor
    Found in classes/SQ_Ranking.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

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

        private function setInfo() {
            $info = '';
    
            if (SQ_Tools::getIsset('sq_info'))
                $info = SQ_Tools::getValue('sq_info');
    Severity: Minor
    Found in classes/SQ_Wservice.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

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

    function sq_trackLength(field, type) {
        var min = 0;
        var max = 0;
        if (typeof field === 'undefined')
            return;
    Severity: Minor
    Found in themes/default/js/sq_menu.js - 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

    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

    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

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

        function getAuthorLinkFromBlog() {
            global $wp_query, $wp_version;
    
            if ($wp_query->is_author && count($wp_query->posts) > 0) {
                if ($wp_version >= '2') {
    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

    Consider simplifying this complex logical expression.
    Open

            if ((isset($browser) && $browser != false && is_array($browser) && $browser['name'] == 'IE' && (int) $browser['version'] < 9 && (int) $browser['version'] > 0)) {
                echo '<script type="text/javascript">
                        jQuery("#sq_preloading").removeClass("sq_loading");
                        jQuery("#sq_preloading").addClass("sq_error")
                        jQuery("#sq_preloading").html("' . __('For Squirrly to work properly you have to use a higher version of Internet Explorer. <br /> We recommend you to use Chrome or Mozilla.', _PLUGIN_NAME_) . '");
    Severity: Major
    Found in core/SQ_Loading/SQ_Loading.php - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if ($this->isHomePage() &&
                      SQ_Tools::$options['sq_auto_description'] == 1 &&
                      SQ_Tools::$options['sq_auto_seo'] == 0 &&
                      SQ_Tools::$options['sq_fp_description'] <> '' &&
                      (!isset($post) || !$this->getAdvancedMeta($post->ID, 'description'))) {
      Severity: Major
      Found in models/SQ_Frontend.php - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                } else if ($wp_query->is_tag && $haspost) {
                    $tag = get_term_by('slug', get_query_var('tag'), 'post_tag');
                    if (!empty($tag->term_id)) {
                        $link = get_tag_link($tag->term_id);
                    }
        Severity: Major
        Found in models/SQ_Frontend.php - About 40 mins to fix

          Consider simplifying this complex logical expression.
          Open

                  if ($this->isHomePage() &&
                          SQ_Tools::$options['sq_auto_title'] == 1 &&
                          SQ_Tools::$options['sq_auto_seo'] == 0 &&
                          SQ_Tools::$options['sq_fp_title'] <> '' &&
                          (!isset($post) || !$this->getAdvancedMeta($post->ID, 'title'))) {
          Severity: Major
          Found in models/SQ_Frontend.php - About 40 mins to fix

            Consider simplifying this complex logical expression.
            Open

                    if ((SQ_Tools::getValue('action')) == 'editpost' &&
                            wp_is_post_revision($post_id) == '' &&
                            wp_is_post_autosave($post_id) == '' &&
                            get_post_status($post_id) != 'auto-draft' &&
                            get_post_status($post_id) != 'inherit' &&
            Severity: Major
            Found in controllers/SQ_Post.php - About 40 mins to fix

              Function getReferralKeyword has a Cognitive Complexity of 7 (exceeds 5 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 35 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 openImage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  function openImage($image) {
                      $this->image = $image;
              
                      if (!file_exists($image))
                          return false;
              Severity: Minor
              Found in models/SQ_Menu.php - About 35 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 getTraffic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getTraffic($post_id, $interval = 'month') {
              
                      $traffic = array('day' => array('count' => 0, 'unique' => 0), 'week' => array('count' => 0, 'unique' => 0), 'month' => array('count' => 0, 'unique' => 0));
                      $rows = $this->getHistory($post_id, $interval, 'DESC');
                      $traffic[$interval]['average'] = $this->getAverage($interval, $post_id);
              Severity: Minor
              Found in classes/SQ_Traffic.php - About 35 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 setProgress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function setProgress($until = '') {
                      $progress = array('op' => 0, 'nop' => 0, 'opc' => 0, 'nopc' => 0, 'gapr' => 0);
              
                      if ($tno = $this->getNOProgress($until))
                          if ($to = $this->getOProgress($until))
              Severity: Minor
              Found in models/SQ_BlockStatus.php - About 35 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 insert has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  function insert($src, $in, $pos) {
                      if (is_int($pos))
                          $array = array_merge(array_slice($src, 0, $pos), $in, array_slice($src, $pos));
                      else {
                          foreach ($src as $k => $v) {
              Severity: Minor
              Found in controllers/SQ_PostsList.php - About 35 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 too many return statements within this method.
              Open

                      return $link;
              Severity: Major
              Found in models/SQ_Frontend.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return false;
                Severity: Major
                Found in classes/SQ_Traffic.php - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language