abhi1693/yii2-user

View on GitHub

Showing 6 of 14 total issues

Method actionAuthClient has 98 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function actionAuthClient()
    {
        $model = new SettingsForm();
        $model->googleClientId = Yii::$app->config->get(Enum::GOOGLE_CLIENT_ID);
        $model->googleClientSecret = Yii::$app->config->get(Enum::GOOGLE_CLIENT_SECRET);
Severity: Major
Found in controllers/SettingsController.php - About 3 hrs to fix

Function actionAuthClient has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionAuthClient()
    {
        $model = new SettingsForm();
        $model->googleClientId = Yii::$app->config->get(Enum::GOOGLE_CLIENT_ID);
        $model->googleClientSecret = Yii::$app->config->get(Enum::GOOGLE_CLIENT_SECRET);
Severity: Minor
Found in controllers/SettingsController.php - About 2 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

User has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class User extends ActiveRecord
{
    /** User Status - Blocked/Inactive */
    const STATUS_BLOCKED = 0;
    /** User Status - Active */
Severity: Minor
Found in models/User.php - About 2 hrs to fix

Function actionBlock has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionBlock($id)
    {
        if ($id == Yii::$app->user->getId()) {
            Yii::$app->getSession()->setFlash('error', Yii::t('user', 'You can not block your own account'));
        } else {
Severity: Minor
Found in controllers/AdminController.php - About 55 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 actionUploadAvatar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        public function actionUploadAvatar()
        {
            if (isset($_FILES['avatar'])) {
                $avatar = $_FILES['avatar'];
                $path = '../vendor/abhi1693/yii2-user/uploads/profile_image/';
Severity: Minor
Found in controllers/AccountController.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 actionReset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionReset($id, $code)
    {
        $model = User::findOne([
            'id'                   => $id,
            'password_reset_token' => $code,
Severity: Minor
Found in controllers/RecoveryController.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

Severity
Category
Status
Source
Language