CaffGeek/MBACNationals

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

Summary

Maintainability
F
6 days
Test Coverage

Function wp_get_sidebars_widgets has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
Open

function wp_get_sidebars_widgets($deprecated = true) {
    global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;

    // If loading from front page, consult $_wp_sidebars_widgets rather than options
    // to see if wp_convert_widget_settings() has made manipulations in memory.
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/widgets.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 widgets.php has 657 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * API for creating dynamic sidebar without hardcoding functionality into
 * themes. Includes both internal WordPress routines and theme use routines.
 *
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/widgets.php - About 1 day to fix

    Function wp_convert_widget_settings has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    function wp_convert_widget_settings($base_name, $option_name, $settings) {
        // This test may need expanding.
        $single = $changed = false;
        if ( empty($settings) ) {
            $single = true;
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/widgets.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

    Function is_active_widget has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    function is_active_widget($callback = false, $widget_id = false, $id_base = false, $skip_inactive = true) {
        global $wp_registered_widgets;
    
        $sidebars_widgets = wp_get_sidebars_widgets();
    
    
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/widgets.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 update_callback has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

        function update_callback( $widget_args = 1 ) {
            global $wp_registered_widgets;
    
            if ( is_numeric($widget_args) )
                $widget_args = array( 'number' => $widget_args );
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/widgets.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 dynamic_sidebar has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    function dynamic_sidebar($index = 1) {
        global $wp_registered_sidebars, $wp_registered_widgets;
    
        if ( is_int($index) ) {
            $index = "sidebar-$index";
    Severity: Minor
    Found in Web.Admin/2014/wordpress/wp-includes/widgets.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

    Method wp_get_sidebars_widgets has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function wp_get_sidebars_widgets($deprecated = true) {
        global $wp_registered_widgets, $wp_registered_sidebars, $_wp_sidebars_widgets;
    
        // If loading from front page, consult $_wp_sidebars_widgets rather than options
        // to see if wp_convert_widget_settings() has made manipulations in memory.
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/widgets.php - About 2 hrs to fix

      Method update_callback has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function update_callback( $widget_args = 1 ) {
              global $wp_registered_widgets;
      
              if ( is_numeric($widget_args) )
                  $widget_args = array( 'number' => $widget_args );
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/widgets.php - About 1 hr to fix

        Method wp_convert_widget_settings has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function wp_convert_widget_settings($base_name, $option_name, $settings) {
            // This test may need expanding.
            $single = $changed = false;
            if ( empty($settings) ) {
                $single = true;
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/widgets.php - About 1 hr to fix

          Method dynamic_sidebar has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function dynamic_sidebar($index = 1) {
              global $wp_registered_sidebars, $wp_registered_widgets;
          
              if ( is_int($index) ) {
                  $index = "sidebar-$index";
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/widgets.php - About 1 hr to fix

            Method wp_register_widget_control has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function wp_register_widget_control($id, $name, $control_callback, $options = array()) {
                global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks;
            
                $id = strtolower($id);
                $id_base = _get_widget_id_base($id);
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/widgets.php - About 1 hr to fix

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

              function is_dynamic_sidebar() {
                  global $wp_registered_widgets, $wp_registered_sidebars;
                  $sidebars_widgets = get_option('sidebars_widgets');
                  foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) {
                      if ( count($sidebars_widgets[$index]) ) {
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/widgets.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 wp_register_sidebar_widget has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) {
                  global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks;
              
                  $id = strtolower($id);
              
              
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/widgets.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_sidebars has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function register_sidebars($number = 1, $args = array()) {
                  global $wp_registered_sidebars;
                  $number = (int) $number;
              
                  if ( is_string($args) )
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/widgets.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 wp_register_widget_control has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function wp_register_widget_control($id, $name, $control_callback, $options = array()) {
                  global $wp_registered_widget_controls, $wp_registered_widget_updates, $wp_registered_widgets, $_wp_deprecated_widgets_callbacks;
              
                  $id = strtolower($id);
                  $id_base = _get_widget_id_base($id);
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/widgets.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 _register has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  function _register() {
                      $settings = $this->get_settings();
                      $empty = true;
              
                      if ( is_array($settings) ) {
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/widgets.php - About 35 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_widget_control has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function register_widget_control($name, $control_callback, $width = '', $height = '') {
                  // Compat
                  if ( is_array($name) ) {
                      if ( count($name) == 3 )
                          $name = sprintf($name[0], $name[2]);
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/widgets.php - About 35 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_sidebar_widget has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              function register_sidebar_widget($name, $output_callback, $classname = '') {
                  // Compat
                  if ( is_array($name) ) {
                      if ( count($name) == 3 )
                          $name = sprintf($name[0], $name[2]);
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/widgets.php - About 35 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

              There are no issues that match your filters.

              Category
              Status