Showing 8 of 10 total issues
Method atf_create_initial_taxonomies
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function atf_create_initial_taxonomies() {
register_taxonomy( 'attachment_category', 'attachment', array(
'public' => false,
'show_ui' => true,
'show_in_menu' => true,
Method atf_print_media_templates
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function atf_print_media_templates() {
ob_start();
wp_print_media_templates();
$output = ob_get_clean();
Method atf_media_print_styles
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function atf_media_print_styles() {
$taxonomies = get_object_taxonomies( 'attachment', 'names' );
if ( empty( $taxonomies ) ) {
return;
}
Function atf_render_taxonomy_filters
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function atf_render_taxonomy_filters( $post_type ) {
if ( 'attachment' !== $post_type && 'upload' !== get_current_screen()->base ) {
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
Function atf_save_ajax_attachment_taxonomies
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function atf_save_ajax_attachment_taxonomies( $attachment_id ) {
if ( ! doing_action( 'wp_ajax_save-attachment' ) ) {
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
Function atf_print_media_templates
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function atf_print_media_templates() {
ob_start();
wp_print_media_templates();
$output = ob_get_clean();
- 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 atf_default_scripts
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function atf_default_scripts( &$scripts ) {
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
$scripts->add( 'attachment-taxonomies', ATF_URL . WPINC . '/js/library' . $suffix . '.js', array( 'jquery', 'media-views' ), false, 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 atf_add_taxonomies_to_attachment_js
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function atf_add_taxonomies_to_attachment_js( $response, $attachment ) {
$response['taxonomies'] = array();
foreach ( get_object_taxonomies( 'attachment', 'names' ) as $taxonomy_slug ) {
$response['taxonomies'][ $taxonomy_slug ] = 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"