CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-admin/includes/screen.php

Summary

Maintainability
F
6 days
Test Coverage

Function get has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get( $hook_name = '' ) {

        if ( is_a( $hook_name, 'WP_Screen' ) )
            return $hook_name;

Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.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 screen.php has 541 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * WordPress Administration Screen API.
 *
 * @package WordPress
Severity: Major
Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.php - About 1 day to fix

    Method get has 125 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function get( $hook_name = '' ) {
    
            if ( is_a( $hook_name, 'WP_Screen' ) )
                return $hook_name;
    
    
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.php - About 5 hrs to fix

      Function render_screen_options has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

          public function render_screen_options() {
              global $wp_meta_boxes, $wp_list_table;
      
              $columns = get_column_headers( $this );
              $hidden  = get_hidden_columns( $this );
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.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

      Method render_screen_meta has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function render_screen_meta() {
      
              /**
               * Filter the legacy contextual help list.
               *
      Severity: Major
      Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.php - About 3 hrs to fix

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

        function meta_box_prefs( $screen ) {
            global $wp_meta_boxes;
        
            if ( is_string( $screen ) )
                $screen = convert_to_screen( $screen );
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.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

        WP_Screen has 24 functions (exceeds 20 allowed). Consider refactoring.
        Open

        final class WP_Screen {
            /**
             * Any action associated with the screen. 'add' for *-add.php and *-new.php screens. Empty otherwise.
             *
             * @since 3.3.0
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.php - About 2 hrs to fix

          Function render_screen_meta has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

              public function render_screen_meta() {
          
                  /**
                   * Filter the legacy contextual help list.
                   *
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.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 render_screen_options has 63 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function render_screen_options() {
                  global $wp_meta_boxes, $wp_list_table;
          
                  $columns = get_column_headers( $this );
                  $hidden  = get_hidden_columns( $this );
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.php - About 2 hrs to fix

            Method render_per_page_options has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function render_per_page_options() {
                    if ( ! $this->get_option( 'per_page' ) )
                        return;
            
                    $per_page_label = $this->get_option( 'per_page', 'label' );
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.php - About 1 hr to fix

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

                  function render_per_page_options() {
                      if ( ! $this->get_option( 'per_page' ) )
                          return;
              
                      $per_page_label = $this->get_option( 'per_page', 'label' );
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.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_hidden_meta_boxes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              function get_hidden_meta_boxes( $screen ) {
                  if ( is_string( $screen ) )
                      $screen = convert_to_screen( $screen );
              
                  $hidden = get_user_option( "metaboxhidden_{$screen->id}" );
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.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 show_screen_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function show_screen_options() {
                      global $wp_meta_boxes;
              
                      if ( is_bool( $this->_show_screen_options ) )
                          return $this->_show_screen_options;
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.php - About 25 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

              Identical blocks of code found in 2 locations. Consider refactoring.
              Open

                          foreach ( $wp_meta_boxes[$screen->id][$context][$priority] as $box ) {
                              if ( false == $box || ! $box['title'] )
                                  continue;
                              // Submit box cannot be hidden
                              if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
              Severity: Major
              Found in Web.Admin/2014/wordpress/wp-admin/includes/screen.php and 1 other location - About 2 hrs to fix
              Web.Admin/2014/wordpress/wp-admin/includes/template.php on lines 3060..3070

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

              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

              There are no issues that match your filters.

              Category
              Status