felixarntz/post-types-definitely

View on GitHub

Showing 150 of 187 total issues

Method get_labels_neuter has 28 lines of code (exceeds 25 allowed). 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: Minor
Found in inc/WPPTD/PostTypeLabelGenerator.php - About 1 hr to fix

    Method enqueue_assets has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function enqueue_assets() {
                $screen = get_current_screen();
    
                if ( isset( $screen->taxonomy ) && $screen->taxonomy ) {
                    $taxonomy = ComponentManager::get( '*.*.' . $screen->taxonomy, 'WPDLib\Components\Menu.WPPTD\Components\PostType.WPPTD\Components\Taxonomy', true );
    Severity: Minor
    Found in inc/WPPTD/Admin.php - About 1 hr to fix

      Function filter_table_sortable_columns has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              public function filter_table_sortable_columns( $columns ) {
                  $table_columns = $this->component->table_columns;
      
                  foreach ( $table_columns as $column_slug => $column_args ) {
                      $column_sort = $this->filter_table_sortable_column( $column_slug, $column_args );
      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 maybe_hack_action_message has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              public function maybe_hack_action_message( $bulk_messages, $bulk_counts = array() ) {
                  $request_data = $_REQUEST;
      
                  if ( isset( $request_data['updated'] ) && 0 < (int) $request_data['updated'] && isset( $request_data['message'] ) && 1 === (int) $request_data['message'] ) {
                      $transient_name = $this->get_message_transient_name();
      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 get_bulk_post_updated_messages has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              public function get_bulk_post_updated_messages( $messages, $counts ) {
                  $post_types = ComponentManager::get( '*.*', 'WPDLib\Components\Menu.WPPTD\Components\PostType' );
                  foreach ( $post_types as $post_type ) {
                      if ( ! in_array( $post_type->slug, array( 'post', 'page', 'attachment' ) ) ) {
                          $post_type_messages = $post_type->get_bulk_updated_messages( $counts );
      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 filter_table_columns has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              public function filter_table_columns( $columns ) {
                  $table_columns = $this->component->table_columns;
      
                  foreach ( $table_columns as $column_slug => $column_args ) {
                      $column_title = $this->filter_table_column( $column_slug, $column_args );
      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

      Method get_updated_messages has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function get_updated_messages( $post, $permalink = '', $revision = false ) {
                  if ( ! $this->args['messages'] ) {
                      return array();
                  }
      
      
      Severity: Minor
      Found in inc/WPPTD/Components/PostType.php - About 1 hr to fix

        Method render has 27 lines of code (exceeds 25 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

          Method maybe_sort_by_meta_table_column has 27 lines of code (exceeds 25 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

            Method wpptd_get_post_meta_values has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function wpptd_get_post_meta_values( $id, $single = null, $formatted = false ) {
                    $_meta_values = get_post_meta( $id );
            
                    $meta_values = array();
            
            
            Severity: Minor
            Found in inc/functions.php - About 1 hr to fix

              Method wrap_term_ui_bottom has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public function wrap_term_ui_bottom( $term, $taxonomy ) {
                          ?>
                                  </div>
              
                                  <?php wp_nonce_field( 'wpptd-save-term-' . $taxonomy, 'wpptd_edit_term_' . $taxonomy ); ?>
              Severity: Minor
              Found in inc/WPPTD/Admin.php - About 1 hr to fix

                Function maybe_hack_action_message has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        public function maybe_hack_action_message( $bulk_messages, $bulk_counts = array() ) {
                            if ( 0 < $bulk_counts['updated'] ) {
                                $transient_name = $this->get_message_transient_name();
                                $action_message = get_transient( $transient_name );
                                if ( $action_message ) {
                Severity: Minor
                Found in inc/WPPTD/PostTypeActionHandler.php - About 55 mins 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_column has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        protected function filter_table_column( $slug, $args ) {
                            if ( ! is_array( $args ) ) {
                                return false;
                            }
                
                
                Severity: Minor
                Found in inc/WPPTD/TableHandler.php - About 55 mins 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 can_save_meta has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        protected function can_save_meta( $post_id, $post ) {
                            if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
                                return false;
                            }
                
                
                Severity: Minor
                Found in inc/WPPTD/Components/PostType.php - About 55 mins 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 register has a Cognitive Complexity of 9 (exceeds 5 allowed). 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: Minor
                Found in inc/WPPTD/Components/Field.php - About 55 mins 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 can_save_meta has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        protected function can_save_meta( $term_id, $term ) {
                            if ( ! wpptd_supports_termmeta() ) {
                                return false;
                            }
                
                
                Severity: Minor
                Found in inc/WPPTD/Components/Taxonomy.php - About 55 mins 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_help_args has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        public static function validate_help_args( $args, $key ) {
                            if( ! is_array( $args[ $key ] ) ) {
                                $args[ $key ] = array();
                            }
                            if ( ! isset( $args[ $key ]['tabs'] ) || ! is_array( $args[ $key ]['tabs'] ) ) {
                Severity: Minor
                Found in inc/WPPTD/Utility.php - About 55 mins 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_taxonomy_table_column has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        public function maybe_sort_by_taxonomy_table_column( $clauses, $wp_query ) {
                            global $wpdb;
                
                            $table_columns = $this->component->table_columns;
                
                
                Severity: Minor
                Found in inc/WPPTD/PostTypeQueryHandler.php - About 55 mins 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 register has a Cognitive Complexity of 9 (exceeds 5 allowed). 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: Minor
                Found in inc/WPPTD/Components/TermField.php - About 55 mins 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_term_updated_messages has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                        public function get_term_updated_messages( $messages ) {
                            $taxonomies = ComponentManager::get( '*.*.*', 'WPDLib\Components\Menu.WPPTD\Components\PostType.WPPTD\Components\Taxonomy' );
                            foreach ( $taxonomies as $taxonomy ) {
                                if ( ! in_array( $taxonomy->slug, array( '_item', 'category', 'post_tag' ) ) ) {
                                    $taxonomy_messages = $taxonomy->get_updated_messages();
                Severity: Minor
                Found in inc/WPPTD/Admin.php - About 55 mins 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