squirrly/squirrly-seo

View on GitHub

Showing 200 of 200 total issues

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

                        if (config.running_value > config.value) {
                            if (config.running_value - config.increment < config.value) {
                                config.running_value = config.value;
                            } else {
                                config.running_value -= config.increment;
Severity: Major
Found in themes/default/js/jquery.progressbar.js and 1 other location - About 1 hr to fix
themes/default/js/jquery.progressbar.js on lines 150..156

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

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

                        else if (config.running_value < config.value) {
                            if (config.running_value + config.increment > config.value) {
                                config.running_value = config.value;
                            } else {
                                config.running_value += config.increment;
Severity: Major
Found in themes/default/js/jquery.progressbar.js and 1 other location - About 1 hr to fix
themes/default/js/jquery.progressbar.js on lines 143..156

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

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

    public static function getOptions() {
        $default = array(
            'sq_beginner_user' => 1,
            'sq_api' => '',
            'sq_use' => 0,
Severity: Minor
Found in classes/SQ_Tools.php - About 1 hr to fix

    Method setHeader has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function setHeader() {
            global $wp_query;
            $ret = '';
            $this->post = $wp_query->get_queried_object();
            $this->meta['blogname'] = get_bloginfo('name');
    Severity: Minor
    Found in models/SQ_Frontend.php - About 1 hr to fix

      Function saveSitemap has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function saveSitemap($data) {
              if (function_exists('gzopen') && function_exists('gzwrite') && function_exists('gzclose')) {
                  if (function_exists('file_exists') && file_exists($this->file . '.gz'))
                      @unlink($this->file . '.gz');
      
      Severity: Minor
      Found in classes/SQ_Sitemap.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 squirrlyLogin has a Cognitive Complexity of 12 (exceeds 5 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

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

          public static function loadMedia($uri = '', $media = 'all', $params = null) {
              $css_uri = '';
              $js_uri = '';
      
              if (isset(self::$cache[$uri]))
      Severity: Minor
      Found in classes/SQ_DisplayController.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 apiCall has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function apiCall($module, $args = array(), $timeout = 60) {
              $parameters = "";
      
              if (SQ_Tools::$options['sq_api'] == '' && $module <> 'sq/login' && $module <> 'sq/register')
                  return false;
      Severity: Minor
      Found in classes/SQ_Action.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 packBrief has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          public function packBrief($response) {
              if (!isset($response->seo))
                  return;
      
              if (isset($response->seo) && ($response->seo->optimized == '0%')) {
      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 getCustomKeyword has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getCustomKeyword() {
              global $wp_query;
              $keywords = '';
      
              if ($this->checkPostsPage() && SQ_Tools::$options['sq_auto_description'] == 1) {
      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

      Method packBrief has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function packBrief($response) {
              if (!isset($response->seo))
                  return;
      
              if (isset($response->seo) && ($response->seo->optimized == '0%')) {
      Severity: Minor
      Found in models/SQ_PostsList.php - About 1 hr to fix

        Method getTrafficZone has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getTrafficZone() {
        
                $traffic = $this->packTraffic($this->interval);
        
                $str = '';
        Severity: Minor
        Found in models/SQ_PostsList.php - About 1 hr to fix

          Method createBdTables has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function createBdTables() {
                  global $wpdb;
                  if ($wpdb->get_var("SHOW TABLES LIKE '" . $this->analytics_table . "'") != $this->analytics_table) {
                      $sql = "CREATE TABLE `" . $this->analytics_table . "` (
                              `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
          Severity: Minor
          Found in classes/SQ_Traffic.php - About 1 hr to fix

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

                jQuery.getJSON(
                        api_url + 'sq/user/info/?callback=?',
                        {
                            token: token,
                            lang: (document.getElementsByTagName("html")[0].getAttribute("lang") || window.navigator.language)
            Severity: Major
            Found in themes/default/js/sq_menu.js and 1 other location - About 1 hr to fix
            themes/default/js/sq_menu.js on lines 313..328

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

            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.getJSON(
                        api_url + 'sq/user/status/?callback=?',
                        {
                            token: token,
                            lang: (document.getElementsByTagName("html")[0].getAttribute("lang") || window.navigator.language),
            Severity: Major
            Found in themes/default/js/sq_menu.js and 1 other location - About 1 hr to fix
            themes/default/js/sq_menu.js on lines 292..303

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

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

                public function getOthersSERPZone($serp) {
                    $str = '';
            
                    if (!is_array($serp))
                        return $str;
            Severity: Minor
            Found in models/SQ_PostsList.php - About 1 hr to fix

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

                  public static function checkErrorSettings($count_only = false) {
              
              
                      if (function_exists('is_network_admin') && is_network_admin())
                          return;
              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

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

                  private function checkWs() {
                      if (!self::$options['sq_ws'])
                          return;
              
                      //if debug is called
              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

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

                  function hookNotices() {
                      if (is_array(self::$errors))
                          foreach (self::$errors as $error) {
              
                              switch ($error['type']) {
              Severity: Minor
              Found in classes/SQ_Error.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 squirrlyRegister has a Cognitive Complexity of 11 (exceeds 5 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

              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