pulsarvp/vps-tools

View on GitHub

Showing 201 of 201 total issues

Method read has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function read ()
        {
            try
            {
                $ch = curl_init();
Severity: Minor
Found in src/components/KafkaRest.php - About 1 hr to fix

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

            public function sendMessage ($data)
            {
                if ($this->use)
                {
                    try
    Severity: Minor
    Found in src/components/KafkaRest.php - About 1 hr to fix

      Function beforeSave has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              public function beforeSave ($insert)
              {
                  if ($parent = parent::beforeSave($insert))
                  {
                      if ($this->isNewRecord)
      Severity: Minor
      Found in src/base/BaseModel.php - About 1 hr 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 actionLogout has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              public function actionLogout ()
              {
                  if (Yii::$app->session->get('isTempUser'))
                  {
                      $originalUserId = Yii::$app->session->get('originalUserID');
      Severity: Minor
      Found in src/modules/user/controllers/UserController.php - About 1 hr 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 size has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              public static function size ($size, $unit = '')
              {
                  if (is_numeric($size) and $size >= 0)
                  {
                      if (( !$unit && $size >= 1 << 30 ) || $unit == 'GB')
      Severity: Minor
      Found in src/helpers/HumanHelper.php - About 1 hr 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 select has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              public function select ($models, $listOptions, $options = [])
              {
                  $value = isset($listOptions[ 'value' ]) ? $listOptions[ 'value' ] : 'id';
                  $label = isset($listOptions[ 'label' ]) ? $listOptions[ 'label' ] : false;
                  $content = isset($listOptions[ 'data-content' ]) ? $listOptions[ 'data-content' ] : false;
      Severity: Minor
      Found in src/html/Field.php - About 1 hr 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 getStatus has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

              public function getStatus ()
              {
                  if (!$this->_status)
                  {
                      $this->_status = self::S_UNKNOWN;
      Severity: Minor
      Found in src/net/CurlResponse.php - About 1 hr 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 initConsumer has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function initConsumer ()
              {
                  try
                  {
                      $records[ 'name' ] = $this->source;
      Severity: Minor
      Found in src/components/KafkaRest.php - About 1 hr to fix

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

                public function up ()
                {
        
                    $banner_use = '1';
                    $banner_api_url = 'http://revive/api/v2/xmlrpc/';
        Severity: Minor
        Found in src/migrations/api/m010101_111411_revive_settings.php - About 1 hr to fix

          Method run has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public function run ()
                  {
          
                      $fields = [ 'id', 'pid', 'channel', 'ttr', 'delay', 'priority', 'pushed_at', 'reserved_at', 'done_at', 'canceled_at' ];
                      $sort = Yii::$app->request->get('sort');
          Severity: Minor
          Found in src/modules/queue/widgets/QueueWidget.php - About 1 hr to fix

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

                    public function bootstrap ($app)
                    {
                        $app->setAliases([ '@pageViews' => __DIR__ . '/views' ]);
                        $app->setAliases([ '@vpsViews' => __DIR__ . '/../../views' ]);
                        $app->getUrlManager()->addRules([
            Severity: Minor
            Found in src/modules/page/Module.php - About 1 hr to fix

              Method checkEngine has 36 lines of code (exceeds 25 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 1 hr to fix

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

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

                  Method actionLogout has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          public function actionLogout ()
                          {
                              if (Yii::$app->session->get('isTempUser'))
                              {
                                  $originalUserId = Yii::$app->session->get('originalUserID');
                  Severity: Minor
                  Found in src/modules/user/controllers/UserController.php - About 1 hr to fix

                    Method actionAdd has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            public function actionAdd ()
                            {
                    
                                $menu = new Menu();
                                $this->_tpl = '@menuViews/add';
                    Severity: Minor
                    Found in src/modules/menu/controllers/MenuController.php - About 1 hr to fix

                      Function up has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function up ()
                              {
                                  $this->createTable('auth_rule', [
                                      'name'       => $this->string(64)->notNull(),
                                      'data'       => $this->text()->null(),
                      Severity: Minor
                      Found in src/modules/user/migrations/m010203_400005_init_rbac.php - About 1 hr 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 validatePath has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function validatePath ($attribute)
                              {
                                  if (!$this->hasErrors())
                                  {
                                      if (!file_exists($this->$attribute))
                      Severity: Minor
                      Found in src/modules/setting/models/Setting.php - About 1 hr 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 export has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                              public function export ()
                              {
                                  if ($this->_use)
                                      foreach ($this->messages as $message)
                                      {
                      Severity: Minor
                      Found in src/log/SentryTarget.php - About 1 hr 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 image has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public function image ($path = null, $options = [])
                              {
                                  /** @var boolean $fileLoaded - файл уже загружен */
                                  $fileLoaded = ArrayHelper::remove($options, 'fileLoaded', false);
                                  /** @var text $removeText - текст для кнопки "Remove" */
                      Severity: Minor
                      Found in src/html/Field.php - About 1 hr to fix

                        Method export has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                public function export ()
                                {
                        
                                    $socket = stream_socket_client($this->_dsn, $errorNumber, $error, 30);
                        
                        
                        Severity: Minor
                        Found in src/log/LogstashTarget.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language