felixarntz/post-types-definitely

View on GitHub

Showing 150 of 187 total issues

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

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

    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

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

            public function validate( $parent = null ) {
                $status = parent::validate( $parent );
    
                if ( $status === true ) {
    
    
    Severity: Minor
    Found in inc/WPPTD/Components/PostType.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 37 (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/TaxonomyTableHandler.php - About 5 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 get_related_objects has 137 lines of code (exceeds 25 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: Major
    Found in inc/WPPTD/Utility.php - About 5 hrs to fix

      File PostType.php has 388 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        Function validate_labels has a Cognitive Complexity of 35 (exceeds 5 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 5 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

        Admin has 37 functions (exceeds 20 allowed). Consider refactoring.
        Open

            class Admin {
        
                /**
                 * @since 0.5.0
                 * @var WPPTD\Admin|null Holds the instance of this class.
        Severity: Minor
        Found in inc/WPPTD/Admin.php - About 4 hrs to fix

          Function maybe_filter_by_table_columns has a Cognitive Complexity of 31 (exceeds 5 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 4 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_table_taxonomies has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

                  public function get_table_taxonomies( $taxonomies ) {
                      $table_columns = $this->component->table_columns;
          
                      foreach ( $table_columns as $column_slug => $column_args ) {
                          if ( $column_args && ! empty( $column_args['taxonomy_slug'] ) && is_object_in_taxonomy( $this->component->slug, $column_args['taxonomy_slug'] ) ) {
          Severity: Minor
          Found in inc/WPPTD/PostTypeTableHandler.php - About 4 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 wpptd_get_term_meta_values has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              function wpptd_get_term_meta_values( $id, $single = null, $formatted = false ) {
                  if ( ! wpptd_supports_termmeta() ) {
                      return array();
                  }
          
          
          Severity: Minor
          Found in inc/functions.php - About 4 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 Utility.php has 333 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * @package WPPTD
           * @version 0.6.4
           * @author Felix Arntz <felix-arntz@leaves-and-love.net>
          Severity: Minor
          Found in inc/WPPTD/Utility.php - About 4 hrs to fix

            Function render_table_column_filters has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
            Open

                    public function render_table_column_filters() {
                        $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/PostTypeTableHandler.php - About 3 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 wpptd_get_post_meta_values has a Cognitive Complexity of 26 (exceeds 5 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 3 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 enqueue_assets has a Cognitive Complexity of 26 (exceeds 5 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 3 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 25 (exceeds 5 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 3 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 has a Cognitive Complexity of 24 (exceeds 5 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 3 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 render has a Cognitive Complexity of 21 (exceeds 5 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 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