Showing 427 of 427 total issues
Function is_page_included
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function is_page_included() {
global $aioseop_options;
if ( is_feed() ) return false;
if ( aioseop_mrt_exclude_this_page() ) return false;
$post = $this->get_queried_object();
- 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
Function generate_htaccess_blocklist
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function generate_htaccess_blocklist() {
if ( !$this->option_isset( 'htaccess_rules' ) ) return;
if ( function_exists( 'apache_get_modules' ) ) {
$modules = apache_get_modules();
foreach( Array( 'mod_authz_host', 'mod_setenvif' ) as $m ) {
- 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_page_snippet_info
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_page_snippet_info() {
static $info = Array();
if ( !empty( $info ) )
return $info;
global $post, $aioseop_options, $wp_query;
Function post_data_export
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function post_data_export( $prefix = '_aioseop', $query = Array( 'posts_per_page' => -1 ) ) {
$buf = '';
$posts_query = new WP_Query( $query );
while ($posts_query->have_posts() ) {
$posts_query->the_post();
- 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
Function get_prio_calc
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
function get_prio_calc( $date, $stats = 0 ) {
static $cur_time = null;
if ($cur_time === null) $cur_time = time();
$time = $cur_time - mysql2date( 'U', $date );
if ( !empty( $stats ) && isset( $stats['max'] ) && ( $stats['max'] ) ) {
- 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
Function filter_options
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function filter_options( $options, $location ) {
if ( $location == 'aiosp' ) {
global $post;
if ( !empty( $post ) ) {
$prefix = $this->prefix;
- 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
Function output_robots
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function output_robots($rules) {
$robots = '';
foreach ($rules as $r) {
foreach ( $r['comment'] as $c) $robots .= "$c\n";
foreach ( $r['user-agent'] as $u) if ( $u != '' ) $robots .= "User-agent: $u\n";
- 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
Function __construct
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function __construct( $mod ) {
$this->name = __('Feature Manager', 'all-in-one-seo-pack'); // Human-readable name of the plugin
$this->prefix = 'aiosp_feature_manager_'; // 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
Function do_notify
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function do_notify() {
$notify_url = Array( 'google' => 'http://www.google.com/webmasters/sitemaps/ping?sitemap=',
'bing' => 'http://www.bing.com/webmaster/ping.aspx?siteMap='
);
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
"home_page_title_format" =>
__( "This controls the format of the title tag for your Home Page.<br />The following macros are supported:", 'all-in-one-seo-pack' )
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
__( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
- Read upRead up
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 149.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
"page_title_format" =>
__( "This controls the format of the title tag for Pages.<br />The following macros are supported:", 'all-in-one-seo-pack' )
. '<ul><li>' . __( '%blog_title% - Your blog title', 'all-in-one-seo-pack' ) . '</li><li>' .
__( '%blog_description% - Your blog description', 'all-in-one-seo-pack' ) . '</li><li>' .
__( '%page_title% - The original title of the page', 'all-in-one-seo-pack' ) . '</li><li>' .
- Read upRead up
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 149.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method do_importer_exporter
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
function do_importer_exporter( ) {
$submit = null; $count = 0; $post_exists = null; $post_warning = null;
global $aioseop_options, $aiosp, $aioseop_module_list;
if ( isset( $_REQUEST['nonce-aioseop'] ) ) $nonce = $_REQUEST['nonce-aioseop'];
$post_fields = Array( 'keywords', 'description', 'title', 'meta', 'disable', 'disable', 'disable_analytics', 'titleatr', 'menulabel', 'togglekeywords' );
Function get_robot_user_agents
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function get_robot_user_agents($rules) {
$opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
$user_agents = Array();
foreach ($rules as $r) {
if ( !empty( $r['sitemap'] ) && empty( $r['user-agent'] ) ) $r['user-agent'] = Array( null );
- 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
Function cf_field_replace
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function cf_field_replace( $matches ) {
$result = '';
if ( !empty( $matches ) ) {
if ( !empty( $matches[1] ) ) {
if ( function_exists( 'get_field' ) ) $result = get_field( $matches[1] );
- 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
Function get_sitemap_data
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
function get_sitemap_data( $sitemap_type, $page = 0 ) {
$sitemap_data = Array();
if ( $this->options["{$this->prefix}indexes"] ) {
$posttypes = $this->options["{$this->prefix}posttypes"];
if ( empty( $posttypes ) ) $posttypes = Array();
- 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
File aioseop_module.js
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
if ( typeof aiosp_data != 'undefined' ) {
jQuery.each( aiosp_data, function( index, value ) {
// aiosp_data[index] = value.json.replace(/"/g, '"');
// aiosp_data[index] = jQuery.parseJSON( value );
if ( index == 0 ) {
Method get_all_images_by_type
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_all_images_by_type( $options = null, $p = null ) {
$img = Array();
if ( empty( $img ) ) {
$size = apply_filters( 'post_thumbnail_size', 'large' );
Function get_archive_prio_from_posts
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function get_archive_prio_from_posts( $posts ) {
$archives = Array();
if ( is_array( $posts ) )
foreach( $posts as $p ) {
if ( $p->post_type != 'post' ) continue;
- 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
Function __construct
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function __construct( ) {
if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class
$this->name = __( 'XML Sitemap', 'all-in-one-seo-pack' ); // Human-readable name of the plugin
$this->prefix = 'aiosp_sitemap_'; // option prefix
$this->file = __FILE__; // the current file
- 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
Function output_sitemap_index
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function output_sitemap_index( $urls, $comment = '' ) {
$max_items = 50000;
if ( !is_array( $urls ) ) return null;
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n\r\n";
echo "<!-- " . sprintf( $this->comment_string, $comment, AIOSEOP_VERSION, date('D, d M Y H:i:s e') ) . " -->\r\n";
- 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"