nordsoftware/yii2-account

View on GitHub

Showing 12 of 21 total issues

DataContract has 31 functions (exceeds 20 allowed). Consider refactoring.
Open

class DataContract extends Component implements DataContractInterface
{
    /**
     * @var array map over model statuses to use by this contract.
     */
Severity: Minor
Found in src/components/datacontract/DataContract.php - About 3 hrs to fix

    File Module.php has 315 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /*
     * This file is part of Account.
     *
     * (c) 2014 Nord Software
    Severity: Minor
    Found in src/Module.php - About 3 hrs to fix

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

          public function validateAttribute($object, $attribute)
          {
              $password = $object->$attribute;
              $length = mb_strlen($password);
              if ($this->minLength && $length < $this->minLength) {
      Severity: Minor
      Found in src/validators/PasswordStrengthValidator.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

      Method validateAttribute has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function validateAttribute($object, $attribute)
          {
              $password = $object->$attribute;
              $length = mb_strlen($password);
              if ($this->minLength && $length < $this->minLength) {
      Severity: Major
      Found in src/validators/PasswordStrengthValidator.php - About 2 hrs to fix

        Method initUrlConfig has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function initUrlConfig()
            {
                if (!isset($this->urlConfig['prefix'])) {
                    $this->urlConfig['prefix'] = self::URL_PREFIX;
                }
        Severity: Minor
        Found in src/Module.php - About 1 hr to fix

          Function signup has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              public function signup()
              {
                  if ($this->validate()) {
                      $dataContract = Module::getInstance()->getDataContract();
                      $account = $dataContract->createAccount(['attributes' => $this->attributes]);
          Severity: Minor
          Found in src/models/SignupForm.php - About 45 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 actionConnect has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              public function actionConnect($providerId)
              {
                  $dataContract = $this->module->getDataContract();
                  $provider = $dataContract->findProvider($providerId);
          
          
          Severity: Minor
          Found in src/controllers/SignupController.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 false;
          Severity: Major
          Found in src/validators/PasswordStrengthValidator.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                    return true;
            Severity: Major
            Found in src/validators/PasswordStrengthValidator.php - About 30 mins to fix

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

                  public function clientLink($client, $text = null, array $htmlOptions = [])
                  {
                      if ($text === null) {
                          $text = $client->getTitle();
                      }
              Severity: Minor
              Found in src/widgets/AuthChoice.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 actionIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionIndex()
                  {
                      $scenario = $this->module->enableCaptcha ? 'captcha' : 'default';
                      $dataContract = $this->module->getDataContract();
              
              
              Severity: Minor
              Found in src/controllers/SignupController.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 actionLogin has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionLogin()
                  {
                      $dataContract = $this->module->getDataContract();
              
                      /** @var LoginForm $model */
              Severity: Minor
              Found in src/controllers/AuthController.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