kahlan/kahlan

View on GitHub

Showing 191 of 191 total issues

Function _addClosingParenthesis has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _addClosingParenthesis($pos, $index, $parent)
    {
        $count = 0;
        $nodes = $parent->tree;
        $total = count($nodes);
Severity: Minor
Found in src/Jit/Patcher/Monkey.php - About 3 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

File Double.php has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Kahlan\Plugin;

use Kahlan\Jit\Parser;
use Kahlan\Jit\Patcher\Pointcut;
Severity: Minor
Found in src/Plugin/Double.php - About 3 hrs to fix

    TokenStream has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TokenStream implements ArrayAccess, Countable, SeekableIterator
    {
        /**
         * The items contained in the collection.
         *
    Severity: Minor
    Found in src/Jit/TokenStream.php - About 3 hrs to fix

      File Collector.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      namespace Kahlan\Reporter\Coverage;
      
      use Kahlan\Jit\Parser;
      use Kahlan\Dir\Dir;
      Severity: Minor
      Found in src/Reporter/Coverage/Collector.php - About 2 hrs to fix

        Method _export has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected static function _export($path, $tree, $coverage)
            {
                $s = (object) [];
                $statementMap = (object) [];
                $statementIndex = 0;
        Severity: Major
        Found in src/Reporter/Coverage/Exporter/Istanbul.php - About 2 hrs to fix

          Kahlan has 25 functions (exceeds 20 allowed). Consider refactoring.
          Open

              class Kahlan
              {
                  public const VERSION = '5.2.6';
          
                  /**
          Severity: Minor
          Found in src/Cli/Kahlan.php - About 2 hrs to fix

            Function _console has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

                    protected function _console()
                    {
                        return Filters::run($this, 'console', [], function ($chain) {
                            $collection = $this->reporters();
            
            
            Severity: Minor
            Found in src/Cli/Kahlan.php - About 2 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

            Suite has 23 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Suite
            {
                /**
                 * The PHP constraint to respect
                 *
            Severity: Minor
            Found in src/Suite.php - About 2 hrs to fix

              Function stats has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function stats()
                  {
                      if ($this->_stats !== null) {
                          return $this->_stats;
                      }
              Severity: Minor
              Found in src/Block/Group.php - About 2 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 stats has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function stats()
                  {
                      if ($this->_stats !== null) {
                          return $this->_stats;
                      }
              Severity: Major
              Found in src/Block/Group.php - About 2 hrs to fix

                Function _parseArgs has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function _parseArgs()
                    {
                        $cpt = 0;
                        $value = $name = '';
                        $args = [];
                Severity: Minor
                Found in src/Jit/Parser.php - About 2 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

                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

                  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

                    Function end has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function end($summary)
                        {
                            $toString = function ($instance) {
                                return 'an instance of `' . get_class($instance) . '`';
                            };
                    Severity: Minor
                    Found in src/Reporter/Json.php - About 2 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 find has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function find($message, $index = 0, $times = 0, &$args = [])
                        {
                            $success = false;
                            $messages = !is_array($message) ? [$message] : $message;
                    
                    
                    Severity: Major
                    Found in src/Plugin/Call/Calls.php - About 2 hrs to fix

                      Method _monkeyPatch has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function _monkeyPatch($node, $parent, $index)
                          {
                              if (!preg_match_all($this->_regex, $node->body, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
                                  return;
                              }
                      Severity: Minor
                      Found in src/Jit/Patcher/Monkey.php - About 2 hrs to fix

                        Method _help has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                protected function _help()
                                {
                                    $terminal = $this->terminal();
                                    if (!$this->commandLine()->get('no-header')) {
                                        $terminal->write($terminal->kahlan() ."\n\n");
                        Severity: Minor
                        Found in src/Cli/Kahlan.php - About 1 hr to fix

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

                              public function method($path, $closure = null)
                              {
                                  if ($this->_needToBePatched) {
                                      $layer = Double::classname();
                                      Monkey::patch($this->_reference, $layer);
                          Severity: Minor
                          Found in src/Plugin/Stub.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 method has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function method($path, $closure = null)
                              {
                                  if ($this->_needToBePatched) {
                                      $layer = Double::classname();
                                      Monkey::patch($this->_reference, $layer);
                          Severity: Minor
                          Found in src/Plugin/Stub.php - About 1 hr to fix

                            Method _export has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected static function _export($path, $tree, $coverage)
                                {
                                    $result = [
                                        'TN:',
                                        'SF:' . $path
                            Severity: Minor
                            Found in src/Reporter/Coverage/Exporter/Lcov.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language