felixarntz/post-types-definitely

View on GitHub

Showing 150 of 187 total issues

Function filter_row_actions has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        public function filter_row_actions( $row_actions, $item ) {
            $table_row_actions = $this->component->row_actions;

            if ( ! call_user_func_array( 'current_user_can', $this->get_row_capability_args( $item ) ) ) {
                return $row_actions;
Severity: Minor
Found in inc/WPPTD/ActionHandler.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function validate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        public function validate( $parent = null ) {
            $status = parent::validate( $parent );

            if ( $status === true ) {
                if ( is_array( $this->args['class'] ) ) {
Severity: Minor
Found in inc/WPPTD/Components/Field.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function validate_args has a Cognitive Complexity of 15 (exceeds 5 allowed). 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: Minor
Found in inc/WPPTD/PostTypeActionHandler.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function add_post_types has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        protected function add_post_types( $post_types, $menu ) {
            foreach ( $post_types as $post_type_slug => $post_type_args ) {
                $post_type = $menu->add( new PostType( $post_type_slug, $post_type_args ) );
                if ( is_wp_error( $post_type ) ) {
                    self::doing_it_wrong( __METHOD__, $post_type->get_error_message(), '0.5.0' );
Severity: Minor
Found in inc/WPPTD/App.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function maybe_sort_by_meta_table_column has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

        public function maybe_sort_by_meta_table_column( $query ) {
            if ( is_object( $query ) ) {
                $args_before = $query->query;
                $args_after = $query->query_vars;
            } else {
Severity: Minor
Found in inc/WPPTD/QueryHandler.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function validate_args has a Cognitive Complexity of 15 (exceeds 5 allowed). 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: Minor
Found in inc/WPPTD/TaxonomyActionHandler.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function render has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        public function render( $term ) {
            $parent_taxonomy = $this->get_parent();

            if ( 'side' == $this->args['context'] ) {
                echo '<div class="wpdlib-narrow">';
Severity: Minor
Found in inc/WPPTD/Components/TermMetabox.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function term_submit_metabox has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

        public function term_submit_metabox( $term ) {
            $screen = get_current_screen();

            $tax = $screen->taxonomy;
            if ( empty( $tax ) ) {
Severity: Minor
Found in inc/WPPTD/Admin.php - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method get_defaults has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        protected function get_defaults() {
            $defaults = array(
                'title'                => '',
                'singular_title'       => '',
                'title_gender'         => 'n',
Severity: Minor
Found in inc/WPPTD/Components/PostType.php - About 1 hr to fix

    Function wpptd_get_post_meta_value has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        function wpptd_get_post_meta_value( $id, $meta_key, $single = null, $formatted = false ) {
            $_meta_value = get_post_meta( $id, $meta_key, false );
    
            if ( doing_action( 'wpptd' ) || ! did_action( 'wpptd' ) ) {
                if ( $single ) {
    Severity: Minor
    Found in inc/functions.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function render_meta_column_choice_filter has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            protected function render_meta_column_choice_filter( $column_slug, $field, $active_filters ) {
                echo '<select name="' . $column_slug . '" id="' . $column_slug . '" class="postform">';
                echo '<option value="">' . esc_html( $field->title ) . ': ' . __( 'All', 'post-types-definitely' ) . '</option>';
                foreach ( $field->options as $value => $label ) {
                    echo '<option value="' . esc_attr( $value ) . '"' . ( ( isset( $active_filters[ $column_slug ] ) && $active_filters[ $column_slug ] == $value ) ? ' selected="selected"' : '' ) . '>';
    Severity: Minor
    Found in inc/WPPTD/PostTypeTableHandler.php - About 1 hr to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method render has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function render( $post ) {
                $parent_post_type = $this->get_parent();
    
                if ( 'side' == $this->args['context'] ) {
                    echo '<div class="wpdlib-narrow">';
    Severity: Minor
    Found in inc/WPPTD/Components/Metabox.php - About 1 hr to fix

      Method validate_meta_values has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              protected function validate_meta_values( $meta_values, $post_id ) {
                  $meta_values_validated = array();
      
                  $meta_values_old = array();
      
      
      Severity: Minor
      Found in inc/WPPTD/Components/PostType.php - About 1 hr to fix

        Method validate_args has 38 lines of code (exceeds 25 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 1 hr to fix

          Method validate has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function validate( $parent = null ) {
                      $status = parent::validate( $parent );
          
                      if ( $status === true ) {
          
          
          Severity: Minor
          Found in inc/WPPTD/Components/Taxonomy.php - About 1 hr to fix

            Function save_meta has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function save_meta( $term_id, $term, $update = false ) {
                        if ( ! $this->can_save_meta( $term_id, $term ) ) {
                            return;
                        }
            
            
            Severity: Minor
            Found in inc/WPPTD/Components/Taxonomy.php - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_meta_type has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    protected function get_meta_type() {
                        $meta_type = 'string';
            
                        switch ( $this->args['type'] ) {
                            case 'checkbox':
            Severity: Minor
            Found in inc/WPPTD/Components/Field.php - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function save_meta has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function save_meta( $post_id, $post, $update = false ) {
                        if ( ! $this->can_save_meta( $post_id, $post ) ) {
                            return;
                        }
            
            
            Severity: Minor
            Found in inc/WPPTD/Components/PostType.php - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function filter_table_sortable_column has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    protected function filter_table_sortable_column( $slug, $args ) {
                        if ( ! is_array( $args ) ) {
                            return false;
                        }
            
            
            Severity: Minor
            Found in inc/WPPTD/TableHandler.php - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Function get_post_updated_messages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function get_post_updated_messages( $messages ) {
                        global $post;
            
                        $permalink = get_permalink( $post->ID );
                        if ( ! $permalink ) {
            Severity: Minor
            Found in inc/WPPTD/Admin.php - About 1 hr to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

            Severity
            Category
            Status
            Source
            Language