glhd/laralint

View on GitHub

Showing 10 of 10 total issues

Method matchers has 111 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function matchers() : Collection
    {
        return new Collection([
            'match dataproviders' => $this->treeMatcher()
                ->withChild(function(ClassDeclaration $node) {
Severity: Major
Found in src/Linters/OrderClassMembers.php - About 4 hrs to fix

    Method matchers has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function matchers(): Collection
        {
            return new Collection([
                'the boot method' => $this->treeMatcher()
                    ->withChild(function(MethodDeclaration $node) {
    Severity: Minor
    Found in src/Linters/OrderModelMembers.php - About 1 hr to fix

      Method walk has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function walk($nodes) : void
          {
              $this->depth++;
              
              $indent = str_repeat('┃   ', $this->depth);
      Severity: Minor
      Found in src/Commands/DumpCommand.php - About 1 hr to fix

        Method parseRule has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        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.
        Severity: Minor
        Found in src/Linters/Matchers/TreeMatcher.php - About 1 hr to fix

          Method files has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function files() : LazyCollection
              {
                  [$files, $directories] = $this->targets();
                  
                  // If we were provided a list of target files, just return that list 
          Severity: Minor
          Found in src/Commands/LintCommand.php - About 1 hr to fix

            Avoid too many return statements within this method.
            Open

                            return function(Node $node) use ($rule) {
                                return get_class($node) === $rule[0]
                                    && $rule[1]($node);
                            };
            Severity: Major
            Found in src/Linters/Matchers/TreeMatcher.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return LazyCollection::make($finder);
              Severity: Major
              Found in src/Commands/LintCommand.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return [$files, $directories];
                Severity: Major
                Found in src/Commands/LintCommand.php - About 30 mins to fix

                  Function exitNode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function exitNode(Node $node) : void
                      {
                          $exiting_index = $this->rules->search(function($rule) use ($node) {
                              return $node === $rule->node;
                          });
                  Severity: Minor
                  Found in src/Linters/Matchers/TreeMatcher.php - About 25 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 getExpectedNodeType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function getExpectedNodeType(Closure $matcher) : string
                      {
                          $reflect = new ReflectionFunction($matcher);
                          
                          if ($reflect->getNumberOfParameters() > 0) {
                  Severity: Minor
                  Found in src/Linters/Matchers/TreeMatcher.php - About 25 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