laravel/framework

View on GitHub

Showing 838 of 1,045 total issues

Avoid too many return statements within this method.
Open

        return $this->getSize($attribute, $value) <= $this->getSize($attribute, $comparedToValue);
Severity: Major
Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $numerator->remainder($denominator)->isZero();
    Severity: Major
    Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return trim((string) $value) === '';
      Severity: Major
      Found in src/Illuminate/Support/helpers.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return $this->getSize($attribute, $value) >= $this->getSize($attribute, $comparedToValue);
        Severity: Major
        Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                  return new $dateClass($date->format('Y-m-d H:i:s.u'), $date->getTimezone());
          Severity: Major
          Found in src/Illuminate/Support/DateFactory.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                                    return false;
            Severity: Major
            Found in src/Illuminate/Support/Testing/Fakes/BusFake.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                      return true;
              Severity: Major
              Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                        return false;
                Severity: Major
                Found in src/Illuminate/Support/Reflector.php - About 30 mins to fix

                  Function handle has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function handle()
                      {
                          if ($this->isProhibited() ||
                              ! $this->confirmToProceed()) {
                              return 1;
                  Severity: Minor
                  Found in src/Illuminate/Database/Console/Migrations/RefreshCommand.php - About 25 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 lazy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function lazy($chunkSize = 1000)
                      {
                          if ($chunkSize < 1) {
                              throw new InvalidArgumentException('The chunk size should be at least 1');
                          }
                  Severity: Minor
                  Found in src/Illuminate/Database/Concerns/BuildsQueries.php - About 25 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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function run()
                      {
                          $this->hasExecuted = true;
                  
                          $mock = $this->mockConsoleOutput();
                  Severity: Minor
                  Found in src/Illuminate/Testing/PendingCommand.php - About 25 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 assertViewHas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function assertViewHas($key, $value = null)
                      {
                          if (is_array($key)) {
                              return $this->assertViewHasAll($key);
                          }
                  Severity: Minor
                  Found in src/Illuminate/Testing/TestResponse.php - About 25 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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function get($key, array $replace = [], $locale = null, $fallback = true)
                      {
                          $locale = $locale ?: $this->locale;
                  
                          // For JSON translations, there is only one file per locale, so we will simply load
                  Severity: Minor
                  Found in src/Illuminate/Translation/Translator.php - About 25 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 guess has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function guess($migration)
                      {
                          foreach (self::CREATE_PATTERNS as $pattern) {
                              if (preg_match($pattern, $migration, $matches)) {
                                  return [$matches[1], $create = true];
                  Severity: Minor
                  Found in src/Illuminate/Database/Console/Migrations/TableGuesser.php - About 25 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 resolveImplicitBindingIfPossible has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function resolveImplicitBindingIfPossible($key, $value, $callbackParameters)
                      {
                          foreach ($callbackParameters as $parameter) {
                              if (! $this->isImplicitlyBindable($key, $parameter)) {
                                  continue;
                  Severity: Minor
                  Found in src/Illuminate/Broadcasting/Broadcasters/Broadcaster.php - About 25 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 assertSessionDoesntHaveErrors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function assertSessionDoesntHaveErrors($keys = [], $format = null, $errorBag = 'default')
                      {
                          $keys = (array) $keys;
                  
                          if (empty($keys)) {
                  Severity: Minor
                  Found in src/Illuminate/Testing/TestResponse.php - About 25 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 compileString has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function compileString($value)
                      {
                          [$this->footer, $result] = [[], ''];
                  
                          foreach ($this->prepareStringsForCompilationUsing as $callback) {
                  Severity: Minor
                  Found in src/Illuminate/View/Compilers/BladeCompiler.php - About 25 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 displayForCli has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function displayForCli(array $data)
                      {
                          $platform = $data['platform'];
                          $tables = $data['tables'];
                          $views = $data['views'] ?? null;
                  Severity: Minor
                  Found in src/Illuminate/Database/Console/ShowCommand.php - About 25 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 assertViewHas has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function assertViewHas($key, $value = null)
                      {
                          if (is_array($key)) {
                              return $this->assertViewHasAll($key);
                          }
                  Severity: Minor
                  Found in src/Illuminate/Testing/TestView.php - About 25 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 orderedChunkById has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function orderedChunkById($count, callable $callback, $column = null, $alias = null, $descending = false)
                      {
                          $column ??= $this->defaultKeyName();
                  
                          $alias ??= $column;
                  Severity: Minor
                  Found in src/Illuminate/Database/Concerns/BuildsQueries.php - About 25 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