Showing 7,504 of 7,504 total issues
Method delete_plugins
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function delete_plugins($plugins, $redirect = '' ) {
global $wp_filesystem;
if( empty($plugins) )
return false;
Method parse_comment
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parse_comment( $comment ) {
global $wpdb;
// Get the top-level attributes
preg_match( '|<comment([^>]+)>|i', $comment, $attribs );
Method search_theme_directories
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function search_theme_directories() {
global $wp_theme_directories, $wp_broken_themes;
if ( empty( $wp_theme_directories ) )
return false;
Method mw_newMediaObject
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mw_newMediaObject($args) {
global $wpdb;
$blog_ID = (int) $args[0];
$username = $this->escape($args[1]);
Method openfile
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function openfile($filename) {
try {
if (!empty($this->startup_error)) {
throw new getid3_exception($this->startup_error);
}
Method wp_update_term
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_update_term( $term_id, $taxonomy, $args = array() ) {
global $wpdb;
if ( ! is_taxonomy($taxonomy) )
return new WP_Error('invalid_taxonomy', __('Invalid taxonomy'));
Method MPEGaudioHeaderValid
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function MPEGaudioHeaderValid($rawarray, $echoerrors=false, $allowBitrate15=false) {
if (($rawarray['synch'] & 0x0FFE) != 0x0FFE) {
return false;
}
Method date_rfc2822
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function date_rfc2822($date)
{
static $pcre;
if (!$pcre)
{
Method wp_update_themes
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_update_themes( ) {
global $wp_version;
if( defined( 'WP_INSTALLING' ) )
return false;
Method enqueue_scripts
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function enqueue_scripts() {
wp_enqueue_style( 'customize-widgets' );
wp_enqueue_script( 'customize-widgets' );
/** This action is documented in wp-admin/admin-header.php */
Method wp_notify_postauthor
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_notify_postauthor($comment_id, $comment_type='') {
$comment = get_comment($comment_id);
$post = get_post($comment->comment_post_ID);
$user = get_userdata( $post->post_author );
$current_user = wp_get_current_user();
Method wp_salt
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wp_salt($scheme = 'auth') {
global $wp_default_secret_key;
$secret_key = '';
if ( defined('SECRET_KEY') && ('' != SECRET_KEY) && ( $wp_default_secret_key != SECRET_KEY) )
$secret_key = SECRET_KEY;
Method date_rfc2822
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function date_rfc2822($date)
{
static $pcre;
if (!$pcre)
{
Method get_links
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function get_links($category = -1, $before = '', $after = '<br />', $between = ' ', $show_images = true, $orderby = 'name',
$show_description = true, $show_rating = false, $limit = -1, $show_updated = 1, $echo = true) {
_deprecated_function(__FUNCTION__, '0.0', 'get_bookmarks()');
$order = 'ASC';
Method wp_link_dialog
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function wp_link_dialog() {
$search_panel_visible = '1' == get_user_setting( 'wplink', '0' ) ? ' search-panel-visible' : '';
// display: none is required here, see #WP27605
?>
Method wpmu_validate_user_signup
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wpmu_validate_user_signup($user_name, $user_email) {
global $wpdb;
$errors = new WP_Error();
Method wpmu_validate_blog_signup
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
global $wpdb, $domain;
$current_site = get_current_site();
$base = $current_site->path;
File class-wp-image-editor-imagick.php
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* WordPress Imagick Image Editor
*
* @package WordPress
Identical blocks of code found in 2 locations. Consider refactoring. Open
dw_Rotator.pause = function(e) {
e = dw_Event.DOMit(e);
var id = e.target.id;
var obj = dw_Rotator.getInstanceById(id);
if (obj) { obj.clearTimer(); }
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 81.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
dw_Rotator.pause = function(e) {
e = dw_Event.DOMit(e);
var id = e.target.id;
var obj = dw_Rotator.getInstanceById(id);
if (obj) { obj.clearTimer(); }
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 81.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76