kahlan/kahlan

View on GitHub
src/Cli/Kahlan.php

Summary

Maintainability
F
4 days
Test Coverage

File Kahlan.php has 616 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
namespace Kahlan\Cli {

    use Kahlan\Jit\Patcher\FinalClass;
    use RecursiveDirectoryIterator;
Severity: Major
Found in src/Cli/Kahlan.php - About 1 day to fix

    Method initKahlanGlobalFunctions has 164 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function initKahlanGlobalFunctions()
        {
            if (getenv('KAHLAN_DISABLE_FUNCTIONS') || (defined('KAHLAN_DISABLE_FUNCTIONS') && KAHLAN_DISABLE_FUNCTIONS)) {
                return;
            }
    Severity: Major
    Found in src/Cli/Kahlan.php - About 6 hrs to fix

      Function initKahlanGlobalFunctions has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

          function initKahlanGlobalFunctions()
          {
              if (getenv('KAHLAN_DISABLE_FUNCTIONS') || (defined('KAHLAN_DISABLE_FUNCTIONS') && KAHLAN_DISABLE_FUNCTIONS)) {
                  return;
              }
      Severity: Minor
      Found in src/Cli/Kahlan.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

      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

        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

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

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

                    public function __construct($options = [])
                    {
                        $defaults = ['autoloader' => null, 'suite' => null];
                        $options += $defaults;
            
            
            Severity: Minor
            Found in src/Cli/Kahlan.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

                Function _coverage has a Cognitive Complexity of 7 (exceeds 5 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 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