Showing 427 of 427 total issues
Function All_in_One_SEO_Pack_File_Editor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function All_in_One_SEO_Pack_File_Editor( ) {
$this->name = __('File Editor', 'all-in-one-seo-pack'); // Human-readable name of the plugin
$this->prefix = 'aiosp_file_editor_'; // option prefix
$this->file = __FILE__; // the current file
parent::__construct();
- Read upRead up
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 deeply nested control flow statements. Open
if ( !empty( $legacy[$thumbnail] ) )
$thumbnail = $legacy[$thumbnail];
Avoid deeply nested control flow statements. Open
if ( !empty( $keywords ) && !empty( $tag ) ) {
$tag .= ',' . $keywords;
} elseif ( empty( $tag ) ) {
$tag = $keywords;
}
Avoid deeply nested control flow statements. Open
for ($i = $top['where']; $i <= $c; ++$i)
$chrs = substr_replace($chrs, ' ', $i, 1);
Avoid deeply nested control flow statements. Open
if ( isset( $options['meta_key'] ) ) {
$meta_key = $options['meta_key'];
}
Avoid deeply nested control flow statements. Open
if ( empty( $excluded[$k] ) ) unset( $excluded[$k] );
Avoid deeply nested control flow statements. Open
if ( $sitemap_options["{$this->prefix}gzipped"] ) $url .= '.gz';
Function cache_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function cache_options() {
static $start = true;
if ( $start ) {
$this->cache_struct = get_option( 'permalink_structure' );
if ( !empty( $this->cache_struct ) ) add_filter( 'pre_option_permalink_structure', Array( $this, 'cache_structure' ) );
- Read upRead up
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 deeply nested control flow statements. Open
if ( !empty( $d ) ) {
if ( !empty( $domain_list ) )
$domain_list .= ", ";
$domain_list .= "'" . $d . "'";
}
Avoid deeply nested control flow statements. Open
if (reset($stk) == SERVICES_JSON_IN_ARR) {
// we are in an array, so just push an element onto the stack
array_push($arr, $this->decode($slice));
} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
Avoid deeply nested control flow statements. Open
if ( defined( 'SUNRISE' ) && SUNRISE && is_object( $wpdb ) && isset( $wpdb->dmtable ) && !empty( $wpdb->dmtable ) ) {
$domain = $wpdb->get_var( "SELECT domain FROM {$wpdb->dmtable} WHERE blog_id = '$blog_id' AND active = 1 LIMIT 1" );
if ( $domain ) {
if ( false == isset( $_SERVER[ 'HTTPS' ] ) )
$_SERVER[ 'HTTPS' ] = 'Off';
Function update_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function update_options( $opts = Array(), $location = null, $defaults = null ) {
if ($location === null )
$type = 'settings';
else
$type = $this->locations[$location][$type];
- Read upRead up
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 deeply nested control flow statements. Open
if ( !$siteurl ) $siteurl = get_home_url( $blog_id );
Avoid deeply nested control flow statements. Open
if( is_array( $module_options ) ) {
foreach( $module_options as $key => $value ) {
/* Update Post Data */
if( $label == 'post_data' ) {
$post_exists = post_exists( $module_options[$key]['post_title'], '', $module_options[$key]['post_date'] );
Function get_class_option
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function get_class_option( ) {
$option_name = $this->get_option_name();
if ( $this->store_option || $option_name == $this->parent_option ) {
return get_option( $option_name );
} else {
- Read upRead up
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 deeply nested control flow statements. Open
if ( $post->ID == get_option( 'page_for_posts' ) )
$wp_query->is_home = true;
Function do_write_sitemap
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function do_write_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
if ( empty( $filename ) ) {
if ( $sitemap_type == 'root' ) {
$filename = $this->options["{$this->prefix}filename"];
} else {
- Read upRead up
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 ( ( $aiosp_nofollow == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) && ( ( $page > 1 ) ) ) ||
( ( $aiosp_nofollow == '' ) && ( !empty( $aioseop_options['aiosp_cpostnofollow'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnofollow'] ) ) ) )
$nofollow = "no" . $nofollow;
Consider simplifying this complex logical expression. Open
if ( ( ( $title_type == 'archive' ) && is_post_type_archive( $wp_post_types ) && $prefix = "aiosp_{$title_type}_" ) ||
( ( $title_type == 'post' ) && $this->is_singular( $wp_post_types, $p ) && $prefix = "aiosp_" ) ) {
$post_type = get_post_type( $p );
if ( !empty( $aioseop_options["{$prefix}{$post_type}_title_format"] ) ) {
$title_format = $aioseop_options["{$prefix}{$post_type}_title_format"];
Consider simplifying this complex logical expression. Open
if ( empty( $description ) && $first_page && ( !empty( $this->options['aiosp_opengraph_generate_descriptions'] ) ) && !empty( $post ) && !empty( $post->post_content ) && !post_password_required( $post ) )
$description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $post->post_content ) ), 1000 );