luyadev/luya-module-admin

View on GitHub

Showing 503 of 503 total issues

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

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

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

                Method ngRestActiveWindows has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function ngRestActiveWindows()
                    {
                        return [
                            [
                                'class' => DetailViewActiveWindow::class,
                Severity: Minor
                Found in src/models/NgrestLog.php - About 1 hr to fix

                  Method extractFilesDataFromFilesArray has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public static function extractFilesDataFromFilesArray(array $file)
                      {
                          if (!isset($file['tmp_name'])) {
                              return [];
                          }
                  Severity: Minor
                  Found in src/helpers/Storage.php - About 1 hr to fix

                    Method callbackPie has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function callbackPie()
                        {
                            return [
                            'tooltip' => ['trigger' => 'item', 'formatter' => '{c} {b}'],
                            'legend' => ['orient' => 'vertical', 'x' => 'left', 'data' => [Module::t('aw_userhistorysummary_contribcount_inserts'), Module::t('aw_userhistorysummary_contribcount_updates')]],
                    Severity: Minor
                    Found in src/aws/UserHistorySummaryActiveWindow.php - About 1 hr to fix

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

                              controller: ['$scope', '$http', function ($scope, $http) {
                                  $scope.tags = [];
                      
                                  $http.get('admin/api-admin-common/tags').then(function (response) {
                                      angular.forEach(response.data, function (value) {
                      Severity: Minor
                      Found in src/resources/js/formdirectives.js - About 1 hr to fix

                        Method startImages has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function startImages()
                            {
                                $imageCount = 0;
                                // sync images
                                foreach ((new \luya\admin\image\Query())->all() as $image) {
                        Severity: Minor
                        Found in src/proxy/ClientTransfer.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language