CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/press-this.php

Summary

Maintainability
D
1 day
Test Coverage

File press-this.php has 492 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Press This Display and Handler.
 *
 * @package WordPress
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/press-this.php - About 7 hrs to fix

    Function get_images_from_uri has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

            function get_images_from_uri($uri) {
                $uri = preg_replace('/\/#.+?$/','', $uri);
                if( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') )
                    return "'" . esc_attr( html_entity_decode($uri) ) . "'";
                $content = wp_remote_fopen($uri);
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/press-this.php - About 2 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 press_it has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function press_it() {
        // define some basic variables
        $quick['post_status'] = 'draft'; // set as draft first
        $quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
        $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/press-this.php - About 1 hr 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 press_it has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function press_it() {
        // define some basic variables
        $quick['post_status'] = 'draft'; // set as draft first
        $quick['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : null;
        $quick['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : null;
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-admin/press-this.php - About 1 hr to fix

      There are no issues that match your filters.

      Category
      Status