wp-plugins/all-in-one-seo-pack

View on GitHub

Showing 427 of 427 total issues

Consider simplifying this complex logical expression.
Open

            if ( ( $mod == 'file_editor' || $mod == 'robots' )
                                         && ( ( ( defined( 'DISALLOW_FILE_EDIT' ) && DISALLOW_FILE_EDIT ) 
                                         || ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS )
                                         || !is_super_admin() ) ) )
                return false;
Severity: Major
Found in aioseop_module_manager.php - About 1 hr to fix

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

        function get_blog_page( $p = null ) {
            static $blog_page = '';
            static $page_for_posts = '';
            if ( $p === null ) {
                global $post;
    Severity: Minor
    Found in aioseop_class.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 get_loaded_module_list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_loaded_module_list() {
                $module_list = Array();
                if ( !empty( $this->modules ) ) {
                    foreach( $this->modules as $k => $v )
                        if ( !empty( $v ) )
    Severity: Minor
    Found in aioseop_module_manager.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 add_hooks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        function add_hooks() {
            global $aioseop_options;
            aioseop_update_settings_check();
            add_filter( 'user_contactmethods', 'aioseop_add_contactmethods' );
            if ( is_user_logged_in() && function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() && current_user_can( 'manage_options' ) )
    Severity: Minor
    Found in aioseop_class.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 aioseop_ajax_save_meta has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        function aioseop_ajax_save_meta() {
            if ( !empty( $_POST['_inline_edit'] ) && ( $_POST['_inline_edit'] != 'undefined' ) )
                check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
            $post_id = intval( $_POST['post_id'] );
            $new_meta = strip_tags( $_POST['new_meta'] );
    Severity: Minor
    Found in aioseop_functions.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 aioseop_filter_callback has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        function aioseop_filter_callback( $matches ) {
            if ( $matches[1] && !empty( $matches[1] ) ) $postID = $matches[1];
            if ( empty( $postID ) ) $postID = get_option( "page_on_front" );
            $title_attrib = stripslashes( get_post_meta($postID, '_aioseop_titleatr', true ) );
            if ( empty( $title_attrib ) && !empty( $matches[4] ) ) $title_attrib = $matches[4];
    Severity: Minor
    Found in aioseop_functions.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 filter_settings has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function filter_settings( $settings, $location ) {
                if ( $location == 'generator' ) {
                    $prefix = $this->get_prefix( $location ) . $location . '_';
                    if ( isset( $_POST['Submit_Optimize'] ) ) {
                        if ( isset( $settings[ $prefix . 'robotgen' ] ) ) {
    Severity: Minor
    Found in aioseop_robots.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 do_robots has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function do_robots( $options, $location ) {
                if ( $location ) $prefix = $this->get_prefix( $location ) . $location . '_';
                if ( $location === 'generator' ) {
                    if ( isset( $_POST['Submit_Update'] ) || isset( $_POST['Submit_Opt_Update'] ) ) {
                        $this->save_files( Array( 'robotgen' => 'robots.txt' ), $prefix );
    Severity: Minor
    Found in aioseop_robots.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 add_admin_bar_submenu has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function add_admin_bar_submenu() {
                global $aioseop_admin_menu, $wp_admin_bar;
                
                if ( $aioseop_admin_menu ) {
                    $links = $this->get_admin_links();
    Severity: Minor
    Found in aioseop_module_class.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 update_class_option has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function update_class_option( $option_data, $option_name = false ) {
                if ( $option_name == false )
                    $option_name = $this->get_option_name();
                if ( $this->store_option || $option_name == $this->parent_option ) {
                    return update_option( $option_name, $option_data );
    Severity: Minor
    Found in aioseop_module_class.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 csv_to_array has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function csv_to_array( $csv ) {
                $args = Array();
                if ( !function_exists( 'str_getcsv' ) )
                    $v = $this->str_getcsv( $csv );
                else
    Severity: Minor
    Found in aioseop_module_class.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 filter_pointers has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function filter_pointers() {
                if ( !empty( $this->pointers ) ) {
                    $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
                    foreach( $dismissed as $d )
                        if ( isset( $this->pointers[$d] ) )
    Severity: Minor
    Found in aioseop_module_class.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 get_the_image_by_author has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_the_image_by_author( $options = null, $p = null ) {
                if ( $p === null ) {
                    global $post;
                } else {
                    $post = $p;
    Severity: Minor
    Found in aioseop_opengraph.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 get_rewrite_url has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_rewrite_url( $url ) {
                global $wp_rewrite;
                $url = parse_url( esc_url( $url ), PHP_URL_PATH );
                $url = ltrim( $url, '/' );
                if ( !empty( $wp_rewrite ) ) {
    Severity: Minor
    Found in aioseop_sitemap.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

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

            function get_default_priority( $item, $nodefaults = false, $type = '' ) {
                $defaults = Array( 'homepage' => '1.0', 'blog' => '0.9', 'sitemap' => '0.8', 'post' => '0.7', 'archive' => '0.5', 'author' => '0.3', 'taxonomies' => '0.3' );
                static $cache = Array();
                return $this->get_default_values( $defaults, 'prio_', $cache, $item, $nodefaults, $type );
            }
    Severity: Minor
    Found in aioseop_sitemap.php and 1 other location - About 55 mins to fix
    aioseop_sitemap.php on lines 898..902

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

    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 ( is_array( $options["{$this->prefix}taxonomies"] ) && in_array( 'all', $options["{$this->prefix}taxonomies"] ) && is_array( $this->default_options['taxonomies' ]['initial_options'] ) )
                    $options["{$this->prefix}taxonomies"] = array_keys( $this->default_options['taxonomies' ]['initial_options'] );
    Severity: Minor
    Found in aioseop_sitemap.php and 1 other location - About 55 mins to fix
    aioseop_sitemap.php on lines 395..396

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

    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

            function reset_options( $location = null, $delete = false ) {
                if ( $delete === true ) {
                    $this->delete_class_option( $delete );
                    $this->options = Array();
                }
    Severity: Minor
    Found in aioseop_module_class.php and 1 other location - About 55 mins to fix
    aioseop_class.php on lines 1168..1177

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

    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

        function reset_options( $location = null, $delete = false ) {
            if ( $delete === true ) {
                $this->delete_class_option( $delete );
                $this->options = Array();
            }
    Severity: Minor
    Found in aioseop_class.php and 1 other location - About 55 mins to fix
    aioseop_module_class.php on lines 1738..1748

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

    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 ( is_array( $options["{$this->prefix}posttypes"] ) && in_array( 'all', $options["{$this->prefix}posttypes"] ) && is_array( $this->default_options['posttypes' ]['initial_options'] ) )
                    $options["{$this->prefix}posttypes"] = array_keys( $this->default_options['posttypes' ]['initial_options'] );
    Severity: Minor
    Found in aioseop_sitemap.php and 1 other location - About 55 mins to fix
    aioseop_sitemap.php on lines 397..398

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

    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

            function get_default_frequency( $item, $nodefaults = false, $type = '' ) {
                $defaults = Array( 'homepage' => 'always', 'blog' => 'daily', 'sitemap' => 'hourly', 'post' => 'weekly', 'archive' => 'monthly', 'author' => 'weekly', 'taxonomies' => 'monthly' );
                static $cache = Array();
                return $this->get_default_values( $defaults, 'freq_', $cache, $item, $nodefaults, $type );
            }
    Severity: Minor
    Found in aioseop_sitemap.php and 1 other location - About 55 mins to fix
    aioseop_sitemap.php on lines 891..895

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

    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