luyadev/luya-module-admin

View on GitHub

Showing 503 of 503 total issues

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

    public function run()
    {
        $this->refresh('thumbnail', [
            'name' => 'Thumbnail',
            'imagine_name' => 'thumbnail',
Severity: Minor
Found in src/importers/FilterImporter.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 getParameters has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    public function getParameters(): array
    {
        $params = [];
        if ($this->getReflection() instanceof ReflectionMethod) {
            foreach ($this->getReflection()->getParameters() as $arg) {
Severity: Minor
Found in src/openapi/specs/BaseSpecs.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 template has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        template: function () {
            return '' +
                '<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}">' +
                '<div class="form-side form-side-label">' +
                '<label>{{label}}</label>' +
Severity: Minor
Found in src/resources/js/formdirectives.js - About 1 hr to fix

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

        protected function getAngularControllerConfig()
        {
            return [
                'apiListQueryString' => $this->context->apiQueryString('list'),
                'apiUpdateQueryString' => $this->context->apiQueryString('update'),
    Severity: Minor
    Found in src/ngrest/render/RenderCrudView.php - About 1 hr to fix

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

          public function actionRelationCall($arrayIndex, $id, $modelClass, $query = null)
          {
              $modelClass = base64_decode($modelClass);
      
              if (!class_exists($modelClass)) {
      Severity: Minor
      Found in src/ngrest/base/Api.php - About 1 hr to fix

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

            public function onListFind($event)
            {
                // async list ignores the onListFind event
                if ($this->asyncList) {
                    return;
        Severity: Minor
        Found in src/ngrest/plugins/SelectRelationActiveQuery.php - About 1 hr to fix

          Function template has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  template: function () {
                      return '' +
                          '<div class="form-group form-side-by-side zaa-datetime" ng-class="{\'input--hide-label\': i18n, \'input--with-time\': model!=null && date!=null}">' +
                          '<div class="form-side form-side-label">' +
                          '<label>{{label}}</label>' +
          Severity: Minor
          Found in src/resources/js/formdirectives.js - About 1 hr to fix

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

                protected function startFiles()
                {
                    $fileCount = 0;
                    // sync files
                    foreach ((new Query())->where(['is_deleted' => false])->all() as $file) {
            Severity: Minor
            Found in src/proxy/ClientTransfer.php - About 1 hr to fix

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

                          if (Yii::$app->security->validatePassword($backupCode, $user->login_2fa_backup_key)) {
                              $autologin = Yii::$app->session->get('autologin', false);
              
                              if (!$autologin) {
                                  // auto login is disabled, disable the function
              Severity: Major
              Found in src/controllers/LoginController.php and 1 other location - About 1 hr to fix
              src/controllers/LoginController.php on lines 329..343

              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 105.

              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

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

                          if ($twoFa->verifyCode($user->login_2fa_secret, $verify)) {
                              $autologin = Yii::$app->session->get('autologin', false);
              
                              if (!$autologin) {
                                  // auto login is disabled, disable the function
              Severity: Major
              Found in src/controllers/LoginController.php and 1 other location - About 1 hr to fix
              src/controllers/LoginController.php on lines 310..324

              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 105.

              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 success has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          success: function (response) {
                              $('.login-btn[type="submit"]').attr('disabled', false);
                              $('.login-spinner').hide();
                              $('.login-btn-label').show();
                              var refresh = response['refresh'];
              Severity: Minor
              Found in src/resources/js/login.js - About 1 hr to fix

                Function onTyping has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            thisInput.on('keyup blur', function onTyping() {
                
                              if (thisInput[0].value &&
                                thisInput[0].value.length &&
                                thisInput[0].value.length > 0) {
                Severity: Minor
                Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

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

                      protected function generateClassName($tableName, $useSchemaName = null)
                      {
                          if (isset($this->classNames[$tableName])) {
                              return $this->classNames[$tableName];
                          }
                  Severity: Minor
                  Found in src/base/BaseCrudController.php - About 1 hr to fix

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

                        public function actionPasswordReset($token, $id)
                        {
                            if (!$this->module->resetPassword) {
                                throw new ForbiddenHttpException();
                            }
                    Severity: Minor
                    Found in src/controllers/LoginController.php - About 1 hr to fix

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

                                  if ($scope.api.indexOf('?') > -1) {
                                      var url = $scope.api + '&inline=1';
                                  } else {
                                      var url = $scope.api + '?inline=1';
                                  }
                      Severity: Major
                      Found in src/resources/js/directives.js and 1 other location - About 1 hr to fix
                      src/resources/js/directives.js on lines 732..736

                      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 59.

                      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

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

                          private function internalGenerateResponseArrayFromModel($modelClassName, $isArray = false)
                          {
                              $object = $this->createObjectFromClassName($modelClassName);
                      
                              $schema = false;
                      Severity: Minor
                      Found in src/openapi/specs/BaseSpecs.php - About 1 hr to fix

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

                                            if ($scope.api.indexOf('?') > -1) {
                                                var url = $scope.api + '&inline=1';
                                            } else {
                                                var url = $scope.api + '?inline=1';
                                            }
                        Severity: Major
                        Found in src/resources/js/directives.js and 1 other location - About 1 hr to fix
                        src/resources/js/directives.js on lines 794..798

                        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 59.

                        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 uploadUsingUpload has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                        $scope.uploadUsingUpload = function (file) {
                                            file.upload = Upload.upload({
                                                url: 'admin/api-admin-storage/files-upload',
                                                fields: { 'folderId': $scope.currentFolderId },
                                                file: file
                        Severity: Minor
                        Found in src/resources/js/directives.js - About 1 hr to fix

                          Method actionSession has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function actionSession()
                              {
                                  $user = Yii::$app->adminuser->identity;
                          
                                  $qrcode = null;
                          Severity: Minor
                          Found in src/apis/UserController.php - About 1 hr to fix

                            Method actionCleanupImageTable has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function actionCleanupImageTable()
                                {
                                    $rows = Yii::$app->db->createCommand('SELECT file_id, filter_id, COUNT(*) as count FROM {{%admin_storage_image}} GROUP BY file_id, filter_id HAVING COUNT(*) > 1')->queryAll();
                            
                                    if (empty($rows)) {
                            Severity: Minor
                            Found in src/commands/StorageController.php - About 1 hr to fix
                              Severity
                              Category
                              Status
                              Source
                              Language