felixarntz/post-types-definitely

View on GitHub

Showing 150 of 187 total issues

Function get_media_view_strings has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        public function get_media_view_strings( $strings, $post ) {
            if ( $post ) {
                $post_type = ComponentManager::get( '*.' . $post->post_type, 'WPDLib\Components\Menu.WPPTD\Components\PostType', true );
                if ( $post_type ) {
                    $labels = $post_type->labels;
Severity: Minor
Found in inc/WPPTD/Admin.php - About 2 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 register has a Cognitive Complexity of 20 (exceeds 5 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 2 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_meta_values has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        protected function validate_meta_values( $meta_values, $term_id ) {
            $meta_values_validated = array();

            $meta_values_old = array();

Severity: Minor
Found in inc/WPPTD/Components/Taxonomy.php - About 2 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 parse_meta_value has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        public static function parse_meta_value( $meta_value, $field, $single = null, $formatted = false ) {
            $_meta_value = $meta_value;
            $meta_value = null;

            $type_hint = $field->validate_meta_value( null, true );
Severity: Minor
Found in inc/WPPTD/Utility.php - About 2 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 maybe_register_related_objects_field has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

        public static function maybe_register_related_objects_field( $object, $args, $component, $component_parent ) {
            if ( ! isset( $args['options'] ) || ! is_array( $args['options'] ) || 1 !== count( $args['options'] ) ) {
                return;
            }

Severity: Minor
Found in inc/WPPTD/Utility.php - About 2 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 add_to_menu has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

        public function add_to_menu( $args ) {
            if ( ! $this->show_in_menu_manually ) {
                return false;
            }

Severity: Minor
Found in inc/WPPTD/Components/PostType.php - About 2 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

Method term_submit_metabox has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

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

    PostType has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

        class PostType extends Base {
    
            /**
             * @since 0.5.0
             * @var WPPTD\PostTypeTableHandler Holds the list table handler instance for this post type.
    Severity: Minor
    Found in inc/WPPTD/Components/PostType.php - About 2 hrs to fix

      Function wpptd_get_term_meta_value has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          function wpptd_get_term_meta_value( $id, $meta_key, $single = null, $formatted = false ) {
              if ( ! wpptd_supports_termmeta() ) {
                  if ( $single ) {
                      return null;
                  }
      Severity: Minor
      Found in inc/functions.php - About 2 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 handle_term_bulk_actions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

              public function handle_term_bulk_actions() {
                  global $taxnow;
      
                  // do not run this on a term edit form
                  if ( isset( $_GET['tag_ID'] ) ) {
      Severity: Minor
      Found in inc/WPPTD/Admin.php - About 2 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 get_updated_messages has a Cognitive Complexity of 18 (exceeds 5 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 2 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

      App has 22 functions (exceeds 20 allowed). Consider refactoring.
      Open

          class App extends Plugin {
      
              /**
               * @since 0.5.0
               * @var array Holds the plugin data.
      Severity: Minor
      Found in inc/WPPTD/App.php - About 2 hrs to fix

        ActionHandler has 22 functions (exceeds 20 allowed). Consider refactoring.
        Open

            abstract class ActionHandler {
                /**
                 * @since 0.6.1
                 * @var WPDLib\Components\Base Holds the component this action handler should manage.
                 */
        Severity: Minor
        Found in inc/WPPTD/ActionHandler.php - About 2 hrs to fix

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

                  public function validate( $parent = null ) {
                      $status = parent::validate( $parent );
          
                      if ( $status === true ) {
          
          
          Severity: Major
          Found in inc/WPPTD/Components/PostType.php - About 2 hrs to fix

            Function register has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function register() {
                        if ( $this->registered ) {
                            return;
                        }
            
            
            Severity: Minor
            Found in inc/WPPTD/Components/Taxonomy.php - About 2 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 register_table_filter_query_vars has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function register_table_filter_query_vars( $vars ) {
                        $table_columns = $this->component->table_columns;
            
                        foreach ( $table_columns as $column_slug => $column_args ) {
                            if ( is_array( $column_args ) && $column_args['filterable'] ) {
            Severity: Minor
            Found in inc/WPPTD/PostTypeQueryHandler.php - About 2 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

            File Taxonomy.php has 260 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * WPPTD\Components\Taxonomy class
             *
             * @package WPPTD
            Severity: Minor
            Found in inc/WPPTD/Components/Taxonomy.php - About 2 hrs to fix

              Function run_bulk_action has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                      protected function run_bulk_action( $bulk_action, $item_ids ) {
                          $bulk_actions = $this->component->bulk_actions;
                          $component_plural_name = $this->component->title;
              
                          check_admin_referer( $this->get_bulk_nonce_name() );
              Severity: Minor
              Found in inc/WPPTD/ActionHandler.php - About 2 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 run_row_action has a Cognitive Complexity of 16 (exceeds 5 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 2 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 handle_bulk_actions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                      public function handle_bulk_actions() {
                          global $typenow;
              
                          $post_type = ComponentManager::get( '*.' . $typenow, 'WPDLib\Components\Menu.WPPTD\Components\PostType', true );
                          if ( $post_type ) {
              Severity: Minor
              Found in inc/WPPTD/Admin.php - About 2 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

              Severity
              Category
              Status
              Source
              Language