felixarntz/post-types-definitely

View on GitHub

Showing 187 of 187 total issues

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

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

          Similar blocks of code found in 2 locations. 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 and 1 other location - About 55 mins to fix
          inc/WPPTD/TableHandler.php on lines 87..102

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 98.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. 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 and 1 other location - About 55 mins to fix
          inc/WPPTD/TableHandler.php on lines 111..126

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 98.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid deeply nested control flow statements.
          Open

                                      if ( false !== ( $key = array_search( $column_key, $taxonomies ) ) ) {
                                          unset( $taxonomies[ $key ] );
                                      }
          Severity: Major
          Found in inc/WPPTD/PostTypeTableHandler.php - About 45 mins to fix

            Method get_related_objects has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    public static function get_related_objects( $mode, $id, $objects_mode, $meta_key = '', $object_type = '', $single = false ) {
            Severity: Minor
            Found in inc/WPPTD/Utility.php - About 45 mins to fix

              Function handle_term_row_actions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      public function handle_term_row_actions() {
                          global $taxnow;
              
                          // do not run this on a terms list
                          if ( ! isset( $_GET['tag_ID'] ) ) {
              Severity: Minor
              Found in inc/WPPTD/Admin.php - About 45 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 initialize_term_ui has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      public function initialize_term_ui() {
                          $screen = get_current_screen();
                          if ( ! isset( $_REQUEST['tag_ID'] ) ) {
                              return;
                          }
              Severity: Minor
              Found in inc/WPPTD/Admin.php - About 45 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

              Avoid deeply nested control flow statements.
              Open

                                          if ( $taxonomy ) {
                                              $this->render_taxonomy_column_filter( $column_slug, $taxonomy );
                                          }
              Severity: Major
              Found in inc/WPPTD/PostTypeTableHandler.php - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language