Showing 399 of 427 total issues
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
Avoid deeply nested control flow statements. Open
if ( !$siteurl ) $siteurl = get_home_url( $blog_id );
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
if ( $sitemap_options["{$this->prefix}gzipped"] ) $url .= '.gz';
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 ( 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 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
Method get_default_values
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function get_default_values( $defaults, $prefix, &$cache, $item, $nodefaults = false, $type = '' ) {
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 ( ( $aiosp_noindex == 'on' ) || ( ( !empty( $aioseop_options['aiosp_paginated_noindex'] ) ) && ( ( $page > 1 ) ) ) ||
( ( $aiosp_noindex == '' ) && ( !empty( $aioseop_options['aiosp_cpostnoindex'] ) ) && ( in_array( $post_type, $aioseop_options['aiosp_cpostnoindex'] ) ) ) )
$noindex = "no" . $noindex;
Consider simplifying this complex logical expression. Open
if ( !is_object( $post ) && is_admin() && !empty( $_GET ) && !empty( $_GET['post_type'] ) && !empty( $_GET['taxonomy'] ) && !empty( $_GET['tag_ID'] ) ) {
$term = get_term_by( 'id', $_GET['tag_ID'], $_GET['taxonomy'] );
}
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 ( 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 );
Method Services_JSON_Error
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
Method title_placeholder_helper
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function title_placeholder_helper( $title, $post, $type = 'post', $title_format = '', $category = '' ) {
Method Services_JSON_Error
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function Services_JSON_Error($message = 'unknown error', $code = null,
$mode = null, $options = null, $userinfo = null)
Method from_consumer_and_token
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function from_consumer_and_token($consumer, $token, $http_method, $http_url, $parameters=NULL) {
Method load_file
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function load_file( $filename, $use_include_path = false, $context = null, $offset = -1, $maxlen = -1 ) {
Function do_load_module
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function do_load_module( $mod, $args = null ) {
$mod_path = apply_filters( "aioseop_include_$mod", AIOSEOP_PLUGIN_DIR . "aioseop_$mod.php" );
if ( !empty( $mod_path ) )
require_once( $mod_path );
$ref = "aioseop_$mod";
- 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"