squirrly/squirrly-seo

View on GitHub

Showing 200 of 200 total issues

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

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

        if (!isset(self::$config)) {
            $config_file = _SQ_CORE_DIR_ . 'config.xml';
            if (!file_exists($config_file))
                return;
Severity: Minor
Found in classes/SQ_Action.php and 1 other location - About 30 mins to fix
classes/SQ_ObjController.php on lines 133..142

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

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

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

        if (!isset(self::$config)) {
            $config_file = _SQ_CORE_DIR_ . 'config.xml';
            if (!file_exists($config_file))
                return;
Severity: Minor
Found in classes/SQ_ObjController.php and 1 other location - About 30 mins to fix
classes/SQ_Action.php on lines 74..83

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

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

Avoid too many return statements within this method.
Open

        return 0;
Severity: Major
Found in classes/SQ_Ranking.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

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

      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;
        Severity: Major
        Found in models/SQ_Menu.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return $out;
          Severity: Major
          Found in models/SQ_Menu.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

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

                          if (!isset($other_keywords[$row->keyword]['global']) || $other_keywords[$row->keyword]['global'] == 0) {
                              $row->global_rank = $this->getGoogleRank($post_id, $row->keyword);
                              if ($row->global_rank > 0) {
                                  //Save results
                                  $this->saveOtherRank($post_id, $row->global_rank, 'global', $row->keyword);
              Severity: Minor
              Found in classes/SQ_Ranking.php and 1 other location - About 30 mins to fix
              classes/SQ_Ranking.php on lines 110..116

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

              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 (!isset($other_keywords[$row->keyword]['local']) || $other_keywords[$row->keyword]['local'] == 0) {
                                  $row->local_rank = $this->getGoogleRank($post_id, $row->keyword);
                                  if ($row->local_rank > 0) {
                                      //Save results
                                      $this->saveOtherRank($post_id, $row->global_rank, 'local', $row->keyword);
              Severity: Minor
              Found in classes/SQ_Ranking.php and 1 other location - About 30 mins to fix
              classes/SQ_Ranking.php on lines 100..106

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

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

                  function action() {
                      parent::action();
                      switch (SQ_Tools::getValue('action')) {
                          //login action
                          case 'sq_settings_affiliate':
              Severity: Minor
              Found in core/SQ_BlockAffiliate/SQ_BlockAffiliate.php - About 25 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 searchPhrase has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  function searchPhrase($text) {
                      $words = explode(".", strtolower($text));
                      //print_r($words);
                      $frequencies = array();
                      foreach ($words as $str) {
              Severity: Minor
              Found in models/SQ_Frontend.php - About 25 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 saveAdvMeta has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function saveAdvMeta($post_id, $metas) {
                      global $wpdb;
              
                      if ((int) $post_id == 0 || !is_array($metas))
                          return;
              Severity: Minor
              Found in models/SQ_Post.php - About 25 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 setAdminHooks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function setAdminHooks($instance) {
              
                      /* for each admin action check if is defined in class and call it */
                      foreach ($this->admin_hooks as $hook => $value) {
              
              Severity: Minor
              Found in classes/SQ_HookController.php - About 25 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 searchPost has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function searchPost($q, $exclude = array(), $start = 0, $nbr = 8) {
                      global $wpdb;
                      $responce = array();
                      if (sizeof($exclude) > 1) {
                          $exclude = join(',', $exclude);
              Severity: Minor
              Found in models/SQ_Post.php - About 25 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