squirrly/squirrly-seo

View on GitHub

Showing 200 of 200 total issues

Function resizeImage has a Cognitive Complexity of 15 (exceeds 5 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

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

    public function getAdvancedMeta($post_id, $meta = 'title') {
        global $wpdb;
        $field = '';
        $cond = '';
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 getBrowserInfo has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getBrowserInfo() {
        $u_agent = $_SERVER['HTTP_USER_AGENT'];
        $bname = 'Unknown';
        $platform = 'Unknown';
        $version = "";
Severity: Minor
Found in classes/SQ_Tools.php - About 1 hr to fix

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

                if ($row->date >= date('Y-m-d', mktime(0, 0, 0, date('m', $this->now), date('d', $this->now) - 6, date('Y', $this->now)))) {
                    $traffic['week']['count'] += $row->count;
                    $traffic['week']['unique'] += $row->unique;
                }
    Severity: Major
    Found in classes/SQ_Traffic.php and 1 other location - About 1 hr to fix
    classes/SQ_Traffic.php on lines 201..204

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

    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 ($row->date >= date('Y-m-d', mktime(0, 0, 0, date('m', $this->now), date('d', $this->now) - 30, date('Y', $this->now)))) {
                    $traffic['month']['count'] += $row->count;
                    $traffic['month']['unique'] += $row->unique;
                }
    Severity: Major
    Found in classes/SQ_Traffic.php and 1 other location - About 1 hr to fix
    classes/SQ_Traffic.php on lines 196..199

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

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

        public function checkGoogleWTCode($code) {
            if ($code <> '') {
                if (strpos($code, 'content') !== false) {
                    preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
                    if (isset($result[1]) && !empty($result[1]))
    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 checkGoogleAnalyticsCode has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkGoogleAnalyticsCode($code) {
            //echo $code;
            if ($code <> '') {
                if (strpos($code, '_gaq.push') !== false) {
                    preg_match('/_gaq.push\(\[[\'\"]_setAccount[\'\"],\\s?[\'\"]([^\'\"]+)[\'\"]\]\)/i', $code, $result);
    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 setMetaInBuffer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private function setMetaInBuffer($buffer) {
            global $wp_query;
            $this->post = $wp_query->get_queried_object();
    
            if (is_home() || (isset($wp_query->query) && empty($wp_query->query)) || is_single() || is_preview() || is_page() || is_archive() || is_author() || is_category() || is_tag() || is_search()) {
    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 addSubmenu has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addSubmenu($param = null) {
            if ($param)
                $this->menu = $param;
    
            if (is_array($this->menu)) {
    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 checkFavebookInsightsCode has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkFavebookInsightsCode($code) {
            if ($code <> '') {
                if (strpos($code, 'content') !== false) {
                    preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
                    if (isset($result[1]) && !empty($result[1]))
    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 checkBingWTCode has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function checkBingWTCode($code) {
            if ($code <> '') {
                if (strpos($code, 'content') !== false) {
                    preg_match('/content\\s*=\\s*[\'\"]([^\'\"]+)[\'\"]/i', $code, $result);
                    if (isset($result[1]) && !empty($result[1]))
    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 getBrowserInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function getBrowserInfo() {
            $u_agent = $_SERVER['HTTP_USER_AGENT'];
            $bname = 'Unknown';
            $platform = 'Unknown';
            $version = "";
    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 addMenu has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        public function addMenu($param = null) {
            if ($param)
                $this->menu = $param;
    
            if (is_array($this->menu)) {
    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 sq_getSnippet has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function sq_getSnippet(url, show_url) {
        if (typeof url == 'undefined')
            url = '';
        if (typeof sq_blogurl != 'undefined')
            url = sq_blogurl;
    Severity: Minor
    Found in themes/default/js/sq_menu.js - About 1 hr to fix

      Method getOtherPluginsMeta has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getOtherPluginsMeta($post_id, $meta = 'title') {
              global $wpdb;
              $field = '';
              $cond = '';
      
      Severity: Minor
      Found in models/SQ_Frontend.php - About 1 hr to fix

        Function dump has a Cognitive Complexity of 13 (exceeds 5 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

        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_remote_get has a Cognitive Complexity of 13 (exceeds 5 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

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

            public function getAdvancedMeta($post_id, $meta = 'title') {
                global $wpdb;
                $field = '';
                $cond = '';
        
        Severity: Minor
        Found in models/SQ_Frontend.php - About 1 hr to fix

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

                  jQuery.getJSON(
                      sqQuery.ajaxurl,
                      {
                          action: 'sq_feedback',
                          feedback: jQuery("input[name=sq_feedback_face]:radio:checked").val(),
          Severity: Major
          Found in themes/default/js/sq_blocksupport.js and 1 other location - About 1 hr to fix
          themes/default/js/sq_blocklogin.js on lines 49..68

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

          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(
                      sqQuery.ajaxurl,
                      {
                          action: 'sq_login',
                          user: jQuery('#sq_user').val(),
          Severity: Major
          Found in themes/default/js/sq_blocklogin.js and 1 other location - About 1 hr to fix
          themes/default/js/sq_blocksupport.js on lines 69..89

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

          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

          Severity
          Category
          Status
          Source
          Language