CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/includes/image.php

Summary

Maintainability
D
1 day
Test Coverage

Function wp_read_image_metadata has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
Open

function wp_read_image_metadata( $file ) {
    if ( !file_exists( $file ) )
        return false;

    list(,,$sourceImageType) = getimagesize( $file );
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/image.php - About 5 hrs to fix

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 wp_generate_attachment_metadata has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
Open

function wp_generate_attachment_metadata( $attachment_id, $file ) {
    $attachment = get_post( $attachment_id );

    $metadata = array();
    if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/image.php - About 3 hrs to fix

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 wp_read_image_metadata has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function wp_read_image_metadata( $file ) {
    if ( !file_exists( $file ) )
        return false;

    list(,,$sourceImageType) = getimagesize( $file );
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/image.php - About 1 hr to fix

    Method wp_generate_attachment_metadata has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wp_generate_attachment_metadata( $attachment_id, $file ) {
        $attachment = get_post( $attachment_id );
    
        $metadata = array();
        if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/includes/image.php - About 1 hr to fix

      Method wp_crop_image has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/includes/image.php - About 1 hr to fix

        Function wp_crop_image has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
            if ( is_numeric( $src_file ) ) // Handle int as attachment ID
                $src_file = get_attached_file( $src_file );
        
            $src = wp_load_image( $src_file );
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/image.php - About 35 mins to fix

        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

        There are no issues that match your filters.

        Category
        Status