luyadev/luya

View on GitHub

Showing 90 of 90 total issues

Avoid too many return statements within this method.
Open

            return $model->addError($attribute, Yii::t('luya', '{attribute} must include at least one uppercase letter.', ['attribute' => $model->getAttributeLabel($attribute)]));
Severity: Major
Found in core/validators/StrengthValidator.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $model->addError($attribute, Yii::t('luya', '{attribute} must include at least one lowercase letter.', ['attribute' => $model->getAttributeLabel($attribute)]));
    Severity: Major
    Found in core/validators/StrengthValidator.php - About 30 mins to fix

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

          public function getRequestRoute()
          {
              if ($this->_requestRoute !== null) {
                  return $this->_requestRoute;
              }
      Severity: Minor
      Found in core/base/ModuleReflection.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 resolveRoute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function resolveRoute($route)
          {
              $routeParts = explode('/', $route);
              foreach ($routeParts as $k => $v) {
                  if (($k == 0 && $v == $this->id) || (empty($v))) {
      Severity: Minor
      Found in core/base/Module.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 startModules has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function startModules($app)
          {
              foreach ($this->getModules() as $id => $module) {
                  // set an alias for all user modules
                  Yii::setAlias('@'.$id, $module->getBasePath());
      Severity: Minor
      Found in core/base/BaseBootstrap.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 getMailer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getMailer()
          {
              if ($this->_mailer === null) {
                  $this->_mailer = new PHPMailer();
                  $this->_mailer->CharSet = 'UTF-8';
      Severity: Minor
      Found in core/components/Mail.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 behaviors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function behaviors()
          {
              $behaviors = parent::behaviors();
      
              if ($this->enableCors) {
      Severity: Minor
      Found in core/traits/RestBehaviorsTrait.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 callMethodSanitizeArguments has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function callMethodSanitizeArguments($object, $method, array $argumentsList = [])
          {
              // get class reflection object
              $reflection = new ReflectionMethod($object, $method);
              // array where the sanitized arguemnts will be stored
      Severity: Minor
      Found in core/helpers/ObjectHelper.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 applicationConsole has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          public function applicationConsole()
          {
              $this->setIsCli(true);
              $config = $this->getConfigArray();
              $config['defaultRoute'] = 'help';
      Severity: Minor
      Found in core/base/Boot.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 removeEmptyValues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          private function removeEmptyValues(array $haystack)
          {
              foreach ($haystack as $key => $value) {
                  if (is_array($value)) {
                      $haystack[$key] = $this->removeEmptyValues($value);
      Severity: Minor
      Found in core/web/jsonld/BaseThing.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