laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

Method displayForCli has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function displayForCli(array $data)
    {
        [$table, $columns, $indexes, $foreignKeys] = [
            $data['table'], $data['columns'], $data['indexes'], $data['foreign_keys'],
        ];
Severity: Minor
Found in src/Illuminate/Database/Console/TableCommand.php - About 1 hr to fix

    Method castUsing has 46 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/AsEnumCollection.php - About 1 hr to fix

      Method withoutExceptionHandling has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function withoutExceptionHandling(array $except = [])
          {
              if ($this->originalExceptionHandler == null) {
                  $currentExceptionHandler = app(ExceptionHandler::class);
      
      

        Method gatherApplicationInformation has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function gatherApplicationInformation()
            {
                self::$data = [];
        
                $formatEnabledStatus = fn ($value) => $value ? '<fg=yellow;options=bold>ENABLED</>' : 'OFF';
        Severity: Minor
        Found in src/Illuminate/Foundation/Console/AboutCommand.php - About 1 hr to fix

          Method defaultAliases has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function defaultAliases()
              {
                  return collect([
                      'App' => App::class,
                      'Arr' => Arr::class,
          Severity: Minor
          Found in src/Illuminate/Support/Facades/Facade.php - About 1 hr to fix

            Method test has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function test(Builder $query, EloquentBuilder $userQuery): void
            {
                assertType('object|null', $query->first());
                assertType('object|null', $query->find(1));
                assertType('int|object', $query->findOr(1, fn () => 42));
            Severity: Minor
            Found in types/Database/Query/Builder.php - About 1 hr to fix

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

                Method registerCoreContainerAliases has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function registerCoreContainerAliases()
                    {
                        foreach ([
                            'app' => [self::class, \Illuminate\Contracts\Container\Container::class, \Illuminate\Contracts\Foundation\Application::class, \Psr\Container\ContainerInterface::class],
                            'auth' => [\Illuminate\Auth\AuthManager::class, \Illuminate\Contracts\Auth\Factory::class],
                Severity: Minor
                Found in src/Illuminate/Foundation/Application.php - About 1 hr to fix

                  Function assertStructure has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function assertStructure(?array $structure = null, $responseData = null, bool $exact = false)
                      {
                          if (is_null($structure)) {
                              return $this->assertSimilar($this->decoded);
                          }
                  Severity: Minor
                  Found in src/Illuminate/Testing/AssertableJsonString.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 fill has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function fill(array $attributes)
                      {
                          $totallyGuarded = $this->totallyGuarded();
                  
                          $fillable = $this->fillableFromArray($attributes);
                  Severity: Minor
                  Found in src/Illuminate/Database/Eloquent/Model.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 chunk has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function chunk($size)
                      {
                          if ($size <= 0) {
                              return static::empty();
                          }
                  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 only has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function only($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 handle has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle()
                      {
                          if ($this->option('passport')) {
                              $this->installPassport();
                          } else {
                  Severity: Minor
                  Found in src/Illuminate/Foundation/Console/ApiInstallCommand.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 __serialize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function __serialize()
                      {
                          $values = [];
                  
                          $reflectionClass = new ReflectionClass($this);
                  Severity: Minor
                  Found in src/Illuminate/Queue/SerializesModels.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

                  Method getAttributesFromAttributeString has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function getAttributesFromAttributeString(string $attributeString)
                      {
                          $attributeString = $this->parseShortAttributeSyntax($attributeString);
                          $attributeString = $this->parseAttributeBag($attributeString);
                          $attributeString = $this->parseComponentTagClassStatements($attributeString);
                  Severity: Minor
                  Found in src/Illuminate/View/Compilers/ComponentTagCompiler.php - About 1 hr to fix

                    Method doSend has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function doSend(SentMessage $message): void
                        {
                            $options = $this->options;
                    
                            if ($message->getOriginalMessage() instanceof Message) {
                    Severity: Minor
                    Found in src/Illuminate/Mail/Transport/SesV2Transport.php - About 1 hr to fix

                      Method listEvent has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function listEvent($event, $terminalWidth, $expressionSpacing, $repeatExpressionSpacing, $timezone)
                          {
                              $expression = $this->formatCronExpression($event->expression, $expressionSpacing);
                      
                              $repeatExpression = str_pad($this->getRepeatExpression($event), $repeatExpressionSpacing);
                      Severity: Minor
                      Found in src/Illuminate/Console/Scheduling/ScheduleListCommand.php - About 1 hr to fix

                        Method resolveDumpSource has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function resolveDumpSource()
                            {
                                if (static::$dumpSourceResolver === false) {
                                    return null;
                                }
                        Severity: Minor
                        Found in src/Illuminate/Foundation/Concerns/ResolvesDumpSource.php - About 1 hr to fix

                          Method data_set has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function data_set(&$target, $key, $value, $overwrite = true)
                              {
                                  $segments = is_array($key) ? $key : explode('.', $key);
                          
                                  if (($segment = array_shift($segments)) === '*') {
                          Severity: Minor
                          Found in src/Illuminate/Collections/helpers.php - About 1 hr to fix

                            Method buildRoutingCallback has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function buildRoutingCallback(array|string|null $web,
                                    array|string|null $api,
                                    ?string $pages,
                                    ?string $health,
                                    string $apiPrefix,
                            Severity: Minor
                            Found in src/Illuminate/Foundation/Configuration/ApplicationBuilder.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language