kahlan/kahlan

View on GitHub
src/Reporter/Coverage.php

Summary

Maintainability
C
1 day
Test Coverage

File Coverage.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Kahlan\Reporter;

use Kahlan\Jit\ClassLoader;
use Kahlan\Reporter\Coverage\Collector;
Severity: Minor
Found in src/Reporter/Coverage.php - About 2 hrs to fix

    Function _getMetricsReport has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _getMetricsReport($children, $verbosity, $depth = 0, $tab = 3, &$maxWidth = null)
        {
            $list = [];
            foreach ($children as $child) {
                $type = $child->type();
    Severity: Minor
    Found in src/Reporter/Coverage.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 _renderMetricsReport has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _renderMetricsReport($metricsReport, $labelWidth, $lineWidth, $depth)
        {
            $nbChilden = count($metricsReport);
            $index = 0;
            foreach ($metricsReport as $name => $data) {
    Severity: Minor
    Found in src/Reporter/Coverage.php - About 1 hr to fix

      Function _renderCoverage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function _renderCoverage($metrics)
          {
              $stats = $metrics->data();
              foreach ($stats['files'] as $file) {
                  $this->write("File: {$file}" . "\n\n");
      Severity: Minor
      Found in src/Reporter/Coverage.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 _renderCoverage has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function _renderCoverage($metrics)
          {
              $stats = $metrics->data();
              foreach ($stats['files'] as $file) {
                  $this->write("File: {$file}" . "\n\n");
      Severity: Minor
      Found in src/Reporter/Coverage.php - About 1 hr to fix

        Method _renderMetrics has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _renderMetrics($metrics, $verbosity)
            {
                $maxLabelWidth = null;
                if ($verbosity === 1) {
                    return;
        Severity: Minor
        Found in src/Reporter/Coverage.php - About 1 hr to fix

          Method _getMetricsReport has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _getMetricsReport($children, $verbosity, $depth = 0, $tab = 3, &$maxWidth = null)
              {
                  $list = [];
                  foreach ($children as $child) {
                      $type = $child->type();
          Severity: Minor
          Found in src/Reporter/Coverage.php - About 1 hr to fix

            Method stop has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function stop($summary)
                {
                    if (!$this->_verbosity) {
                        return;
                    }
            Severity: Minor
            Found in src/Reporter/Coverage.php - About 1 hr to fix

              Function _renderMetricsReport has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function _renderMetricsReport($metricsReport, $labelWidth, $lineWidth, $depth)
                  {
                      $nbChilden = count($metricsReport);
                      $index = 0;
                      foreach ($metricsReport as $name => $data) {
              Severity: Minor
              Found in src/Reporter/Coverage.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

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

                  protected function _getMetricsReport($children, $verbosity, $depth = 0, $tab = 3, &$maxWidth = null)
              Severity: Minor
              Found in src/Reporter/Coverage.php - About 35 mins to fix

                There are no issues that match your filters.

                Category
                Status