laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

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

    protected function addFluentIndexes()
    {
        foreach ($this->columns as $column) {
            foreach (['primary', 'unique', 'index', 'fulltext', 'fullText', 'spatialIndex'] as $index) {
                // If the column is supposed to be changed to an auto increment column and
Severity: Minor
Found in src/Illuminate/Database/Schema/Blueprint.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 tearDownTheTestEnvironment has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function tearDownTheTestEnvironment(): void
    {
        if ($this->app) {
            $this->callBeforeApplicationDestroyedCallbacks();

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 pack has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function pack(array $values): array
    {
        if (empty($values)) {
            return $values;
        }
Severity: Minor
Found in src/Illuminate/Redis/Connections/PacksPhpRedisValues.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 assertListening has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function assertListening($expectedEvent, $expectedListener)
    {
        foreach ($this->dispatcher->getListeners($expectedEvent) as $listenerClosure) {
            $actualListener = (new ReflectionFunction($listenerClosure))
                        ->getStaticVariables()['listener'];
Severity: Minor
Found in src/Illuminate/Support/Testing/Fakes/EventFake.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 escapeArgument has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public static function escapeArgument($argument)
    {
        // Fix for PHP bug #43784 escapeshellarg removes % from given string
        // Fix for PHP bug #49446 escapeshellarg doesn't work on Windows
        // @see https://bugs.php.net/bug.php?id=43784
Severity: Minor
Found in src/Illuminate/Support/ProcessUtils.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 BroadcastManager.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Illuminate\Broadcasting;

use Ably\AblyRest;
Severity: Minor
Found in src/Illuminate/Broadcasting/BroadcastManager.php - About 2 hrs to fix

    File HasOneOrMany.php has 251 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

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

      Method createABufferedOutputMock has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function createABufferedOutputMock()
          {
              $mock = Mockery::mock(BufferedOutput::class.'[doWrite]')
                      ->shouldAllowMockingProtectedMethods()
                      ->shouldIgnoreMissing();
      Severity: Minor
      Found in src/Illuminate/Testing/PendingCommand.php - About 2 hrs to fix

        Method castAttribute has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function castAttribute($key, $value)
            {
                $castType = $this->getCastType($key);
        
                if (is_null($value) && in_array($castType, static::$primitiveCastTypes)) {
        Severity: Minor
        Found in src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php - About 2 hrs to fix

          Method compileSelfClosingTags has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function compileSelfClosingTags(string $value)
              {
                  $pattern = "/
                      <
                          \s*
          Severity: Minor
          Found in src/Illuminate/View/Compilers/ComponentTagCompiler.php - About 1 hr to fix

            Method compileOpeningTags has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function compileOpeningTags(string $value)
                {
                    $pattern = "/
                        <
                            \s*
            Severity: Minor
            Found in src/Illuminate/View/Compilers/ComponentTagCompiler.php - About 1 hr to fix

              Method getSqlSrvDsn has 49 lines of code (exceeds 25 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 1 hr to fix

                Method where has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function where($column, $operator = null, $value = null, $boolean = 'and')
                    {
                        if ($column instanceof ConditionExpression) {
                            $type = 'Expression';
                
                
                Severity: Minor
                Found in src/Illuminate/Database/Query/Builder.php - About 1 hr to fix

                  Method castUsing has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function castUsing(array $arguments)
                      {
                          return new class($arguments) implements CastsAttributes
                          {
                              protected $arguments;
                  Severity: Minor
                  Found in src/Illuminate/Database/Eloquent/Casts/AsEnumArrayObject.php - About 1 hr to fix

                    Method send has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function send(string $method, string $url, array $options = [])
                        {
                            if (! Str::startsWith($url, ['http://', 'https://'])) {
                                $url = ltrim(rtrim($this->baseUrl, '/').'/'.ltrim($url, '/'), '/');
                            }
                    Severity: Minor
                    Found in src/Illuminate/Http/Client/PendingRequest.php - About 1 hr to fix

                      Method forCli has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function forCli($routes)
                          {
                              $routes = $routes->map(
                                  fn ($route) => array_merge($route, [
                                      'action' => $this->formatActionForCli($route),
                      Severity: Minor
                      Found in src/Illuminate/Foundation/Console/RouteListCommand.php - About 1 hr to fix

                        Function ofMany has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

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

                        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 select has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function select($keys)
                            {
                                if ($keys instanceof Enumerable) {
                                    $keys = $keys->all();
                                } elseif (! is_null($keys)) {
                        Severity: Minor
                        Found in src/Illuminate/Collections/LazyCollection.php - About 1 hr 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 __invoke has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function __invoke($path, $manifestDirectory = '')
                            {
                                static $manifests = [];
                        
                                if (! str_starts_with($path, '/')) {
                        Severity: Minor
                        Found in src/Illuminate/Foundation/Mix.php - About 1 hr 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 getListenerEvents has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            protected static function getListenerEvents($listeners, $basePath)
                            {
                                $listenerEvents = [];
                        
                                foreach ($listeners as $listener) {
                        Severity: Minor
                        Found in src/Illuminate/Foundation/Events/DiscoverEvents.php - About 1 hr 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