wikimedia/mediawiki-core

View on GitHub
includes/parser/PPNode_Hash_Tree.php

Summary

Maintainability
B
5 hrs
Test Coverage

Function splitRawArg has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    public static function splitRawArg( array $children ) {
        $bits = [];
        foreach ( $children as $i => $child ) {
            if ( !is_array( $child ) ) {
                continue;
Severity: Minor
Found in includes/parser/PPNode_Hash_Tree.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 splitRawExt has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function splitRawExt( array $children ) {
        $bits = [];
        foreach ( $children as $i => $child ) {
            if ( !is_array( $child ) ) {
                continue;
Severity: Minor
Found in includes/parser/PPNode_Hash_Tree.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 splitRawTemplate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public static function splitRawTemplate( array $children ) {
        $parts = [];
        $bits = [ 'lineStart' => '' ];
        foreach ( $children as $i => $child ) {
            if ( !is_array( $child ) ) {
Severity: Minor
Found in includes/parser/PPNode_Hash_Tree.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 splitRawHeading has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function splitRawHeading( array $children ) {
        $bits = [];
        foreach ( $children as $child ) {
            if ( !is_array( $child ) ) {
                continue;
Severity: Minor
Found in includes/parser/PPNode_Hash_Tree.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 factory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function factory( array $store, $index ) {
        if ( !isset( $store[$index] ) ) {
            return false;
        }

Severity: Minor
Found in includes/parser/PPNode_Hash_Tree.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 __toString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function __toString() {
        $inner = '';
        $attribs = '';
        for ( $node = $this->getFirstChild(); $node; $node = $node->getNextSibling() ) {
            if ( $node instanceof PPNode_Hash_Attr ) {
Severity: Minor
Found in includes/parser/PPNode_Hash_Tree.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

There are no issues that match your filters.

Category
Status