Function process_post
has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring. Open
function process_post($post) {
global $wpdb;
$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
if ( $post_ID && !empty($this->post_ids_processed[$post_ID]) ) // Processed already
- 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
File wordpress.php
has 646 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WordPress Importer
*
* @package WordPress
Method process_post
has 163 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process_post($post) {
global $wpdb;
$post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
if ( $post_ID && !empty($this->post_ids_processed[$post_ID]) ) // Processed already
Function get_entries
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
function get_entries($process_post_func=NULL) {
set_magic_quotes_runtime(0);
$doing_entry = false;
$is_wxr_file = 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
WP_Import
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class WP_Import {
var $post_ids_processed = array ();
var $orphans = array ();
var $file;
Function get_authors_from_post
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function get_authors_from_post() {
global $current_user;
// this will populate $this->author_ids with a list of author_names => user_ids
- 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
Method get_entries
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_entries($process_post_func=NULL) {
set_magic_quotes_runtime(0);
$doing_entry = false;
$is_wxr_file = false;
Function process_attachment
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function process_attachment($postdata, $remote_url) {
if ($this->fetch_attachments and $remote_url) {
printf( __('Importing attachment <em>%s</em>... '), htmlspecialchars($remote_url) );
// If the URL is absolute, but does not contain http, upload it assuming the base_site_url variable
- 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
Method wp_authors_form
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_authors_form() {
?>
<h2><?php _e('Assign Authors'); ?></h2>
<p><?php _e('To make it easier for you to edit and save the imported posts and drafts, you may want to change the name of the author of the posts. For example, you may want to import all the entries as <code>admin</code>s entries.'); ?></p>
<?php
Method process_attachment
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process_attachment($postdata, $remote_url) {
if ($this->fetch_attachments and $remote_url) {
printf( __('Importing attachment <em>%s</em>... '), htmlspecialchars($remote_url) );
// If the URL is absolute, but does not contain http, upload it assuming the base_site_url variable
Method fetch_remote_file
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function fetch_remote_file($post, $url) {
$upload = wp_upload_dir($post['post_date']);
// extract the file name and extension from the url
$file_name = basename($url);
Function process_terms
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function process_terms() {
global $wpdb, $wp_taxonomies;
$custom_taxonomies = $wp_taxonomies;
// get rid of the standard 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
Function dispatch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function dispatch() {
if (empty ($_GET['step']))
$step = 0;
else
$step = (int) $_GET['step'];
- 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 process_categories
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function process_categories() {
global $wpdb;
$cat_names = (array) get_terms('category', 'fields=names');
- 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 fetch_remote_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function fetch_remote_file($post, $url) {
$upload = wp_upload_dir($post['post_date']);
// extract the file name and extension from the url
$file_name = basename($url);
- 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 $upload;
Avoid too many return
statements within this method. Open
return new WP_Error( 'import_file_error', sprintf(__('Remote file is too large, limit is %s', size_format($max_size))) );