Showing 427 of 427 total issues
Method filter_settings
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function filter_settings( $settings, $location, $current ) {
if ( $location == null ) {
$prefix = $this->prefix;
foreach ( Array( 'seopostcol', 'seocustptcol', 'debug_info', 'max_words_excerpt' ) as $opt )
Method aioseop_admin_head
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function aioseop_admin_head() {
echo '<script type="text/javascript" src="' . AIOSEOP_PLUGIN_URL . 'quickedit_functions.js" ></script>';
?><style>
.aioseop_edit_button {
margin: 0 0 0 5px;
Method add_menu
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function add_menu( $parent_slug ) {
if ( !empty( $this->menu_name ) )
$name = $this->menu_name;
else
$name = $this->name;
Method setting_options
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setting_options( $location = null, $defaults = null ) {
if ( $defaults === null )
$defaults = $this->default_options;
$prefix = $this->get_prefix( $location );
$opts = Array();
Method __construct
has 54 lines of code (exceeds 25 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();
Method get_simple_sitemap
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_simple_sitemap() {
$home = Array(
'loc' => get_home_url(),
'priority' => $this->get_default_priority( 'homepage' ),
'changefreq' => $this->get_default_frequency( 'homepage' )
Method get_prev_next_links
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_prev_next_links( $post = null ) {
$prev = $next = '';
$page = $this->get_page_number();
if ( is_home() || is_archive() || is_paged() ) {
global $wp_query;
Method get_sitemap_index_filenames
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_sitemap_index_filenames() {
$files = Array();
$options = $this->options;
$prefix = $options["{$this->prefix}filename"];
$suffix = '.xml';
Function trim_excerpt_without_filters
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function trim_excerpt_without_filters( $text, $max = 0 ) {
$text = str_replace( ']]>', ']]>', $text );
$text = preg_replace( '|\[(.+?)\](.+?\[/\\1\])?|s', '', $text );
$text = wp_strip_all_tags( $text );
if ( !$max ) $max = $this->maximum_description_length;
- 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 display_option_div
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function display_option_div( $buf, $args ) {
$name = $img = $desc = $checkbox = $class = '';
if ( isset( $args['options']['help_text'] ) && !empty( $args['options']['help_text'] ) )
$desc .= '<p class="aioseop_desc">' . $args['options']['help_text'] . '</p>';
if ($args['value']) $class = ' active';
- 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 aioseop_add_contactmethods
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function aioseop_add_contactmethods( $contactmethods ) {
global $aioseop_options, $aioseop_modules;
if ( empty( $aioseop_options['aiosp_google_disable_profile'] ) )
$contactmethods['googleplus'] = __( 'Google+', 'all-in-one-seo-pack' );
if ( !empty( $aioseop_modules ) && is_object( $aioseop_modules ) ) {
- 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_term_priority_data
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function get_term_priority_data( $terms ) {
$prio = Array();
if (is_array( $terms ) ) {
$def_prio = $this->get_default_priority( 'taxonomies' );
$def_freq = $this->get_default_frequency( 'taxonomies' );
- 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
$help_text = Array(
'block_bots' => __( 'Block requests from user agents that are known to misbehave.', 'all-in-one-seo-pack' ),
'block_refer' => __( 'Block referral spam.', 'all-in-one-seo-pack' ),
'track_blocks'=> __( 'Log and show recent requests from blocked bots.', 'all-in-one-seo-pack' ),
'htaccess_rules'=>__( 'Block bad robots via Apaache .htaccess rules. Warning: this will change your web server configuration, make sure you are able to edit this file manually as well.', 'all-in-one-seo-pack' ),
- 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 122.
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
'People' => Array(
'actor' => __( 'Actor', 'all-in-one-seo-pack' ),
'athlete' => __( 'Athlete', 'all-in-one-seo-pack' ),
'author' => __( 'Author', 'all-in-one-seo-pack' ),
'director' => __( 'Director', 'all-in-one-seo-pack' ),
- 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 122.
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 get_all_keywords
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_all_keywords() {
global $posts;
global $aioseop_options;
if ( is_404() ) return null;
// if we are on synthetic pages
Method parse_annotated_robots
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse_annotated_robots( $robots ) {
$state = 0;
$rules = Array();
$opts = Array( 'sitemap', 'crawl-delay', 'user-agent', 'allow', 'disallow', 'comment' );
$rule = Array();
Method All_in_One_SEO_Pack_Performance
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function All_in_One_SEO_Pack_Performance( $mod ) {
$this->name = __('Performance', 'all-in-one-seo-pack'); // Human-readable name of the plugin
$this->prefix = 'aiosp_performance_'; // option prefix
$this->file = __FILE__; // the current file
parent::__construct();
Method get_prio_from_posts
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_prio_from_posts( $posts, $prio_override = false, $freq_override = false, $linkfunc = 'get_permalink' ) {
$prio = Array();
$args = Array( 'prio_override' => $prio_override, 'freq_override' => $freq_override, 'linkfunc' => $linkfunc );
if ( ( $prio_override ) && ( $freq_override ) )
$stats = 0;
Consider simplifying this complex logical expression. Open
if ( $aiosp_noindex || $aiosp_nofollow || $aiosp_noodp || $aiosp_noydir || !empty( $aioseop_options['aiosp_cpostnoindex'] )
|| !empty( $aioseop_options['aiosp_cpostnofollow'] ) || !empty( $aioseop_options['aiosp_cpostnoodp'] ) || !empty( $aioseop_options['aiosp_cpostnoydir'] )
|| !empty( $aioseop_options['aiosp_paginated_noindex'] ) || !empty( $aioseop_options['aiosp_paginated_nofollow'] ) ) {
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'] ) ) ) )
Method do_multi_input
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function do_multi_input( $args ) {
extract( $args );
$buf1 = '';
$type = $options['type'];
if ( ( $type == 'radio' ) || ( $type == 'checkbox' ) ) {