Showing 20 of 31 total issues
Function _runParser
has a Cognitive Complexity of 160 (exceeds 5 allowed). Consider refactoring. Open
function _runParser(Parser $p, State $state)
{
$call = []; // function: [goto label, context]
$args = []; // function arguments
$context = []; // function context: function foo() use(...$context)
- Read upRead up
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 _runParser
has 357 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _runParser(Parser $p, State $state)
{
$call = []; // function: [goto label, context]
$args = []; // function arguments
$context = []; // function context: function foo() use(...$context)
File fast.php
has 376 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Laiz\Parsec;
use Laiz\Func\Maybe;
Function showErrorMessages
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
function showErrorMessages($msgOr, $msgUnknown, $msgExpecting, $msgUnExpected,
$msgEndOfInput, $msgs){
if (!$msgs)
return $msgUnknown;
- Read upRead up
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 functions.php
has 323 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Laiz\Parsec;
use Laiz\Func;
File combinator.php
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace Laiz\Parsec;
use Laiz\Func;
Method showErrorMessages
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function showErrorMessages($msgOr, $msgUnknown, $msgExpecting, $msgUnExpected,
$msgEndOfInput, $msgs){
if (!$msgs)
return $msgUnknown;
Function mergeError
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function mergeError(ParseError $e1, ParseError $e2)
{
$msgs1 = $e1->msgs();
$msgs2 = $e2->msgs();
if (!$msgs2 && $msgs1)
- Read upRead up
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 updatePosString
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function updatePosString(...$args){
$f = function(SourcePos $pos, $str){
$len = strlen($str);
$name = $pos->name();
$line = $pos->line();
- Read upRead up
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 showErrorMessages
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function showErrorMessages($msgOr, $msgUnknown, $msgExpecting, $msgUnExpected,
$msgEndOfInput, $msgs){
Function tokens
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function tokens(...$args){
$f = function($showTokens, $nextPoss, $tts){
if (is_string($tts))
$maybeTts = \Laiz\Parsec\Stream\TypeString::uncons($tts);
else if (is_array($tts))
- Read upRead up
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 updatePosChar
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function updatePosChar(...$args){
$f = function(SourcePos $pos, $char){
if ($char === "\n"){
return new SourcePos($pos->name(),
$pos->line() + 1,
- Read upRead up
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
Avoid too many return
statements within this method. Open
return $msg->msg();
Avoid too many return
statements within this method. Open
return $commasOr($ret);
Avoid too many return
statements within this method. Open
return '';
Avoid too many return
statements within this method. Open
return "\n" . implode("\n", $clean($ret));
Avoid too many return
statements within this method. Open
return $e2;
Avoid too many return
statements within this method. Open
return implode(', ', $ms) . " " . $msgOr . " " . $last;
Avoid too many return
statements within this method. Open
return $pre . " " . $commasOr($ret);
Avoid too many return
statements within this method. Open
return f($f, ...$args);