pulsarvp/vps-tools

View on GitHub

Showing 156 of 201 total issues

Function add has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

        private static function add ($message, $type, $isRaw, $category = 'admin')
        {
            if (Yii::$app->settings->get('log_use'))
            {
                if (Yii::$app->settings->get('log_clean_mb4_chars')) {
Severity: Minor
Found in src/modules/log/components/LogManager.php - About 6 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

Function sendMessage has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
Open

        public function sendMessage ($data)
        {
            if (Yii::$app->settings->get('kafka_use'))
            {

Severity: Minor
Found in src/components/Kafka.php - About 4 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

Function getInfo has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

        private function getInfo ($name)
        {

            if (RemoteFileHelper::exists(BASE_PATH . '/../' . $name))
            {
Severity: Minor
Found in src/controllers/ConfigController.php - About 4 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

Function successAuth has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

        public function successAuth ($client)
        {
            if (method_exists($client, 'successAuth'))
            {
                $user = $client->successAuth();
Severity: Minor
Found in src/modules/user/controllers/UserController.php - About 4 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

Function printActions has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

        private function printActions ($controllerlist)
        {
            asort($controllerlist);
            foreach ($controllerlist as $controller)
            {
Severity: Minor
Found in src/controllers/ConfigController.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 actionIndex has 87 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function actionIndex ()
        {
            $get = Yii::$app->request->get();

            $query = Log::find();
Severity: Major
Found in src/modules/log/controllers/LogController.php - About 3 hrs to fix

    Function checkEngine has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

            public function checkEngine (string $name = 'InnoDB', bool $default = true, bool $exception = true)
            {
                $engines = $this->db->createCommand("SHOW ENGINES")->queryAll();
                foreach ($engines as $engine)
                {
    Severity: Minor
    Found in src/db/Migration.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

    File UserController.php has 302 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
        namespace vps\tools\modules\user\controllers;
    
        use app\base\Controller;
    Severity: Minor
    Found in src/modules/user/controllers/UserController.php - About 3 hrs to fix

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

              private function savePage ($model)
              {
                  $r = Yii::$app->request;
                  if ($r->isPost and $model->load($r->post()))
                  {
      Severity: Minor
      Found in src/modules/page/controllers/PageController.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 run has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function run ()
              {
                  $userClass = Yii::$app->getModule('users')->modelUser;
      
                  $query = $userClass::find()->select("user.*,(SELECT GROUP_CONCAT(item_name) from `auth_assignment` where `user`.`id`=`auth_assignment`.`user_id`) as rolesNames")->leftJoin('auth_assignment', '`auth_assignment`.`user_id` = `user`.`id`');
      Severity: Major
      Found in src/modules/user/widgets/RbacWidget.php - About 2 hrs to fix

        File FileHelper.php has 281 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
            namespace vps\tools\helpers;
        
            use yii\base\UnknownMethodException;
        Severity: Minor
        Found in src/helpers/FileHelper.php - About 2 hrs to fix

          Method up has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function up ()
                  {
                      $this->createTable('auth_rule', [
                          'name'       => $this->string(64)->notNull(),
                          'data'       => $this->text()->null(),
          Severity: Major
          Found in src/modules/user/migrations/m010203_400005_init_rbac.php - About 2 hrs to fix

            Method actionGenerateXls has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    public function actionGenerateXls ($id)
                    {
                        $export = Export::find()->where([ 'id' => $id ])->one();
                        if ($export === null)
                        {
            Severity: Major
            Found in src/modules/export/controllers/ExportController.php - About 2 hrs to fix

              Method actionView has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      public function actionView ($id)
                      {
                          $this->_tpl = '@userViews/index';
                          $userClass = $this->module->modelUser;
                          $user = $userClass::findOne($id);
              Severity: Major
              Found in src/modules/user/controllers/UserController.php - About 2 hrs to fix

                Method sendMessage has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function sendMessage ($data)
                        {
                            if (Yii::$app->settings->get('kafka_use'))
                            {
                
                
                Severity: Major
                Found in src/components/Kafka.php - About 2 hrs to fix

                  Method bootstrap has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public function bootstrap ($app)
                          {
                              $app->setAliases([ '@userViews' => __DIR__ . '/views/user' ]);
                              $app->setAliases([ '@rbacViews' => __DIR__ . '/views/rbac' ]);
                              $app->getUrlManager()->addRules([
                  Severity: Major
                  Found in src/modules/user/Module.php - About 2 hrs to fix

                    Method successAuth has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public function successAuth ($client)
                            {
                                if (method_exists($client, 'successAuth'))
                                {
                                    $user = $client->successAuth();
                    Severity: Major
                    Found in src/modules/user/controllers/UserController.php - About 2 hrs to fix

                      Method add has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              private static function add ($message, $type, $isRaw, $category = 'admin')
                              {
                                  if (Yii::$app->settings->get('log_use'))
                                  {
                                      if (Yii::$app->settings->get('log_clean_mb4_chars')) {
                      Severity: Major
                      Found in src/modules/log/components/LogManager.php - About 2 hrs to fix

                        Function hasPermission has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                        Open

                                public function hasPermission ($permission = null, $and = false)
                                {
                                    if (Yii::$app->user->can(User::R_ADMIN))
                                        return true;
                        
                        
                        Severity: Minor
                        Found in src/modules/user/models/User.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

                        File ExportController.php has 262 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        
                            /**
                             * @author    Evgenii Kuteiko <kuteiko@mail.ru>
                             * @author    Anna Manaenkova <anna.manaenkova@phystech.edu>
                        Severity: Minor
                        Found in src/modules/export/controllers/ExportController.php - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language