laravel/framework

View on GitHub

Showing 1,026 of 1,026 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function getOptions()
    {
        return [
            ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use'],
            ['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production'],
src/Illuminate/Database/Console/Migrations/RollbackCommand.php on lines 78..89

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 169.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function whereBetween(Builder $query, $where)
    {
        $between = $where['not'] ? 'not between' : 'between';

        $min = $this->parameter(is_array($where['values']) ? reset($where['values']) : $where['values'][0]);
Severity: Major
Found in src/Illuminate/Database/Query/Grammars/Grammar.php and 1 other location - About 4 hrs to fix
src/Illuminate/Database/Query/Grammars/Grammar.php on lines 428..437

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 167.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    protected function whereBetweenColumns(Builder $query, $where)
    {
        $between = $where['not'] ? 'not between' : 'between';

        $min = $this->wrap(is_array($where['values']) ? reset($where['values']) : $where['values'][0]);
Severity: Major
Found in src/Illuminate/Database/Query/Grammars/Grammar.php and 1 other location - About 4 hrs to fix
src/Illuminate/Database/Query/Grammars/Grammar.php on lines 410..419

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 167.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

File Migrator.php has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace Illuminate\Database\Migrations;

use Illuminate\Console\View\Components\BulletList;
Severity: Minor
Found in src/Illuminate/Database/Migrations/Migrator.php - About 4 hrs to fix

    File Middleware.php has 341 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Illuminate\Foundation\Configuration;
    
    use Closure;
    Severity: Minor
    Found in src/Illuminate/Foundation/Configuration/Middleware.php - About 4 hrs to fix

      BroadcastManager has 33 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class BroadcastManager implements FactoryContract
      {
          /**
           * The application instance.
           *
      Severity: Minor
      Found in src/Illuminate/Broadcasting/BroadcastManager.php - About 4 hrs to fix

        View has 33 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class View implements ArrayAccess, Htmlable, Stringable, ViewContract
        {
            use Macroable {
                __call as macroCall;
            }
        Severity: Minor
        Found in src/Illuminate/View/View.php - About 4 hrs to fix

          Response has 33 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Response implements ArrayAccess, Stringable
          {
              use Concerns\DeterminesStatusCode, Macroable {
                  __call as macroCall;
              }
          Severity: Minor
          Found in src/Illuminate/Http/Client/Response.php - About 4 hrs to fix

            Mailer has 33 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Mailer implements MailerContract, MailQueueContract
            {
                use Macroable;
            
                /**
            Severity: Minor
            Found in src/Illuminate/Mail/Mailer.php - About 4 hrs to fix

              Kernel has 33 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Kernel implements KernelContract
              {
                  use InteractsWithTime;
              
                  /**
              Severity: Minor
              Found in src/Illuminate/Foundation/Http/Kernel.php - About 4 hrs to fix

                PhpRedisConnection has 33 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class PhpRedisConnection extends Connection implements ConnectionContract
                {
                    use PacksPhpRedisValues;
                
                    /**
                Severity: Minor
                Found in src/Illuminate/Redis/Connections/PhpRedisConnection.php - About 4 hrs to fix

                  MailFake has 33 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class MailFake implements Factory, Fake, Mailer, MailQueue
                  {
                      use ForwardsCalls, ReflectsClosures;
                  
                      /**
                  Severity: Minor
                  Found in src/Illuminate/Support/Testing/Fakes/MailFake.php - About 4 hrs to fix

                    File InteractsWithPivotTable.php has 338 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace Illuminate\Database\Eloquent\Relations\Concerns;
                    
                    use BackedEnum;

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public function findOr($id, $columns = ['*'], ?Closure $callback = null)
                          {
                              if ($columns instanceof Closure) {
                                  $callback = $columns;
                      
                      
                      src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php on lines 757..778

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 164.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public function findOr($id, $columns = ['*'], ?Closure $callback = null)
                          {
                              if ($columns instanceof Closure) {
                                  $callback = $columns;
                      
                      
                      Severity: Major
                      Found in src/Illuminate/Database/Eloquent/Relations/BelongsToMany.php and 1 other location - About 4 hrs to fix
                      src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php on lines 454..475

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 164.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public function cancel(string $batchId)
                          {
                              $update = 'SET cancelled_at = :timestamp, finished_at = :timestamp';
                      
                              if ($this->ttl !== null) {
                      Severity: Major
                      Found in src/Illuminate/Bus/DynamoBatchRepository.php and 1 other location - About 4 hrs to fix
                      src/Illuminate/Bus/DynamoBatchRepository.php on lines 308..329

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 162.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Similar blocks of code found in 2 locations. Consider refactoring.
                      Open

                          public function markAsFinished(string $batchId)
                          {
                              $update = 'SET finished_at = :timestamp';
                      
                              if ($this->ttl !== null) {
                      Severity: Major
                      Found in src/Illuminate/Bus/DynamoBatchRepository.php and 1 other location - About 4 hrs to fix
                      src/Illuminate/Bus/DynamoBatchRepository.php on lines 337..358

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 162.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      File Store.php has 331 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      namespace Illuminate\Session;
                      
                      use Closure;
                      Severity: Minor
                      Found in src/Illuminate/Session/Store.php - About 3 hrs to fix

                        Function data_get has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                        Open

                            function data_get($target, $key, $default = null)
                            {
                                if (is_null($key)) {
                                    return $target;
                                }
                        Severity: Minor
                        Found in src/Illuminate/Collections/helpers.php - About 3 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

                        MailManager has 31 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class MailManager implements FactoryContract
                        {
                            /**
                             * The application instance.
                             *
                        Severity: Minor
                        Found in src/Illuminate/Mail/MailManager.php - About 3 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language