laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

Function assertJsonValidationErrors has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function assertJsonValidationErrors($errors, $responseKey = 'errors')
    {
        $errors = Arr::wrap($errors);

        PHPUnit::withResponse($this)->assertNotEmpty($errors, 'No validation errors were provided.');
Severity: Minor
Found in src/Illuminate/Testing/TestResponse.php - About 2 hrs 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 originalIsEquivalent has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function originalIsEquivalent($key)
    {
        if (! array_key_exists($key, $this->original)) {
            return false;
        }
Severity: Minor
Found in src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php - About 2 hrs 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 resolveForRoute has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public static function resolveForRoute($container, $route)
    {
        $parameters = $route->parameters();

        $route = static::resolveBackedEnumsForRoute($route, $parameters);
Severity: Minor
Found in src/Illuminate/Routing/ImplicitRouteBinding.php - About 2 hrs 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

File Factory.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Illuminate\View;

use Illuminate\Contracts\Container\Container;
Severity: Minor
Found in src/Illuminate/View/Factory.php - About 2 hrs to fix

    Method ofMany has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function ofMany($column = 'id', $aggregate = 'MAX', $relation = null)
        {
            $this->isOneOfMany = true;
    
            $this->relationName = $relation ?: $this->getDefaultOneOfManyJoinAlias(

      FileViewFinder has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class FileViewFinder implements ViewFinderInterface
      {
          /**
           * The filesystem instance.
           *
      Severity: Minor
      Found in src/Illuminate/View/FileViewFinder.php - About 2 hrs to fix

        AssertableJsonString has 21 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class AssertableJsonString implements ArrayAccess, Countable
        {
            /**
             * The original encoded json.
             *
        Severity: Minor
        Found in src/Illuminate/Testing/AssertableJsonString.php - About 2 hrs to fix

          Logger has 21 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Logger implements LoggerInterface
          {
              use Conditionable;
          
              /**
          Severity: Minor
          Found in src/Illuminate/Log/Logger.php - About 2 hrs to fix

            DynamoBatchRepository has 21 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class DynamoBatchRepository implements BatchRepository
            {
                /**
                 * The batch factory instance.
                 *
            Severity: Minor
            Found in src/Illuminate/Bus/DynamoBatchRepository.php - About 2 hrs to fix

              Message has 21 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Message
              {
                  use ForwardsCalls;
              
                  /**
              Severity: Minor
              Found in src/Illuminate/Mail/Message.php - About 2 hrs to fix

                DatabaseBatchRepository has 21 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class DatabaseBatchRepository implements PrunableBatchRepository
                {
                    /**
                     * The batch factory instance.
                     *
                Severity: Minor
                Found in src/Illuminate/Bus/DatabaseBatchRepository.php - About 2 hrs to fix

                  Request has 21 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Request implements ArrayAccess
                  {
                      use Macroable;
                  
                      /**
                  Severity: Minor
                  Found in src/Illuminate/Http/Client/Request.php - About 2 hrs to fix

                    DynamoDbStore has 21 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class DynamoDbStore implements LockProvider, Store
                    {
                        use InteractsWithTime;
                    
                        /**
                    Severity: Minor
                    Found in src/Illuminate/Cache/DynamoDbStore.php - About 2 hrs to fix

                      Wormhole has 21 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Wormhole
                      {
                          /**
                           * The amount of time to travel.
                           *
                      Severity: Minor
                      Found in src/Illuminate/Foundation/Testing/Wormhole.php - About 2 hrs to fix

                        RouteListCommand has 21 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        #[AsCommand(name: 'route:list')]
                        class RouteListCommand extends Command
                        {
                            /**
                             * The console command name.
                        Severity: Minor
                        Found in src/Illuminate/Foundation/Console/RouteListCommand.php - About 2 hrs to fix

                          DatabaseQueue has 21 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class DatabaseQueue extends Queue implements QueueContract, ClearableQueue
                          {
                              /**
                               * The database connection instance.
                               *
                          Severity: Minor
                          Found in src/Illuminate/Queue/DatabaseQueue.php - About 2 hrs to fix

                            Method withAggregate has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function withAggregate($relations, $column, $function = null)
                                {
                                    if (empty($relations)) {
                                        return $this;
                                    }
                            Severity: Major
                            Found in src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php - About 2 hrs to fix

                              File SqlServerGrammar.php has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              <?php
                              
                              namespace Illuminate\Database\Query\Grammars;
                              
                              use Illuminate\Database\Query\Builder;
                              Severity: Minor
                              Found in src/Illuminate/Database/Query/Grammars/SqlServerGrammar.php - About 2 hrs to fix

                                File QueueFake.php has 254 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                
                                namespace Illuminate\Support\Testing\Fakes;
                                
                                use BadMethodCallException;
                                Severity: Minor
                                Found in src/Illuminate/Support/Testing/Fakes/QueueFake.php - About 2 hrs to fix

                                  Function getSqlSrvDsn has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      protected function getSqlSrvDsn(array $config)
                                      {
                                          $arguments = [
                                              'Server' => $this->buildHostString($config, ','),
                                          ];
                                  Severity: Minor
                                  Found in src/Illuminate/Database/Connectors/SqlServerConnector.php - About 2 hrs 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