kahlan/kahlan

View on GitHub
src/Reporter/Terminal.php

Summary

Maintainability
D
2 days
Test Coverage

File Terminal.php has 371 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Kahlan\Reporter;

use Kahlan\Log;
use Kahlan\Util\Text;
Severity: Minor
Found in src/Reporter/Terminal.php - About 4 hrs to fix

    Terminal has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Terminal extends Reporter
    {
        /**
         * Indicates if the console cursor in on a new line.
         *
    Severity: Minor
    Found in src/Reporter/Terminal.php - About 2 hrs to fix

      Method _reportFailure has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function _reportFailure($log)
          {
              $this->_indent++;
              $type = $log->type();
              switch ($type) {
      Severity: Minor
      Found in src/Reporter/Terminal.php - About 1 hr to fix

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

            protected function _reportFailure($log)
            {
                $this->_indent++;
                $type = $log->type();
                switch ($type) {
        Severity: Minor
        Found in src/Reporter/Terminal.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 _reportSummary has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _reportSummary($summary)
            {
                $passed = $summary->passed();
                $skipped = $summary->skipped();
                $pending = $summary->pending();
        Severity: Minor
        Found in src/Reporter/Terminal.php - About 1 hr to fix

          Method _reportSpecMessage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _reportSpecMessage($log)
              {
                  $messages = $log->messages();
                  $message = end($messages);
          
          
          Severity: Minor
          Found in src/Reporter/Terminal.php - About 1 hr to fix

            Method _reportDiff has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _reportDiff($log)
                {
                    $data = $log->data();
            
                    $this->write("It expect actual ");
            Severity: Minor
            Found in src/Reporter/Terminal.php - About 1 hr to fix

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

                  public function _reportSummary($summary)
                  {
                      $passed = $summary->passed();
                      $skipped = $summary->skipped();
                      $pending = $summary->pending();
              Severity: Minor
              Found in src/Reporter/Terminal.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 _reportSkipped has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function _reportSkipped($summary)
                  {
                      foreach ([
                          'pending'  => 'cyan',
                          'excluded' => 'yellow',
              Severity: Minor
              Found in src/Reporter/Terminal.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 _reportDiff has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function _reportDiff($log)
                  {
                      $data = $log->data();
              
                      $this->write("It expect actual ");
              Severity: Minor
              Found in src/Reporter/Terminal.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 _reportSpecMessage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function _reportSpecMessage($log)
                  {
                      $messages = $log->messages();
                      $message = end($messages);
              
              
              Severity: Minor
              Found in src/Reporter/Terminal.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

              There are no issues that match your filters.

              Category
              Status