kahlan/kahlan

View on GitHub

Showing 191 of 191 total issues

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

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

        protected function _findFileWithExtension($class, $ext)
        {
            // PSR-4 lookup
            $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
    
    
    Severity: Minor
    Found in src/Jit/ClassLoader.php - About 1 hr 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 _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

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

        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 _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 generate has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function generate($options = [])
            {
                $defaults = [
                    'class'      => 'Kahlan\Spec\Plugin\Double\Double' . static::$_index++,
                    'extends'    => '',
        Severity: Minor
        Found in src/Plugin/Double.php - About 1 hr to fix

          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 _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 __call has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function __call($matcherName, $args)
                  {
                      $result = true;
                      $spec = $this->_actual;
                      $this->_passed = true;
              Severity: Minor
              Found in src/Expectation.php - About 1 hr to fix

                Method _useNode has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function _useNode()
                    {
                        $current = $this->_states['current'];
                        $token = $this->_stream->current(true);
                        $last = $alias = $use = '';
                Severity: Minor
                Found in src/Jit/Parser.php - About 1 hr to fix

                  Method _parseArgs has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function _parseArgs()
                      {
                          $cpt = 0;
                          $value = $name = '';
                          $args = [];
                  Severity: Minor
                  Found in src/Jit/Parser.php - About 1 hr to fix

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

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

                    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 __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 backtrace has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public static function backtrace($options = [])
                          {
                              $defaults = [
                                  'trace'  => [],
                                  'start'  => 0,
                      Severity: Minor
                      Found in src/Analysis/Debugger.php - About 1 hr to fix

                        Function _matchReference has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected static function _matchReference($reference, $logs = [])
                            {
                                foreach ($logs as $log) {
                                    if (!$reference) {
                                        if (empty($log['class']) && empty($log['instance'])) {
                        Severity: Minor
                        Found in src/Plugin/Call/Calls.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 find has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function find($references, $method = null, $args = null)
                            {
                                $references = (array) $references;
                                $stub = null;
                                foreach ($references as $reference) {
                        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

                        Function typehint has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public static function typehint($parameter)
                            {
                                $type = $parameter->getType();
                                $typehint = '';
                                if ($type) {
                        Severity: Minor
                        Found in src/Analysis/Inspector.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 _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
                          Severity
                          Category
                          Status
                          Source
                          Language