laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

Function verifyExpectations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function verifyExpectations()
    {
        if (count($this->test->expectedQuestions)) {
            $this->test->fail('Question "'.Arr::first($this->test->expectedQuestions)[0].'" was not asked.');
        }
Severity: Minor
Found in src/Illuminate/Testing/PendingCommand.php - About 45 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 injectResponseContext has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function injectResponseContext($exception)
    {
        if ($lastException = $this->response->exceptions->last()) {
            return $this->appendExceptionToException($lastException, $exception);
        }
Severity: Minor
Found in src/Illuminate/Testing/TestResponseAssert.php - About 45 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 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function __call($method, $parameters)
    {
        if (static::hasMacro($method)) {
            return $this->macroCall($method, $parameters);
        }
Severity: Minor
Found in src/Illuminate/Database/Eloquent/Factories/Factory.php - About 45 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 write has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    protected function write($component, ...$arguments)
    {
        if ($this->output && class_exists($component)) {
            (new $component($this->output))->render(...$arguments);
        } else {
Severity: Minor
Found in src/Illuminate/Database/Migrations/Migrator.php - About 45 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 hydrate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public function hydrate($context)
    {
        $unserialize = function ($value, $key, $hidden) {
            try {
                return tap($this->getRestoredPropertyValue(unserialize($value)), function ($value) {
Severity: Minor
Found in src/Illuminate/Log/Context/Repository.php - About 45 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

Method join has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function join($table, $first, $operator = null, $second = null, $type = 'inner', $where = false)
Severity: Minor
Found in src/Illuminate/Database/Query/Builder.php - About 45 mins to fix

    Function relationsToArray has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        public function relationsToArray()
        {
            $attributes = [];
    
            foreach ($this->getArrayableRelations() as $key => $value) {
    Severity: Minor
    Found in src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php - About 45 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

    Method hasOneThrough has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function hasOneThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null)
    Severity: Minor
    Found in src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php - About 45 mins to fix

      Function whereKey has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          public function whereKey($id)
          {
              if ($id instanceof Model) {
                  $id = $id->getKey();
              }
      Severity: Minor
      Found in src/Illuminate/Database/Eloquent/Builder.php - About 45 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 newOneOfManySubQuery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function newOneOfManySubQuery($groupBy, $columns = null, $aggregate = null)
          {
              $subQuery = $this->query->getModel()
                  ->newQuery()
                  ->withoutGlobalScopes($this->removedScopes());
      Severity: Minor
      Found in src/Illuminate/Database/Eloquent/Relations/Concerns/CanBeOneOfMany.php - About 45 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

      Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function __construct(Builder $query, Model $parent, $foreignKey, $ownerKey, $type, $relation)
      Severity: Minor
      Found in src/Illuminate/Database/Eloquent/Relations/MorphTo.php - About 45 mins to fix

        Method hasManyThrough has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            public function hasManyThrough($related, $through, $firstKey = null, $secondKey = null, $localKey = null, $secondLocalKey = null)
        Severity: Minor
        Found in src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php - About 45 mins to fix

          Function whereKeyNot has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function whereKeyNot($id)
              {
                  if ($id instanceof Model) {
                      $id = $id->getKey();
                  }
          Severity: Minor
          Found in src/Illuminate/Database/Eloquent/Builder.php - About 45 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

          Method hasMorph has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function hasMorph($relation, $types, $operator = '>=', $count = 1, $boolean = 'and', ?Closure $callback = null)
          Severity: Minor
          Found in src/Illuminate/Database/Eloquent/Concerns/QueriesRelationships.php - About 45 mins to fix

            Method newMorphTo has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                protected function newMorphTo(Builder $query, Model $parent, $foreignKey, $ownerKey, $type, $relation)
            Severity: Minor
            Found in src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php - About 45 mins to fix

              Function compileSelect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function compileSelect(Builder $query)
                  {
                      if (($query->unions || $query->havings) && $query->aggregate) {
                          return $this->compileUnionAggregate($query);
                      }
              Severity: Minor
              Found in src/Illuminate/Database/Query/Grammars/Grammar.php - About 45 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

              Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      BatchFactory $factory,
                      DynamoDbClient $dynamoDbClient,
                      string $applicationName,
                      string $table,
                      ?int $ttl,
              Severity: Minor
              Found in src/Illuminate/Bus/DynamoBatchRepository.php - About 45 mins to fix

                Method __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function __construct(ConnectionInterface $connection, HasherContract $hasher,
                                                $table, $hashKey, $expires = 60,
                                                $throttle = 60)
                Severity: Minor
                Found in src/Illuminate/Auth/Passwords/DatabaseTokenRepository.php - About 45 mins to fix

                  Function doSend has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function doSend(SentMessage $message): void
                      {
                          $email = MessageConverter::toEmail($message->getOriginalMessage());
                  
                          $envelope = $message->getEnvelope();
                  Severity: Minor
                  Found in src/Illuminate/Mail/Transport/ResendTransport.php - About 45 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 configureConnection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function configureConnection(PDO $connection, array $config)
                      {
                          if (isset($config['isolation_level'])) {
                              $connection->exec(sprintf('SET SESSION TRANSACTION ISOLATION LEVEL %s;', $config['isolation_level']));
                          }
                  Severity: Minor
                  Found in src/Illuminate/Database/Connectors/MySqlConnector.php - About 45 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