crysalead/kahlan

View on GitHub

Showing 187 of 191 total issues

Function _dump has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    protected static function _dump($string)
    {
        $es = ['0', 'x07', 'x08', 't', 'n', 'v', 'f', 'r'];
        $unescaped = '';
        $chars = str_split($string);
Severity: Minor
Found in src/Util/Text.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 instance has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function instance($options = [])
    {
        $class = static::classname($options);

        if (isset($options['args'])) {
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

Function parse has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function parse($argv, $override = true)
    {
        $exists = [];
        $override ? $this->_values = $this->_defaults : $exists = array_fill_keys(array_keys($this->_values), true);

Severity: Minor
Found in src/Cli/CommandLine.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 _useNode has a Cognitive Complexity of 10 (exceeds 5 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

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

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

    public function __construct($config = [])
    {
        $defaults = [
            'suite'   => null,
            'parent'  => null,
Severity: Minor
Found in src/Block.php - About 1 hr to fix

    Method _process has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function _process($options = [])
        {
            $suite = $this->suite();
            if ($suite->root()->focused() && !$this->focused()) {
                return;
    Severity: Minor
    Found in src/Block.php - About 1 hr to fix

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

          public function __construct($actual, $expected)
          {
              $this->_backtrace = Debugger::backtrace();
      
              if (is_string($actual)) {
      Severity: Minor
      Found in src/Matcher/ToReceive.php - About 1 hr to fix

        Method _renderCoverage has 27 lines of code (exceeds 25 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

          Method _getMetricsReport has 26 lines of code (exceeds 25 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

            Method _processTree has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function _processTree($parent)
                {
                    foreach ($parent->tree as $node) {
                        if ($node->processable && $node->type === 'class' && $node->extends) {
                            $namespace = $node->namespace->name . '\\';
            Severity: Minor
            Found in src/Jit/Patcher/Layer.php - About 1 hr to fix

              Method partition has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function partition($index, $total)
                  {
                      $index = (integer) $index;
                      $total = (integer) $total;
                      if (!$index || !$total || $index > $total) {
              Severity: Minor
              Found in src/Block/Group.php - About 1 hr to fix

                Method _renderMetrics has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function _renderMetrics($metrics, $verbosity)
                    {
                        $maxLabelWidth = null;
                        if ($verbosity === 1) {
                            return;
                Severity: Minor
                Found in src/Reporter/Coverage.php - About 1 hr to fix

                  Method stop has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function stop($summary)
                      {
                          if (!$this->_verbosity) {
                              return;
                          }
                  Severity: Minor
                  Found in src/Reporter/Coverage.php - About 1 hr to fix

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

                        public function cast($value, $type, $array = false)
                        {
                            if (is_array($value)) {
                                $result = [];
                                foreach ($value as $key => $item) {
                    Severity: Minor
                    Found in src/Cli/CommandLine.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 addPsr4 has a Cognitive Complexity of 9 (exceeds 5 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 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 matchArgs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function matchArgs($args)
                        {
                            if ($this->_args === null || $args === null) {
                                return true;
                            }
                    Severity: Minor
                    Found in src/Plugin/Call/Message.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 _get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function _get($name)
                        {
                            $config = $this->option($name);
                            [$key, $extra] = $this->_splitOptionName($name);
                    
                    
                    Severity: Minor
                    Found in src/Cli/CommandLine.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 findPath has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function findPath($namespace, $forceDir = false)
                        {
                            $paths = static::prefixes();
                            $logicalPath = trim(strtr($namespace, '\\', DIRECTORY_SEPARATOR), DIRECTORY_SEPARATOR);
                    
                    
                    Severity: Minor
                    Found in src/Jit/ClassLoader.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 __call has a Cognitive Complexity of 9 (exceeds 5 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 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

                    Severity
                    Category
                    Status
                    Source
                    Language