laravel/framework

View on GitHub

Showing 864 of 1,073 total issues

Function validateDateFormat has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateDateFormat($attribute, $value, $parameters)
    {
        $this->requireParameterCount(1, $parameters, 'date_format');

        if (! is_string($value) && ! is_numeric($value)) {
Severity: Minor
Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 35 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 validateIn has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateIn($attribute, $value, $parameters)
    {
        if (is_array($value) && $this->hasRule($attribute, 'Array')) {
            foreach ($value as $element) {
                if (is_array($element)) {
Severity: Minor
Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 35 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 is has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public static function is($pattern, $value)
    {
        $value = (string) $value;

        if (! is_iterable($pattern)) {
Severity: Minor
Found in src/Illuminate/Support/Str.php - About 35 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 validateActiveUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateActiveUrl($attribute, $value)
    {
        if (! is_string($value)) {
            return false;
        }
Severity: Minor
Found in src/Illuminate/Validation/Concerns/ValidatesAttributes.php - About 35 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 url has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function url($path)
    {
        if (isset($this->config['prefix'])) {
            $path = $this->concatPathToUrl($this->config['prefix'], $path);
        }
Severity: Minor
Found in src/Illuminate/Filesystem/FilesystemAdapter.php - About 35 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 deleteDirectory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteDirectory($directory, $preserve = false)
    {
        if (! $this->isDirectory($directory)) {
            return false;
        }
Severity: Minor
Found in src/Illuminate/Filesystem/Filesystem.php - About 35 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 assertNotSentTo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function assertNotSentTo($notifiable, $notification, $callback = null)
    {
        if (is_array($notifiable) || $notifiable instanceof Collection) {
            if (count($notifiable) === 0) {
                throw new Exception('No notifiable given.');
Severity: Minor
Found in src/Illuminate/Support/Testing/Fakes/NotificationFake.php - About 35 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

Avoid too many return statements within this method.
Open

                return (($number % 10 == 1) && ($number % 100 != 11)) ? 0 : ((($number % 10 >= 2) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2);
Severity: Major
Found in src/Illuminate/Translation/MessageSelector.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $guess;
    Severity: Major
    Found in src/Illuminate/View/Compilers/ComponentTagCompiler.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return $component;
      Severity: Major
      Found in src/Illuminate/View/Compilers/ComponentTagCompiler.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                        return ($number == 1) ? 0 : (($number == 2) ? 1 : ((($number == 8) || ($number == 11)) ? 2 : 3));
        Severity: Major
        Found in src/Illuminate/Translation/MessageSelector.php - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                          return ($number == 1) ? 0 : ((($number >= 2) && ($number <= 4)) ? 1 : 2);
          Severity: Major
          Found in src/Illuminate/Translation/MessageSelector.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return ($number % 10 == 1) ? 0 : 1;
            Severity: Major
            Found in src/Illuminate/Translation/MessageSelector.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return $this->escapeString($value);
              Severity: Major
              Found in src/Illuminate/Database/Connection.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return ($number == 1) ? 0 : (($number == 2) ? 1 : 2);
                Severity: Major
                Found in src/Illuminate/Translation/MessageSelector.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                                  return ($number == 1) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 12) || ($number % 100 > 14))) ? 1 : 2);
                  Severity: Major
                  Found in src/Illuminate/Translation/MessageSelector.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return new DatabaseTransactionsManager;
                    Severity: Major
                    Found in src/Illuminate/Database/DatabaseServiceProvider.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                              return $this;
                      Severity: Major
                      Found in src/Illuminate/Testing/Fluent/Concerns/Has.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                        return ($number % 100 == 1) ? 0 : (($number % 100 == 2) ? 1 : ((($number % 100 == 3) || ($number % 100 == 4)) ? 2 : 3));
                        Severity: Major
                        Found in src/Illuminate/Translation/MessageSelector.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                  return $view instanceof Closure ? function (array $data = []) use ($view, $resolver) {
                                      return $resolver($view($data));
                                  }
                                  : $resolver($view);
                          Severity: Major
                          Found in src/Illuminate/View/Component.php - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language