pulsarvp/vps-tools

View on GitHub

Showing 201 of 201 total issues

Method beforeAction has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function beforeAction ($action)
        {
            $user = $this->user;

            $request = Yii::$app->getRequest();
Severity: Minor
Found in src/modules/user/filters/AccessControl.php - About 1 hr to fix

    Method execute has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            public function execute ($queue)
            {
                if (Yii::$app->settings->get('log_ssl_use'))
                {
                    $context = stream_context_create(
    Severity: Minor
    Found in src/modules/log/jobs/LogJob.php - About 1 hr to fix

      Method actionImage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              public function actionImage ()
              {
      
                  $datapath = Yii::$app->settings->get('datapath');
                  $name = StringHelper::random();
      Severity: Minor
      Found in src/modules/page/controllers/PageController.php - About 1 hr to fix

        Method actionIndex has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                public function actionIndex ()
                {
                    $query = Export::find();
        
                    $provider = new ActiveDataProvider([
        Severity: Minor
        Found in src/modules/export/controllers/ExportController.php - About 1 hr to fix

          Method printTable has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  public static function printTable ($data, $headers = [])
                  {
                      // Count max length for every column.
                      $lengths = [];
          
          
          Severity: Minor
          Found in src/helpers/Console.php - About 1 hr to fix

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

                    public function run ()
                    {
                        $query = Page::find();
            
                        $provider = new ActiveDataProvider([
            Severity: Minor
            Found in src/modules/page/widgets/PageWidget.php - About 1 hr to fix

              Method printActions has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      private function printActions ($controllerlist)
                      {
                          asort($controllerlist);
                          foreach ($controllerlist as $controller)
                          {
              Severity: Minor
              Found in src/controllers/ConfigController.php - About 1 hr to fix

                Method offsets has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        public function offsets ($message)
                        {
                            try
                            {
                                if (isset($message[ 'topic' ]))
                Severity: Minor
                Found in src/components/KafkaRest.php - About 1 hr to fix

                  Method export has 32 lines of code (exceeds 25 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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            public static function listFiles ($path, $absolute = false)
                            {
                                if (is_dir($path) and is_readable($path))
                                {
                                    $data = [];
                    Severity: Major
                    Found in src/helpers/FileHelper.php and 1 other location - About 1 hr to fix
                    src/helpers/FileHelper.php on lines 357..373

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 106.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                            public static function listDirs ($path, $absolute = false)
                            {
                                if (is_dir($path) and is_readable($path))
                                {
                                    $data = [];
                    Severity: Major
                    Found in src/helpers/FileHelper.php and 1 other location - About 1 hr to fix
                    src/helpers/FileHelper.php on lines 399..415

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 106.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Function save has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public function save ($name = null)
                            {
                                if ($name == null)
                                    $name = StringHelper::random();
                    
                    
                    Severity: Minor
                    Found in src/net/Flow.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 clearDir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public static function clearDir ($path)
                            {
                                if (is_dir($path) and is_writable($path) and ( $dir = opendir($path) ) !== false)
                                {
                                    while ($f = readdir($dir))
                    Severity: Minor
                    Found in src/helpers/FileHelper.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 beforeAction has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                            public function beforeAction ($action)
                            {
                                $user = $this->user;
                    
                                $request = Yii::$app->getRequest();
                    Severity: Minor
                    Found in src/modules/user/filters/AccessControl.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 getInfo has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            private function getInfo ($name)
                            {
                    
                                if (RemoteFileHelper::exists(BASE_PATH . '/../' . $name))
                                {
                    Severity: Minor
                    Found in src/controllers/ConfigController.php - About 1 hr to fix

                      Method safeUp has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              public function safeUp ()
                              {
                                  $settingModel = 'setting';
                                  if (Yii::$app->has('settings') and Yii::$app->settings->hasMethod('getTableName'))
                                      $settingModel = Yii::$app->settings->getTableName();
                      Severity: Minor
                      Found in src/modules/log/migrations/m190723_131552_elk.php - About 1 hr to fix

                        Method select has 30 lines of code (exceeds 25 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

                          Method safeUp has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  public function safeUp ()
                                  {
                          
                                      $this->createTable('export', [
                                          'id'          => $this->primaryKey(),
                          Severity: Minor
                          Found in src/modules/export/migrations/m180101_000001_export_query.php - About 1 hr to fix

                            Method save has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    public function save ()
                                    {
                                        $auth = Yii::$app->getAuthManager();
                                        $role = $auth->createRole($this->name);
                                        $role->type = Role::TYPE_ROLE;
                            Severity: Minor
                            Found in src/modules/user/forms/RoleForm.php - About 1 hr to fix

                              Method savePage has 30 lines of code (exceeds 25 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 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language