soderlind/debug-bar-list-dependencies

View on GitHub

Showing 7 of 7 total issues

Function exports has 185 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function (grunt) {

    /**
     * Files added to WordPress SVN, don't include 'assets/**' here.
     * @type {Array}
Severity: Major
Found in Gruntfile.js - About 7 hrs to fix

    Method render has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function render() {
                global $wp_scripts, $wp_styles;
    
                $loaded_scripts = array_merge( $wp_scripts->done, $wp_scripts->in_footer );
                $loaded_scripts = array_unique( $loaded_scripts );
    Severity: Minor
    Found in class-debug-bar-list-dependencies.php - About 1 hr to fix

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

          function ps_listdeps_has_parent_plugin() {
              $file = plugin_basename( __FILE__ );
      
              if ( is_admin() && ( ! class_exists( 'Debug_Bar' ) && current_user_can( 'activate_plugins' ) ) && is_plugin_active( $file ) ) {
                  add_action( 'admin_notices', create_function( null, 'echo \'<div class="error"><p>\', sprintf( __( \'Activation failed: Debug Bar must be activated to use the <strong>Debug Bar List Dependencies</strong> Plugin. <a href="%s">Visit your plugins page to install & activate</a>.\', \'debug-bar-list-dependencies\' ), admin_url( \'plugin-install.php?tab=search&s=debug+bar\' ) ), \'</p></div>\';' ) );
      Severity: Minor
      Found in debug-bar-list-dependencies.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 load_textdomain has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              protected function load_textdomain( $domain ) {
                  if ( function_exists( '_load_textdomain_just_in_time' ) ) {
                      return;
                  }
      
      
      Severity: Minor
      Found in class-debug-bar-list-dependencies.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

      create_function() is deprecated as of PHP 7.2, please use full fledged functions or anonymous functions instead.
      Open

                  add_action( 'admin_notices', create_function( null, 'echo \'<div class="error"><p>\', sprintf( __( \'Activation failed: Debug Bar must be activated to use the <strong>Debug Bar List Dependencies</strong> Plugin. <a href="%s">Visit your plugins page to install & activate</a>.\', \'debug-bar-list-dependencies\' ), admin_url( \'plugin-install.php?tab=search&s=debug+bar\' ) ), \'</p></div>\';' ) );

      Function render_table_row has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

              private function render_table_row( $row_nr, $item, $dependencies, $src ) {
                  echo '<tr><td>', (int) $row_nr, '</td><td>',
                      esc_html( $item ),
                      '</td><td>';
      
      
      Severity: Minor
      Found in class-debug-bar-list-dependencies.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

      Class file names should be based on the class name with "class-" prepended. Expected class-ps-listdeps-debug-bar-panel.php, but found class-debug-bar-list-dependencies.php.
      Open

      <?php
      Severity
      Category
      Status
      Source
      Language