wikimedia/mediawiki-core

View on GitHub
includes/libs/XhprofData.php

Summary

Maintainability
D
2 days
Test Coverage

Function getInclusiveMetrics has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    public function getInclusiveMetrics() {
        if ( $this->inclusive === null ) {
            $main = $this->hieraData['main()'];
            $hasCpu = isset( $main['cpu'] );
            $hasMu = isset( $main['mu'] );
Severity: Minor
Found in includes/libs/XhprofData.php - About 6 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 getCompleteMetrics has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public function getCompleteMetrics() {
        if ( $this->complete === null ) {
            // Start with inclusive data
            $this->complete = $this->getInclusiveMetrics();

Severity: Minor
Found in includes/libs/XhprofData.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

Method getInclusiveMetrics has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getInclusiveMetrics() {
        if ( $this->inclusive === null ) {
            $main = $this->hieraData['main()'];
            $hasCpu = isset( $main['cpu'] );
            $hasMu = isset( $main['mu'] );
Severity: Major
Found in includes/libs/XhprofData.php - About 2 hrs to fix

    Method getCompleteMetrics has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getCompleteMetrics() {
            if ( $this->complete === null ) {
                // Start with inclusive data
                $this->complete = $this->getInclusiveMetrics();
    
    
    Severity: Minor
    Found in includes/libs/XhprofData.php - About 1 hr to fix

      Function getCriticalPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getCriticalPath( $metric = 'wt' ) {
              $func = 'main()';
              $path = [
                  $func => $this->hieraData[$func],
              ];
      Severity: Minor
      Found in includes/libs/XhprofData.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

      There are no issues that match your filters.

      Category
      Status