lesterchan/wp-sweep

View on GitHub

Showing 34 of 326 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

            case 'duplicated_usermeta':
                $query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(umeta_id ORDER BY umeta_id DESC) AS ids, user_id, COUNT(*) AS count FROM $wpdb->usermeta GROUP BY user_id, meta_key, meta_value HAVING count > %d", 1 ) );
                if ( $query ) {
                    foreach ( $query as $meta ) {
                        $ids = array_map( 'intval', explode( ',', $meta->ids ) );
Severity: Major
Found in inc/class-wpsweep.php and 3 other locations - About 4 hrs to fix
inc/class-wpsweep.php on lines 685..697
inc/class-wpsweep.php on lines 698..710
inc/class-wpsweep.php on lines 724..736

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 171.

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

            case 'duplicated_commentmeta':
                $query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(meta_id ORDER BY meta_id DESC) AS ids, comment_id, COUNT(*) AS count FROM $wpdb->commentmeta GROUP BY comment_id, meta_key, meta_value HAVING count > %d", 1 ) );
                if ( $query ) {
                    foreach ( $query as $meta ) {
                        $ids = array_map( 'intval', explode( ',', $meta->ids ) );
Severity: Major
Found in inc/class-wpsweep.php and 3 other locations - About 4 hrs to fix
inc/class-wpsweep.php on lines 685..697
inc/class-wpsweep.php on lines 711..723
inc/class-wpsweep.php on lines 724..736

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 171.

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

            case 'duplicated_postmeta':
                $query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(meta_id ORDER BY meta_id DESC) AS ids, post_id, COUNT(*) AS count FROM $wpdb->postmeta GROUP BY post_id, meta_key, meta_value HAVING count > %d", 1 ) );
                if ( $query ) {
                    foreach ( $query as $meta ) {
                        $ids = array_map( 'intval', explode( ',', $meta->ids ) );
Severity: Major
Found in inc/class-wpsweep.php and 3 other locations - About 4 hrs to fix
inc/class-wpsweep.php on lines 698..710
inc/class-wpsweep.php on lines 711..723
inc/class-wpsweep.php on lines 724..736

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 171.

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

            case 'duplicated_termmeta':
                $query = $wpdb->get_results( $wpdb->prepare( "SELECT GROUP_CONCAT(meta_id ORDER BY meta_id DESC) AS ids, term_id, COUNT(*) AS count FROM $wpdb->termmeta GROUP BY term_id, meta_key, meta_value HAVING count > %d", 1 ) );
                if ( $query ) {
                    foreach ( $query as $meta ) {
                        $ids = array_map( 'intval', explode( ',', $meta->ids ) );
Severity: Major
Found in inc/class-wpsweep.php and 3 other locations - About 4 hrs to fix
inc/class-wpsweep.php on lines 685..697
inc/class-wpsweep.php on lines 698..710
inc/class-wpsweep.php on lines 711..723

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 171.

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

            case 'orphan_postmeta':
                $query = $wpdb->get_results( "SELECT post_id, meta_key FROM $wpdb->postmeta WHERE post_id NOT IN (SELECT ID FROM $wpdb->posts)" );
                if ( $query ) {
                    foreach ( $query as $meta ) {
                        $post_id = (int) $meta->post_id;
Severity: Major
Found in inc/class-wpsweep.php and 3 other locations - About 3 hrs to fix
inc/class-wpsweep.php on lines 602..617
inc/class-wpsweep.php on lines 618..633
inc/class-wpsweep.php on lines 634..649

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 147.

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

            case 'orphan_termmeta':
                $query = $wpdb->get_results( "SELECT term_id, meta_key FROM $wpdb->termmeta WHERE term_id NOT IN (SELECT term_id FROM $wpdb->terms)" );
                if ( $query ) {
                    foreach ( $query as $meta ) {
                        $term_id = (int) $meta->term_id;
Severity: Major
Found in inc/class-wpsweep.php and 3 other locations - About 3 hrs to fix
inc/class-wpsweep.php on lines 586..601
inc/class-wpsweep.php on lines 602..617
inc/class-wpsweep.php on lines 618..633

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 147.

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

            case 'orphan_usermeta':
                $query = $wpdb->get_results( "SELECT user_id, meta_key FROM $wpdb->usermeta WHERE user_id NOT IN (SELECT ID FROM $wpdb->users)" );
                if ( $query ) {
                    foreach ( $query as $meta ) {
                        $user_id = (int) $meta->user_id;
Severity: Major
Found in inc/class-wpsweep.php and 3 other locations - About 3 hrs to fix
inc/class-wpsweep.php on lines 586..601
inc/class-wpsweep.php on lines 602..617
inc/class-wpsweep.php on lines 634..649

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 147.

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

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

            case 'orphan_commentmeta':
                $query = $wpdb->get_results( "SELECT comment_id, meta_key FROM $wpdb->commentmeta WHERE comment_id NOT IN (SELECT comment_ID FROM $wpdb->comments)" );
                if ( $query ) {
                    foreach ( $query as $meta ) {
                        $comment_id = (int) $meta->comment_id;
Severity: Major
Found in inc/class-wpsweep.php and 3 other locations - About 3 hrs to fix
inc/class-wpsweep.php on lines 586..601
inc/class-wpsweep.php on lines 618..633
inc/class-wpsweep.php on lines 634..649

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 147.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

            case 'auto_drafts':
                $query = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_status = %s", 'auto-draft' ) );
                if ( $query ) {
                    foreach ( $query as $id ) {
                        wp_delete_post( (int) $id, true );
Severity: Major
Found in inc/class-wpsweep.php and 2 other locations - About 1 hr to fix
inc/class-wpsweep.php on lines 538..548
inc/class-wpsweep.php on lines 549..559

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 103.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

            case 'unapproved_comments':
                $query = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s", '0' ) );
                if ( $query ) {
                    foreach ( $query as $id ) {
                        wp_delete_comment( (int) $id, true );
Severity: Major
Found in inc/class-wpsweep.php and 2 other locations - About 1 hr to fix
inc/class-wpsweep.php on lines 516..526
inc/class-wpsweep.php on lines 549..559

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 103.

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

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

            case 'spam_comments':
                $query = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s", 'spam' ) );
                if ( $query ) {
                    foreach ( $query as $id ) {
                        wp_delete_comment( (int) $id, true );
Severity: Major
Found in inc/class-wpsweep.php and 2 other locations - About 1 hr to fix
inc/class-wpsweep.php on lines 516..526
inc/class-wpsweep.php on lines 538..548

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 103.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

            $.get(ajaxurl, { action: $node.data( 'action' ), sweep_name: $node.data( 'sweep_name' ), sweep_type: $node.data( 'sweep_type' ), '_wpnonce': $node.data( 'nonce' ) }, function(data) {
Severity: Minor
Found in js/wp-sweep.js and 1 other location - About 55 mins to fix
js/wp-sweep.js on lines 14..14

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 54.

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

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

                return $.get(ajaxurl, { action: $node.data( 'action' ), sweep_name: $node.data( 'sweep_name' ), sweep_type: $node.data( 'sweep_type' ), '_wpnonce': $node.data( 'nonce' ) }, function(data) {
Severity: Minor
Found in js/wp-sweep.js and 1 other location - About 55 mins to fix
js/wp-sweep.js on lines 50..50

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 54.

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

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

                    <?php if ( ! empty( $duplicated_postmeta ) ) : ?>
                        <button data-action="sweep" data-sweep_name="duplicated_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_duplicated_postmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button>
                        <button data-action="sweep_details" data-sweep_name="duplicated_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_duplicated_postmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button>
                    <?php else : ?>
                        <?php esc_html_e( 'N/A', 'wp-sweep' ); ?>
Severity: Major
Found in admin.php and 18 other locations - About 35 mins to fix
admin.php on lines 112..117
admin.php on lines 132..137
admin.php on lines 152..157
admin.php on lines 172..177
admin.php on lines 212..217
admin.php on lines 250..255
admin.php on lines 270..275
admin.php on lines 290..295
admin.php on lines 310..315
admin.php on lines 330..335
admin.php on lines 368..373
admin.php on lines 388..393
admin.php on lines 426..431
admin.php on lines 446..451
admin.php on lines 466..471
admin.php on lines 487..492
admin.php on lines 525..530
admin.php on lines 563..568

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 92.

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

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

                    <?php if ( ! empty( $orphan_postmeta ) ) : ?>
                        <button data-action="sweep" data-sweep_name="orphan_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_orphan_postmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button>
                        <button data-action="sweep_details" data-sweep_name="orphan_postmeta" data-sweep_type="postmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_orphan_postmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button>
                    <?php else : ?>
                        <?php esc_html_e( 'N/A', 'wp-sweep' ); ?>
Severity: Major
Found in admin.php and 18 other locations - About 35 mins to fix
admin.php on lines 112..117
admin.php on lines 132..137
admin.php on lines 152..157
admin.php on lines 192..197
admin.php on lines 212..217
admin.php on lines 250..255
admin.php on lines 270..275
admin.php on lines 290..295
admin.php on lines 310..315
admin.php on lines 330..335
admin.php on lines 368..373
admin.php on lines 388..393
admin.php on lines 426..431
admin.php on lines 446..451
admin.php on lines 466..471
admin.php on lines 487..492
admin.php on lines 525..530
admin.php on lines 563..568

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 92.

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

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

                    <?php if ( ! empty( $duplicated_commentmeta ) ) : ?>
                        <button data-action="sweep" data-sweep_name="duplicated_commentmeta" data-sweep_type="commentmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_duplicated_commentmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button>
                        <button data-action="sweep_details" data-sweep_name="duplicated_commentmeta" data-sweep_type="commentmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_duplicated_commentmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button>
                    <?php else : ?>
                        <?php esc_html_e( 'N/A', 'wp-sweep' ); ?>
Severity: Major
Found in admin.php and 18 other locations - About 35 mins to fix
admin.php on lines 112..117
admin.php on lines 132..137
admin.php on lines 152..157
admin.php on lines 172..177
admin.php on lines 192..197
admin.php on lines 212..217
admin.php on lines 250..255
admin.php on lines 270..275
admin.php on lines 290..295
admin.php on lines 310..315
admin.php on lines 368..373
admin.php on lines 388..393
admin.php on lines 426..431
admin.php on lines 446..451
admin.php on lines 466..471
admin.php on lines 487..492
admin.php on lines 525..530
admin.php on lines 563..568

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 92.

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

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

                <?php if ( ! empty( $orphan_termmeta ) ) : ?>
                    <button data-action="sweep" data-sweep_name="orphan_termmeta" data-sweep_type="termmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_orphan_termmeta' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button>
                    <button data-action="sweep_details" data-sweep_name="orphan_termmeta" data-sweep_type="termmeta" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_orphan_termmeta' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button>
                <?php else : ?>
                    <?php esc_html_e( 'N/A', 'wp-sweep' ); ?>
Severity: Major
Found in admin.php and 18 other locations - About 35 mins to fix
admin.php on lines 112..117
admin.php on lines 132..137
admin.php on lines 152..157
admin.php on lines 172..177
admin.php on lines 192..197
admin.php on lines 212..217
admin.php on lines 250..255
admin.php on lines 270..275
admin.php on lines 290..295
admin.php on lines 310..315
admin.php on lines 330..335
admin.php on lines 368..373
admin.php on lines 388..393
admin.php on lines 446..451
admin.php on lines 466..471
admin.php on lines 487..492
admin.php on lines 525..530
admin.php on lines 563..568

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 92.

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

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

                    <?php if ( ! empty( $auto_drafts ) ) : ?>
                        <button data-action="sweep" data-sweep_name="auto_drafts" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_auto_drafts' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button>
                        <button data-action="sweep_details" data-sweep_name="auto_drafts" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_auto_drafts' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button>
                    <?php else : ?>
                        <?php esc_html_e( 'N/A', 'wp-sweep' ); ?>
Severity: Major
Found in admin.php and 18 other locations - About 35 mins to fix
admin.php on lines 112..117
admin.php on lines 152..157
admin.php on lines 172..177
admin.php on lines 192..197
admin.php on lines 212..217
admin.php on lines 250..255
admin.php on lines 270..275
admin.php on lines 290..295
admin.php on lines 310..315
admin.php on lines 330..335
admin.php on lines 368..373
admin.php on lines 388..393
admin.php on lines 426..431
admin.php on lines 446..451
admin.php on lines 466..471
admin.php on lines 487..492
admin.php on lines 525..530
admin.php on lines 563..568

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 92.

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

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

                    <?php if ( ! empty( $transient_options ) ) : ?>
                        <button data-action="sweep" data-sweep_name="transient_options" data-sweep_type="options" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_transient_options' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button>
                        <button data-action="sweep_details" data-sweep_name="transient_options" data-sweep_type="options" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_transient_options' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button>
                    <?php else : ?>
                        <?php esc_html_e( 'N/A', 'wp-sweep' ); ?>
Severity: Major
Found in admin.php and 18 other locations - About 35 mins to fix
admin.php on lines 112..117
admin.php on lines 132..137
admin.php on lines 152..157
admin.php on lines 172..177
admin.php on lines 192..197
admin.php on lines 212..217
admin.php on lines 250..255
admin.php on lines 270..275
admin.php on lines 290..295
admin.php on lines 310..315
admin.php on lines 330..335
admin.php on lines 368..373
admin.php on lines 388..393
admin.php on lines 426..431
admin.php on lines 446..451
admin.php on lines 466..471
admin.php on lines 487..492
admin.php on lines 563..568

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 92.

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

Further Reading

Similar blocks of code found in 19 locations. Consider refactoring.
Open

                    <?php if ( ! empty( $revisions ) ) : ?>
                        <button data-action="sweep" data-sweep_name="revisions" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_revisions' ) ); ?>" class="button button-primary btn-sweep"><?php esc_html_e( 'Sweep', 'wp-sweep' ); ?></button>
                        <button data-action="sweep_details" data-sweep_name="revisions" data-sweep_type="posts" data-nonce="<?php echo esc_attr( wp_create_nonce( 'wp_sweep_details_revisions' ) ); ?>" class="button btn-sweep-details"><?php esc_html_e( 'Details', 'wp-sweep' ); ?></button>
                    <?php else : ?>
                        <?php esc_html_e( 'N/A', 'wp-sweep' ); ?>
Severity: Major
Found in admin.php and 18 other locations - About 35 mins to fix
admin.php on lines 132..137
admin.php on lines 152..157
admin.php on lines 172..177
admin.php on lines 192..197
admin.php on lines 212..217
admin.php on lines 250..255
admin.php on lines 270..275
admin.php on lines 290..295
admin.php on lines 310..315
admin.php on lines 330..335
admin.php on lines 368..373
admin.php on lines 388..393
admin.php on lines 426..431
admin.php on lines 446..451
admin.php on lines 466..471
admin.php on lines 487..492
admin.php on lines 525..530
admin.php on lines 563..568

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 92.

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

Further Reading

Severity
Category
Status
Source
Language