felixarntz/post-types-definitely

View on GitHub

Showing 187 of 187 total issues

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_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_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 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 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

          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_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( $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

          Method maybe_filter_by_table_columns has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function maybe_filter_by_table_columns( $wp_query ) {
                      $table_columns = $this->component->table_columns;
          
                      $tax_query = array();
                      $meta_query = array();
          Severity: Minor
          Found in inc/WPPTD/PostTypeQueryHandler.php - About 1 hr to fix

            Method register has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public function register() {
                        if ( ! $this->is_already_added() ) {
                            $_post_type_args = $this->args;
            
                            unset( $_post_type_args['title'] );
            Severity: Minor
            Found in inc/WPPTD/Components/PostType.php - About 1 hr to fix

              Method validate_labels has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public static function validate_labels( $args, $key, $mode ) {
                          if ( false === $args[ $key ] ) {
                              $args[ $key ] = array();
                              return $args;
                          }
              Severity: Minor
              Found in inc/WPPTD/Utility.php - About 1 hr to fix

                Method get_defaults has 34 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/Taxonomy.php - About 1 hr to fix

                  Method validate_args has 33 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/TaxonomyTableHandler.php - About 1 hr to fix

                    Function validate_titles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public static function validate_titles( $args, $slug, $mode ) {
                                if ( empty( $args['title'] ) && isset( $args['label'] ) ) {
                                    $args['title'] = $args['label'];
                                    unset( $args['label'] );
                                }
                    Severity: Minor
                    Found in inc/WPPTD/Utility.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 handle_bulk_action has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                            protected function handle_bulk_action( $sendback, $bulk_action, $item_ids ) {
                                $bulk_actions = $this->component->bulk_actions;
                                $component_plural_name = $this->component->title;
                    
                                $action_message = false;
                    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 add_taxonomy_hooks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                            protected function add_taxonomy_hooks() {
                                if ( 0 > version_compare( get_bloginfo( 'version' ), '4.5' ) ) {
                                    add_action( 'load-edit-tags.php', array( $this, 'add_term_or_term_list_help' ) );
                                } else {
                                    add_action( 'load-edit-tags.php', array( $this, 'add_term_list_help' ) );
                    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

                    Function render_table_column has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public function render_table_column( $column_name, $term_id ) {
                                $table_columns = $this->component->table_columns;
                                if ( isset( $table_columns[ $column_name ] ) ) {
                                    if ( isset( $table_columns[ $column_name ]['meta_key'] ) && ! empty( $table_columns[ $column_name ]['meta_key'] ) ) {
                                        $field = $this->get_child_field( $table_columns[ $column_name ]['meta_key'] );
                    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 add_term_metaboxes has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                            protected function add_term_metaboxes( $term_metaboxes, $taxonomy ) {
                                foreach ( $term_metaboxes as $term_metabox_slug => $term_metabox_args ) {
                                    $term_metabox = $taxonomy->add( new TermMetabox( $term_metabox_slug, $term_metabox_args ) );
                                    if ( is_wp_error( $term_metabox ) ) {
                                        self::doing_it_wrong( __METHOD__, $term_metabox->get_error_message(), '0.6.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

                    Method run_row_action has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            protected function run_row_action( $row_action, $item_id ) {
                                $row_actions = $this->component->row_actions;
                                $component_singular_title = $this->component->singular_title;
                    
                                check_admin_referer( $this->get_row_nonce_name( $row_action, $item_id ) );
                    Severity: Minor
                    Found in inc/WPPTD/ActionHandler.php - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language