laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

Function flushHandlersState has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function flushHandlersState()
    {
        while (true) {
            $previousHandler = set_exception_handler(static fn () => null);

Severity: Minor
Found in src/Illuminate/Foundation/Bootstrap/HandleExceptions.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 getLockForPopping has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function getLockForPopping()
    {
        $databaseEngine = $this->database->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME);
        $databaseVersion = $this->database->getConfig('version') ?? $this->database->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION);

Severity: Minor
Found in src/Illuminate/Queue/DatabaseQueue.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 blank has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    function blank($value)
    {
        if (is_null($value)) {
            return true;
        }
Severity: Minor
Found in src/Illuminate/Support/helpers.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 apa has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public static function apa($value)
    {
        if (trim($value) === '') {
            return $value;
        }
Severity: Minor
Found in src/Illuminate/Support/Str.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 __construct has 10 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct(string $id,
                                string $name,
                                int $totalJobs,
                                int $pendingJobs,
                                int $failedJobs,
Severity: Major
Found in src/Illuminate/Support/Testing/Fakes/BatchFake.php - About 1 hr to fix

    Function failsBasicDimensionChecks has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function failsBasicDimensionChecks($parameters, $width, $height)
        {
            return (isset($parameters['width']) && $parameters['width'] != $width) ||
                   (isset($parameters['min_width']) && $parameters['min_width'] > $width) ||
                   (isset($parameters['max_width']) && $parameters['max_width'] < $width) ||
    Severity: Minor
    Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.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 isCallable has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        public static function isCallable($var, $syntaxOnly = false)
        {
            if (! is_array($var)) {
                return is_callable($var, $syntaxOnly);
            }
    Severity: Minor
    Found in src/Illuminate/Support/Reflector.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 resolveForRoute has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function resolveForRoute($container, $route)
        {
            $parameters = $route->parameters();
    
            $route = static::resolveBackedEnumsForRoute($route, $parameters);
    Severity: Minor
    Found in src/Illuminate/Routing/ImplicitRouteBinding.php - About 1 hr to fix

      Method promptForMissingArgumentsUsing has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function promptForMissingArgumentsUsing()
          {
              return [
                  'name' => [
                      'What should the '.strtolower($this->type).' be named?',
      Severity: Minor
      Found in src/Illuminate/Console/GeneratorCommand.php - About 1 hr to fix

        Method runEvent has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function runEvent($event)
            {
                $summary = $event->getSummaryForDisplay();
        
                $command = $event instanceof CallbackEvent
        Severity: Minor
        Found in src/Illuminate/Console/Scheduling/ScheduleRunCommand.php - About 1 hr to fix

          Method writePrompt has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              #[\Override]
              protected function writePrompt(OutputInterface $output, Question $question): void
              {
                  $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
          
          
          Severity: Minor
          Found in src/Illuminate/Console/QuestionHelper.php - About 1 hr to fix

            Method handle has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function handle()
                {
                    $key = $this->option('key') ?: Env::get('LARAVEL_ENV_ENCRYPTION_KEY');
            
                    if (! $key) {
            Severity: Minor
            Found in src/Illuminate/Foundation/Console/EnvironmentDecryptCommand.php - About 1 hr to fix

              Method __serialize has 31 lines of code (exceeds 25 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

                Method apa has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public static function apa($value)
                    {
                        if (trim($value) === '') {
                            return $value;
                        }
                Severity: Minor
                Found in src/Illuminate/Support/Str.php - About 1 hr to fix

                  Method whereContains has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function whereContains(string $key, $expected)
                      {
                          $actual = Collection::make(
                              $this->prop($key) ?? $this->prop()
                          );
                  Severity: Minor
                  Found in src/Illuminate/Testing/Fluent/Concerns/Matching.php - About 1 hr to fix

                    Method render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function render()
                        {
                            $template = <<<'EOF'
                    <?php extract(collect($attributes->getAttributes())->mapWithKeys(function ($value, $key) { return [Illuminate\Support\Str::camel(str_replace([':', '.'], ' ', $key)) => $value]; })->all(), EXTR_SKIP); ?>
                    {{ props }}
                    Severity: Minor
                    Found in src/Illuminate/View/DynamicComponent.php - About 1 hr to fix

                      Method getVirtualAttributes has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          protected function getVirtualAttributes($model, $columns)
                          {
                              $class = new ReflectionClass($model);
                      
                              return collect($class->getMethods())
                      Severity: Minor
                      Found in src/Illuminate/Database/Console/ShowModelCommand.php - About 1 hr to fix

                        Method fill has 30 lines of code (exceeds 25 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

                          Method setAttribute has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function setAttribute($key, $value)
                              {
                                  // First we will check for the presence of a mutator for the set operation
                                  // which simply lets the developers tweak the attribute as it is set on
                                  // this model, such as "json_encoding" a listing of data for storage.
                          Severity: Minor
                          Found in src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php - About 1 hr to fix

                            Method addCastAttributesToArray has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                protected function addCastAttributesToArray(array $attributes, array $mutatedAttributes)
                                {
                                    foreach ($this->getCasts() as $key => $value) {
                                        if (! array_key_exists($key, $attributes) ||
                                            in_array($key, $mutatedAttributes)) {
                            Severity: Minor
                            Found in src/Illuminate/Database/Eloquent/Concerns/HasAttributes.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language