crysalead/kahlan

View on GitHub

Showing 187 of 191 total issues

Method _addClosingParenthesis has 35 lines of code (exceeds 25 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 1 hr to fix

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

        public static function debug($content)
        {
            $root = is_object($content) ? $content : static::parse($content, ['lines' => true]);
            $result = '';
    
    
    Severity: Minor
    Found in src/Jit/Parser.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 export has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function export($options)
            {
                $defaults = [
                    'collector'    => null,
                    'head'         => null,
        Severity: Minor
        Found in src/Reporter/Coverage/Exporter/CodeClimate.php - About 1 hr to fix

          Method errorType has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function errorType($value)
              {
                  switch ($value) {
                      case E_ERROR:
                          return 'E_ERROR';
          Severity: Minor
          Found in src/Analysis/Debugger.php - About 1 hr to fix

            Method specEnd has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function specEnd($log = null)
                {
                    $isOk = $log->passed() ? "ok" : "not ok";
            
                    switch ($log->type()) {
            Severity: Minor
            Found in src/Reporter/Tap.php - About 1 hr to fix

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

              function box($name = '', $box = null)
              {
                  static $boxes = [];
              
                  if (func_num_args() === 1) {
              Severity: Minor
              Found in src/functions.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 _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

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

                  protected static function _generateMethodStubs($methods, $defaults = true)
                  {
                      $result = [];
                      $methods = $methods !== null ? (array) $methods : [];
              
              
              Severity: Minor
              Found in src/Plugin/Double.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 addPsr4 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function addPsr4($prefix, $paths, $prepend = false)
                  {
                      if (!$prefix) {
                          // Register directories for the root namespace.
                          if ($prepend) {
              Severity: Minor
              Found in src/Jit/ClassLoader.php - About 1 hr to fix

                Method _coverage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function _coverage($file, $coverage)
                    {
                        $result = [];
                        $root = $this->parse($file);
                        foreach ($root->lines['content'] as $num => $content) {
                Severity: Minor
                Found in src/Reporter/Coverage/Collector.php - About 1 hr to fix

                  Method add has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function add($prefix, $paths, $prepend = false)
                      {
                          if (!$prefix) {
                              if ($prepend) {
                                  $this->_fallbackDirsPsr0 = array_merge(
                  Severity: Minor
                  Found in src/Jit/ClassLoader.php - About 1 hr to fix

                    Method match has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function match($actual, $expected)
                        {
                            $args = func_get_args();
                            $expected = count($args) > 2 ? array_slice($args, 1) : $expected;
                            $expected = (array) $expected;
                    Severity: Minor
                    Found in src/Matcher/ToContainKey.php - About 1 hr to fix

                      Method _buildDescription has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function _buildDescription($startIndex = 0)
                          {
                              $times = $this->times();
                      
                              $report = $this->_report;
                      Severity: Minor
                      Found in src/Matcher/ToReceive.php - About 1 hr to fix

                        Method _coverage has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                protected function _coverage()
                                {
                                    return Filters::run($this, 'coverage', [], function ($chain) {
                                        if (!$this->commandLine()->exists('coverage')) {
                                            return;
                        Severity: Minor
                        Found in src/Cli/Kahlan.php - About 1 hr to fix

                          Method patched has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public static function patched($namespace, $className, $methodName, &$substitute = null)
                              {
                                  $name = $className ?: $methodName;
                          
                                  if ($namespace && ($className || function_exists("{$namespace}\\{$name}"))) {
                          Severity: Minor
                          Found in src/Plugin/Monkey.php - About 1 hr to fix

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

                                protected function _blockEnd($runAfterEach = true)
                                {
                                    $type = $this->log()->type();
                                    foreach ($this->_expectations as $expectation) {
                                        if (!($logs = $expectation->logs()) && $type !== 'errored') {
                            Severity: Minor
                            Found in src/Block/Specification.php - About 1 hr to fix

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

                                  public function __construct($config = [])
                                  {
                                      $defaults = [
                                          'driver'         => null,
                                          'path'           => [],
                              Severity: Minor
                              Found in src/Reporter/Coverage/Collector.php - About 1 hr to fix

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

                                    public function nextMatchingBracket()
                                    {
                                        if (!$this->valid()) {
                                            return;
                                        }
                                Severity: Minor
                                Found in src/Jit/TokenStream.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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language