luyadev/luya-module-admin

View on GitHub

Showing 331 of 503 total issues

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

      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

        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

              Function controller has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      controller: ['$scope', '$timeout', function ($scope, $timeout) {
              
                          $scope.init = function () {
                              if ($scope.truevalue === undefined || $scope.truevalue === "") {
                                  $scope.truevalue = 1;
              Severity: Minor
              Found in src/resources/js/formdirectives.js - About 1 hr to fix

                Function link has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        link: function (scope, element, attrs) {
                            element.bind("focus", function () {
                                $rootScope.lastElement = element[0];
                                var offCallFn = $rootScope.$on('insertPasteListener', function (e, val) {
                                    var domElement = $rootScope.lastElement;
                Severity: Minor
                Found in src/resources/js/directives.js - About 1 hr to fix

                  Function submitCreate has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          $scope.submitCreate = function(close, redirect) {
                              $http.post($scope.config.apiEndpoint, angular.toJson($scope.data.create, true)).then(function(response) {
                                  AdminToastService.success(i18n['js_ngrest_rm_success']);
                                  $scope.loadList().then(function() {
                                      $scope.applySaveCallback();
                  Severity: Minor
                  Found in src/resources/js/controllers.js - About 1 hr to fix

                    Method registerComponents has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function registerComponents()
                        {
                            return [
                                'adminLanguage' => [
                                    'class' => AdminLanguage::class,
                    Severity: Minor
                    Found in src/Module.php - About 1 hr to fix

                      Function prepareDataProvider has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          protected function prepareDataProvider()
                          {
                              $requestParams = Yii::$app->getRequest()->getBodyParams();
                              if (empty($requestParams)) {
                                  $requestParams = Yii::$app->getRequest()->getQueryParams();
                      Severity: Minor
                      Found in src/ngrest/base/actions/IndexAction.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 i18nAttributeFallbackValue has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function i18nAttributeFallbackValue($attributeName, $preferredLanguage = null)
                          {
                              $value = $this->{$attributeName};
                      
                              if (empty($value) && $this->isI18n($attributeName)) {
                      Severity: Minor
                      Found in src/ngrest/base/NgRestModel.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 actionFileReplace has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionFileReplace()
                          {
                              $fileId = Yii::$app->request->post('fileId', false);
                              $raw = $_FILES['file'] ?? false;
                              /** @var $file \luya\admin\file\Item */
                      Severity: Minor
                      Found in src/apis/StorageController.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 decode has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function decode($value, $onEmptyValue = '')
                          {
                              $languages = Yii::$app->adminLanguage->getLanguages();
                      
                              // if its not already unserialized, decode it
                      Severity: Minor
                      Found in src/helpers/I18n.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 ensureClassName has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function ensureClassName($className)
                          {
                              $className = strtolower($className);
                              foreach ($this->getUseClasses() as $name) {
                                  if (StringHelper::contains(' as ', strtolower($name))) {
                      Severity: Minor
                      Found in src/openapi/phpdoc/PhpDocParser.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 actionCleanup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionCleanup()
                          {
                              $tagIds = Tag::find()->select(['id'])->column();
                      
                              $batch = TagRelation::find()->batch();
                      Severity: Minor
                      Found in src/commands/TagController.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 internalGenerateResponseArrayFromModel has a Cognitive Complexity of 10 (exceeds 5 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

                      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 validateAttribute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function validateAttribute($model, $attribute)
                          {
                              // if skip if unchanged is enabled and active record and the attribute has not changed, skip this validation rule.
                              if ($this->skipIfUnchanged && $model instanceof BaseActiveRecord) {
                                  if (!$model->isAttributeChanged($attribute)) {
                      Severity: Minor
                      Found in src/validators/I18nRequiredValidator.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 controller has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              controller: ['$scope', 'ServiceImagesData', function ($scope, ServiceImagesData) {
                                  $scope.imageSrc = null;
                      
                                  $scope.$watch('imageId', function (n, o) {
                                      if (n != o) {
                      Severity: Minor
                      Found in src/resources/js/directives.js - About 1 hr to fix

                        Function pasteUpload has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                        $scope.pasteUpload = function (e) {
                                            for (var i = 0; i < e.originalEvent.clipboardData.items.length; i++) {
                                                var item = e.originalEvent.clipboardData.items[i];
                                                if (item.kind == 'file') {
                                                    LuyaLoading.start(i18n['js_dir_upload_wait']);
                        Severity: Minor
                        Found in src/resources/js/directives.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language