Showing 150 of 187 total issues
Avoid deeply nested control flow statements. Open
if ( isset( $labels['insert_into_item'] ) && $labels['insert_into_item'] ) {
$strings['insertIntoPost'] = $labels['insert_into_item'];
}
Function filter_table_sortable_column
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
protected function filter_table_sortable_column( $slug, $args ) {
if ( ! is_array( $args ) ) {
return false;
}
- 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 handle_term_row_actions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function handle_term_row_actions() {
global $taxnow;
// do not run this on a terms list
if ( ! isset( $_GET['tag_ID'] ) ) {
- 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 ( 'category' === $taxonomy_slug ) {
$column_key = 'categories';
} elseif ( 'post_tag' === $taxonomy_slug || 'tag' === $taxonomy_slug ) {
$column_key = 'tags';
}
Avoid deeply nested control flow statements. Open
if ( wpptd_supports_termmeta() ) {
$taxonomy->enqueue_assets();
}
Function initialize_term_ui
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function initialize_term_ui() {
$screen = get_current_screen();
if ( ! isset( $_REQUEST['tag_ID'] ) ) {
return;
}
- 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 ( false !== ( $key = array_search( $column_key, $taxonomies ) ) ) {
unset( $taxonomies[ $key ] );
}
Avoid deeply nested control flow statements. Open
if ( $taxonomy ) {
$this->render_taxonomy_column_filter( $column_slug, $taxonomy );
}
Avoid deeply nested control flow statements. Open
if ( isset( $labels['uploaded_to_this_item'] ) && $labels['uploaded_to_this_item'] ) {
$strings['uploadedToThisPost'] = $labels['uploaded_to_this_item'];
}
Method get_related_objects
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
public static function get_related_objects( $mode, $id, $objects_mode, $meta_key = '', $object_type = '', $single = false ) {
Consider simplifying this complex logical expression. Open
if ( ! class_exists( 'WPPTD\PostTypeTableHandler' ) ) {
/**
* This class handles the post list table for a post type registered with WPPTD.
*
* @internal
Consider simplifying this complex logical expression. Open
if ( ( 0 <= version_compare( get_bloginfo( 'version' ), '4.5' ) && 'term' === $screen->base ) || ( 0 > version_compare( get_bloginfo( 'version' ), '4.5' ) && 'edit-tags' === $screen->base && isset( $_GET['tag_ID'] ) && is_numeric( $_GET['tag_ID'] ) ) ) {
if ( wpptd_supports_termmeta() ) {
$taxonomy->enqueue_assets();
}
Function add_term_or_term_list_help
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function add_term_or_term_list_help() {
global $taxnow;
$taxonomy = ComponentManager::get( '*.*.' . $taxnow, 'WPDLib\Components\Menu.WPPTD\Components\PostType.WPPTD\Components\Taxonomy', true );
if ( $taxonomy ) {
- 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_by_meta
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function filter_by_meta( $value, $column_slug, $meta_key ) {
$meta_value = stripslashes( $value);
if ( $meta_value ) {
$this->active_filters[ $column_slug ] = $meta_value;
if ( 'bool:true' === $meta_value ) {
- 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 add_metaboxes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function add_metaboxes( $metaboxes, $post_type ) {
foreach ( $metaboxes as $metabox_slug => $metabox_args ) {
$metabox = $post_type->add( new Metabox( $metabox_slug, $metabox_args ) );
if ( is_wp_error( $metabox ) ) {
self::doing_it_wrong( __METHOD__, $metabox->get_error_message(), '0.5.0' );
- 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_labels
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function generate_labels( $plural_name, $singular_name, $type = 'labels', $gender = 'neuter' ) {
$gender_map = array( 'm' => 'masculine', 'f' => 'feminine', 'n' => 'neuter' );
if ( isset( $gender_map[ $gender ] ) ) {
$gender = $gender_map[ $gender ];
}
- 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_labels
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static function generate_labels( $plural_name, $singular_name, $type = 'labels', $gender = 'neuter' ) {
$gender_map = array( 'm' => 'masculine', 'f' => 'feminine', 'n' => 'neuter' );
if ( isset( $gender_map[ $gender ] ) ) {
$gender = $gender_map[ $gender ];
}
- 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 add_menus
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function add_menus( $menus ) {
foreach ( $menus as $menu_slug => $menu_args ) {
$menu = $this->add( new Menu( $menu_slug, $menu_args ) );
if ( is_wp_error( $menu ) ) {
self::doing_it_wrong( __METHOD__, $menu->get_error_message(), '0.5.0' );
- 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 validate_meta_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function validate_meta_value( $meta_value = null, $skip_required = false ) {
if ( $this->args['required'] && ! $skip_required ) {
if ( $meta_value === null || $this->_field->is_empty( $meta_value ) ) {
return new WPError( 'invalid_empty_value', __( 'No value was provided for the required field.', 'post-types-definitely' ) );
}
- 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 too many return
statements within this method. Open
return true;