Showing 10 of 10 total issues
Method matchers
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function matchers() : Collection
{
return new Collection([
'match dataproviders' => $this->treeMatcher()
->withChild(function(ClassDeclaration $node) {
Method matchers
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function matchers(): Collection
{
return new Collection([
'the boot method' => $this->treeMatcher()
->withChild(function(MethodDeclaration $node) {
Method walk
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function walk($nodes) : void
{
$this->depth++;
$indent = str_repeat('┃ ', $this->depth);
Method parseRule
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function parseRule(array $rule) : Closure
{
// Parse the rule arguments into a string representation of the signature.
// This lets us declaratively "overload" the rule definitions based on
// the argument types that were provided.
Method files
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
protected function files() : LazyCollection
{
[$files, $directories] = $this->targets();
// If we were provided a list of target files, just return that list
Avoid too many return
statements within this method. Open
Open
return function(Node $node) use ($rule) {
return get_class($node) === $rule[0]
&& $rule[1]($node);
};
Avoid too many return
statements within this method. Open
Open
return LazyCollection::make($finder);
Avoid too many return
statements within this method. Open
Open
return [$files, $directories];
Function exitNode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
public function exitNode(Node $node) : void
{
$exiting_index = $this->rules->search(function($rule) use ($node) {
return $node === $rule->node;
});
- 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 getExpectedNodeType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
protected function getExpectedNodeType(Closure $matcher) : string
{
$reflect = new ReflectionFunction($matcher);
if ($reflect->getNumberOfParameters() > 0) {
- 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"