felixarntz/post-types-definitely

View on GitHub

Showing 187 of 187 total issues

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

        private static function get_labels_feminine( $plural_name, $singular_name ) {
            return array(
                'name'                  => $plural_name,
                'singular_name'         => $singular_name,
                'menu_name'             => $plural_name,
Severity: Major
Found in inc/WPPTD/PostTypeLabelGenerator.php and 2 other locations - About 3 days to fix
inc/WPPTD/PostTypeLabelGenerator.php on lines 61..93
inc/WPPTD/PostTypeLabelGenerator.php on lines 145..177

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

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

        private static function get_labels_masculine( $plural_name, $singular_name ) {
            return array(
                'name'                  => $plural_name,
                'singular_name'         => $singular_name,
                'menu_name'             => $plural_name,
Severity: Major
Found in inc/WPPTD/PostTypeLabelGenerator.php and 2 other locations - About 3 days to fix
inc/WPPTD/PostTypeLabelGenerator.php on lines 103..135
inc/WPPTD/PostTypeLabelGenerator.php on lines 145..177

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

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

        private static function get_labels_neuter( $plural_name, $singular_name ) {
            return array(
                'name'                  => $plural_name,
                'singular_name'         => $singular_name,
                'menu_name'             => $plural_name,
Severity: Major
Found in inc/WPPTD/PostTypeLabelGenerator.php and 2 other locations - About 3 days to fix
inc/WPPTD/PostTypeLabelGenerator.php on lines 61..93
inc/WPPTD/PostTypeLabelGenerator.php on lines 103..135

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

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

        private static function get_labels_feminine( $plural_name, $singular_name ) {
            return array(
                'name'                            => $plural_name,
                'singular_name'                    => $singular_name,
                'menu_name'                        => $plural_name,
Severity: Major
Found in inc/WPPTD/TaxonomyLabelGenerator.php and 2 other locations - About 2 days to fix
inc/WPPTD/TaxonomyLabelGenerator.php on lines 61..87
inc/WPPTD/TaxonomyLabelGenerator.php on lines 133..159

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

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

        private static function get_labels_neuter( $plural_name, $singular_name ) {
            return array(
                'name'                            => $plural_name,
                'singular_name'                    => $singular_name,
                'menu_name'                        => $plural_name,
Severity: Major
Found in inc/WPPTD/TaxonomyLabelGenerator.php and 2 other locations - About 2 days to fix
inc/WPPTD/TaxonomyLabelGenerator.php on lines 61..87
inc/WPPTD/TaxonomyLabelGenerator.php on lines 97..123

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

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

        private static function get_labels_masculine( $plural_name, $singular_name ) {
            return array(
                'name'                            => $plural_name,
                'singular_name'                    => $singular_name,
                'menu_name'                        => $plural_name,
Severity: Major
Found in inc/WPPTD/TaxonomyLabelGenerator.php and 2 other locations - About 2 days to fix
inc/WPPTD/TaxonomyLabelGenerator.php on lines 97..123
inc/WPPTD/TaxonomyLabelGenerator.php on lines 133..159

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

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

Function get_related_objects has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
Open

        public static function get_related_objects( $mode, $id, $objects_mode, $meta_key = '', $object_type = '', $single = false ) {
            // specify variables depending on the base mode
            switch ( $mode ) {
                case 'post':
                    $get_func = 'get_post';
Severity: Minor
Found in inc/WPPTD/Utility.php - About 1 day 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

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

        private static function get_bulk_messages_masculine( $plural_name, $singular_name ) {
            return array(
                'updated'    => array(
                    sprintf( _x( '%%s %s updated.', 'bulk post message: first argument is a number, second is the singular post type label (masculine)', 'post-types-definitely' ), $singular_name ),
                    sprintf( _x( '%%s %s updated.', 'bulk post message: first argument is a number, second is the plural post type label (masculine)', 'post-types-definitely' ), $plural_name ),
Severity: Major
Found in inc/WPPTD/PostTypeLabelGenerator.php and 2 other locations - About 1 day to fix
inc/WPPTD/PostTypeLabelGenerator.php on lines 292..315
inc/WPPTD/PostTypeLabelGenerator.php on lines 325..348

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

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

        private static function get_bulk_messages_neuter( $plural_name, $singular_name ) {
            return array(
                'updated'    => array(
                    sprintf( _x( '%%s %s updated.', 'bulk post message: first argument is a number, second is the singular post type label (neuter)', 'post-types-definitely' ), $singular_name ),
                    sprintf( _x( '%%s %s updated.', 'bulk post message: first argument is a number, second is the plural post type label (neuter)', 'post-types-definitely' ), $plural_name ),
Severity: Major
Found in inc/WPPTD/PostTypeLabelGenerator.php and 2 other locations - About 1 day to fix
inc/WPPTD/PostTypeLabelGenerator.php on lines 259..282
inc/WPPTD/PostTypeLabelGenerator.php on lines 292..315

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

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

        private static function get_bulk_messages_feminine( $plural_name, $singular_name ) {
            return array(
                'updated'    => array(
                    sprintf( _x( '%%s %s updated.', 'bulk post message: first argument is a number, second is the singular post type label (feminine)', 'post-types-definitely' ), $singular_name ),
                    sprintf( _x( '%%s %s updated.', 'bulk post message: first argument is a number, second is the plural post type label (feminine)', 'post-types-definitely' ), $plural_name ),
Severity: Major
Found in inc/WPPTD/PostTypeLabelGenerator.php and 2 other locations - About 1 day to fix
inc/WPPTD/PostTypeLabelGenerator.php on lines 259..282
inc/WPPTD/PostTypeLabelGenerator.php on lines 325..348

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

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

        private static function get_messages_neuter( $plural_name, $singular_name ) {
            return array(
                 0 => '',
                 1 => sprintf( _x( '%1$s updated. <a href="%%s">View %1$s</a>', 'post message: argument is the singular post type label (neuter)', 'post-types-definitely' ), $singular_name ),
                 2 => sprintf( _x( 'Custom %s field updated.', 'post message: argument is the singular post type label (neuter)', 'post-types-definitely' ), $singular_name ),
Severity: Major
Found in inc/WPPTD/PostTypeLabelGenerator.php and 2 other locations - About 1 day to fix
inc/WPPTD/PostTypeLabelGenerator.php on lines 187..201
inc/WPPTD/PostTypeLabelGenerator.php on lines 211..225

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

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

        private static function get_messages_masculine( $plural_name, $singular_name ) {
            return array(
                 0 => '',
                 1 => sprintf( _x( '%1$s updated. <a href="%%s">View %1$s</a>', 'post message: argument is the singular post type label (masculine)', 'post-types-definitely' ), $singular_name ),
                 2 => sprintf( _x( 'Custom %s field updated.', 'post message: argument is the singular post type label (masculine)', 'post-types-definitely' ), $singular_name ),
Severity: Major
Found in inc/WPPTD/PostTypeLabelGenerator.php and 2 other locations - About 1 day to fix
inc/WPPTD/PostTypeLabelGenerator.php on lines 211..225
inc/WPPTD/PostTypeLabelGenerator.php on lines 235..249

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

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

        private static function get_messages_feminine( $plural_name, $singular_name ) {
            return array(
                 0 => '',
                 1 => sprintf( _x( '%1$s updated. <a href="%%s">View %1$s</a>', 'post message: argument is the singular post type label (feminine)', 'post-types-definitely' ), $singular_name ),
                 2 => sprintf( _x( 'Custom %s field updated.', 'post message: argument is the singular post type label (feminine)', 'post-types-definitely' ), $singular_name ),
Severity: Major
Found in inc/WPPTD/PostTypeLabelGenerator.php and 2 other locations - About 1 day to fix
inc/WPPTD/PostTypeLabelGenerator.php on lines 187..201
inc/WPPTD/PostTypeLabelGenerator.php on lines 235..249

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

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

File Admin.php has 535 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WPPTD\Admin class
 *
 * @package WPPTD
Severity: Major
Found in inc/WPPTD/Admin.php - About 1 day to fix

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

            public function register( $parent_metabox = null, $parent_taxonomy = null ) {
                // Do not register meta at this point, unless it is specifically enabled for the REST API.
                if ( ! $this->args['show_in_rest'] ) {
                    return;
                }
    Severity: Major
    Found in inc/WPPTD/Components/TermField.php and 1 other location - About 7 hrs to fix
    inc/WPPTD/Components/Field.php on lines 83..115

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

    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 2 locations. Consider refactoring.
    Open

            public function register( $parent_metabox = null, $parent_post_type = null ) {
                // Do not register meta at this point, unless it is specifically enabled for the REST API.
                if ( ! $this->args['show_in_rest'] ) {
                    return;
                }
    Severity: Major
    Found in inc/WPPTD/Components/Field.php and 1 other location - About 7 hrs to fix
    inc/WPPTD/Components/TermField.php on lines 54..86

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

    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

    Function add_taxonomies has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
    Open

            protected function add_taxonomies( $taxonomies, $post_type ) {
                foreach ( $taxonomies as $taxonomy_slug => $taxonomy_args ) {
                    if ( is_array( $taxonomy_args ) ) {
                        $taxonomy = $post_type->add( new Taxonomy( $taxonomy_slug, $taxonomy_args ) );
                        if ( is_wp_error( $taxonomy ) ) {
    Severity: Minor
    Found in inc/WPPTD/App.php - About 6 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 validate_args has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
    Open

            public static function validate_args( $args ) {
                // handle admin table columns
                if ( ! $args['show_ui'] || ! is_array( $args['table_columns'] ) ) {
                    $args['table_columns'] = array();
                }
    Severity: Minor
    Found in inc/WPPTD/PostTypeTableHandler.php - About 6 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

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

            public static function validate_args( $args ) {
                // handle row actions
                if ( ! $args['show_ui'] || ! is_array( $args['row_actions'] ) ) {
                    $args['row_actions'] = array();
                }
    Severity: Major
    Found in inc/WPPTD/PostTypeActionHandler.php and 1 other location - About 6 hrs to fix
    inc/WPPTD/TaxonomyActionHandler.php on lines 290..320

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

    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

            public static function validate_args( $args ) {
                // handle row actions
                if ( ! $args['show_ui'] || ! is_array( $args['row_actions'] ) ) {
                    $args['row_actions'] = array();
                }
    Severity: Major
    Found in inc/WPPTD/TaxonomyActionHandler.php and 1 other location - About 6 hrs to fix
    inc/WPPTD/PostTypeActionHandler.php on lines 306..336

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

    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