wp-bootstrap/wp-bootstrap-navlist-walker

View on GitHub

Showing 6 of 168 total issues

Function fallback has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public static function fallback( $args ) {
        if ( current_user_can( 'manage_options' ) ) {

                /* Get Arguments. */
                $container = $args['container'];
Severity: Minor
Found in wp-bootstrap-navlist-walker.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

Method fallback has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function fallback( $args ) {
        if ( current_user_can( 'manage_options' ) ) {

                /* Get Arguments. */
                $container = $args['container'];
Severity: Minor
Found in wp-bootstrap-navlist-walker.php - About 1 hr to fix

    Method start_el has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
            $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
    
            // Check if the link it disables Disabled, Active or regular menu item.
            if ( stristr( $item->attr_title, 'disabled' ) ) {
    Severity: Minor
    Found in wp-bootstrap-navlist-walker.php - About 1 hr to fix

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

          public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) {
      Severity: Minor
      Found in wp-bootstrap-navlist-walker.php - About 45 mins to fix

        Method start_el has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
        Severity: Minor
        Found in wp-bootstrap-navlist-walker.php - About 35 mins to fix

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

              public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) {
                  $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
          
                  // Check if the link it disables Disabled, Active or regular menu item.
                  if ( stristr( $item->attr_title, 'disabled' ) ) {
          Severity: Minor
          Found in wp-bootstrap-navlist-walker.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

          Severity
          Category
          Status
          Source
          Language