laravel/framework

View on GitHub

Showing 1,045 of 1,045 total issues

Sleep has 28 functions (exceeds 20 allowed). Consider refactoring.
Open

class Sleep
{
    use Macroable;

    /**
Severity: Minor
Found in src/Illuminate/Support/Sleep.php - About 3 hrs to fix

    File GeneratorCommand.php has 304 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Illuminate\Console;
    
    use Illuminate\Console\Concerns\CreatesMatchingTest;
    Severity: Minor
    Found in src/Illuminate/Console/GeneratorCommand.php - About 3 hrs to fix

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

          public function whereDay($column, $operator, $value = null, $boolean = 'and')
          {
              [$value, $operator] = $this->prepareValueAndOperator(
                  $value, $operator, func_num_args() === 2
              );
      Severity: Major
      Found in src/Illuminate/Database/Query/Builder.php and 1 other location - About 3 hrs to fix
      src/Illuminate/Database/Query/Builder.php on lines 1575..1592

      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 147.

      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 whereMonth($column, $operator, $value = null, $boolean = 'and')
          {
              [$value, $operator] = $this->prepareValueAndOperator(
                  $value, $operator, func_num_args() === 2
              );
      Severity: Major
      Found in src/Illuminate/Database/Query/Builder.php and 1 other location - About 3 hrs to fix
      src/Illuminate/Database/Query/Builder.php on lines 1530..1547

      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 147.

      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

      Function data_forget has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          function data_forget(&$target, $key)
          {
              $segments = is_array($key) ? $key : explode('.', $key);
      
              if (($segment = array_shift($segments)) === '*' && Arr::accessible($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

      File MakesHttpRequests.php has 302 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace Illuminate\Foundation\Testing\Concerns;
      
      use Illuminate\Contracts\Http\Kernel as HttpKernel;
      Severity: Minor
      Found in src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php - About 3 hrs to fix

        File ReplacesAttributes.php has 301 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        namespace Illuminate\Validation\Concerns;
        
        use Illuminate\Support\Arr;
        Severity: Minor
        Found in src/Illuminate/Validation/Concerns/ReplacesAttributes.php - About 3 hrs to fix

          File MailManager.php has 300 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          namespace Illuminate\Mail;
          
          use Aws\Ses\SesClient;
          Severity: Minor
          Found in src/Illuminate/Mail/MailManager.php - About 3 hrs to fix

            SQLiteGrammar has 27 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class SQLiteGrammar extends Grammar
            {
                /**
                 * All of the available clause operators.
                 *
            Severity: Minor
            Found in src/Illuminate/Database/Query/Grammars/SQLiteGrammar.php - About 3 hrs to fix

              MySqlGrammar has 27 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class MySqlGrammar extends Grammar
              {
                  /**
                   * The grammar specific operators.
                   *
              Severity: Minor
              Found in src/Illuminate/Database/Query/Grammars/MySqlGrammar.php - About 3 hrs to fix

                Job has 27 functions (exceeds 20 allowed). Consider refactoring.
                Open

                abstract class Job
                {
                    use InteractsWithTime;
                
                    /**
                Severity: Minor
                Found in src/Illuminate/Queue/Jobs/Job.php - About 3 hrs to fix

                  File Kernel.php has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  namespace Illuminate\Foundation\Console;
                  
                  use Carbon\CarbonInterval;
                  Severity: Minor
                  Found in src/Illuminate/Foundation/Console/Kernel.php - About 3 hrs to fix

                    Function daemon has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function daemon($connectionName, $queue, WorkerOptions $options)
                        {
                            if ($supportsAsyncSignals = $this->supportsAsyncSignals()) {
                                $this->listenForSignals();
                            }
                    Severity: Minor
                    Found in src/Illuminate/Queue/Worker.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

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

                        public static function createUuidsUsingSequence(array $sequence, $whenMissing = null)
                        {
                            $next = 0;
                    
                            $whenMissing ??= function () use (&$next) {
                    Severity: Major
                    Found in src/Illuminate/Support/Str.php and 1 other location - About 3 hrs to fix
                    src/Illuminate/Support/Str.php on lines 1846..1871

                    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 143.

                    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 static function createUlidsUsingSequence(array $sequence, $whenMissing = null)
                        {
                            $next = 0;
                    
                            $whenMissing ??= function () use (&$next) {
                    Severity: Major
                    Found in src/Illuminate/Support/Str.php and 1 other location - About 3 hrs to fix
                    src/Illuminate/Support/Str.php on lines 1739..1764

                    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 143.

                    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 morphMany($related, $name, $type = null, $id = null, $localKey = null)
                        {
                            $instance = $this->newRelatedInstance($related);
                    
                            // Here we will gather up the morph type and ID for the relationship so that we
                    src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php on lines 179..190

                    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 142.

                    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 assertNotSoftDeleted($table, array $data = [], $connection = null, $deletedAtColumn = 'deleted_at')
                        {
                            if ($this->isSoftDeletableModel($table)) {
                                return $this->assertNotSoftDeleted(
                                    $table->getTable(),
                    src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php on lines 97..118

                    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 142.

                    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 assertSoftDeleted($table, array $data = [], $connection = null, $deletedAtColumn = 'deleted_at')
                        {
                            if ($this->isSoftDeletableModel($table)) {
                                return $this->assertSoftDeleted(
                                    $table->getTable(),
                    src/Illuminate/Foundation/Testing/Concerns/InteractsWithDatabase.php on lines 129..150

                    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 142.

                    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 morphOne($related, $name, $type = null, $id = null, $localKey = null)
                        {
                            $instance = $this->newRelatedInstance($related);
                    
                            [$type, $id] = $this->getMorphs($name, $type, $id);
                    src/Illuminate/Database/Eloquent/Concerns/HasRelationships.php on lines 470..484

                    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 142.

                    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

                    ComponentTagCompiler has 26 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class ComponentTagCompiler
                    {
                        /**
                         * The Blade compiler instance.
                         *
                    Severity: Minor
                    Found in src/Illuminate/View/Compilers/ComponentTagCompiler.php - About 3 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language