luyadev/luya-module-admin

View on GitHub

Showing 503 of 503 total issues

Function appendFieldOption has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function appendFieldOption($fieldName, $optionKey, $optionValue)
    {
        foreach ($this->getConfig() as $pointer => $fields) {
            if (is_array($fields)) {
                foreach ($fields as $field) {
Severity: Minor
Found in src/ngrest/Config.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 actionSync has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionSync()
    {
        $this->db = Instance::ensure($this->db, Connection::class);

        if ($this->url === null) {
Severity: Minor
Found in src/commands/ProxyController.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 getProperties has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    public function getProperties($phpDocProperties = true)
    {
        $properties = [];
        $attributeFields = [];

Severity: Minor
Found in src/openapi/specs/ActiveRecordToSchema.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

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

                if ($scope.id === undefined || $scope.id === null || $scope.id === '') {
                    $scope.id = Math.random().toString(36).substring(7);
                }
Severity: Major
Found in src/resources/js/formdirectives.js and 1 other location - About 1 hr to fix
src/resources/js/formdirectives.js on lines 1508..1510

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

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 ($scope.id === undefined || $scope.id === null || $scope.id === '') {
                    $scope.id = Math.random().toString(36).substring(7);
                }
Severity: Major
Found in src/resources/js/formdirectives.js and 1 other location - About 1 hr to fix
src/resources/js/formdirectives.js on lines 1977..1979

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

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 controller has 15 arguments (exceeds 4 allowed). Consider refactoring.
Open

            function ($scope, $http, $filter, $timeout, $q, HtmlStorage, cfpLoadingBar, Upload, ServiceFoldersData, ServiceFilesData, LuyaLoading, AdminToastService, ServiceFoldersDirectoryId, ServiceAdminTags, ServiceQueueWaiting) {
Severity: Major
Found in src/resources/js/directives.js - About 1 hr to fix

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

    zaa.directive('stringToInteger', function () {
        return {
            require: 'ngModel',
            link: function (scope, element, attrs, ngModel) {
                ngModel.$formatters.push(function (value) {
    Severity: Major
    Found in src/resources/js/formdirectives.js and 1 other location - About 1 hr to fix
    src/resources/js/formdirectives.js on lines 697..706

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

    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

    zaa.directive('stringToFloat', function () {
        return {
            require: 'ngModel',
            link: function (scope, element, attrs, ngModel) {
                ngModel.$formatters.push(function (value) {
    Severity: Major
    Found in src/resources/js/formdirectives.js and 1 other location - About 1 hr to fix
    src/resources/js/formdirectives.js on lines 677..686

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

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

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

      Method generateModelContent has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function generateModelContent($fileNamepsace, $className, $apiEndpoint, TableSchema $schema, $i18nFields)
          {
              $alias = Inflector::humanize(Inflector::camel2words($className));
              $dbTableName = $schema->fullName;
      
      
      Severity: Minor
      Found in src/commands/CrudController.php - About 1 hr to fix

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

                controller: ['$scope', '$http', '$timeout', function($scope, $http, $timeout) {
                    // the loaded file to crop
                    $scope.file;
                    // cropper image
                    $scope.cropperImage;
        Severity: Minor
        Found in src/resources/js/directives.js - About 1 hr to fix

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

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

            Function localDateTimestamp has 45 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                      , localDateTimestamp = function localDateTimestamp(rawDate, dateFormatDefinition) {
                        
                        var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|MMMM|MMM|MM|M|dd?d?|yy?yy?y?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g
                        ,formatDate,dateSplit, m, d, y, index, el, longName, shortName;
            
            
            Severity: Minor
            Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

              Function setDaysInMonth has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                        , setDaysInMonth = function setDaysInMonth(month, year) {
              
                          var i
                            , limitDate = new Date(year, month, 0).getDate()
                            , firstDayMonthNumber = new Date(year + '/' + month + '/' + 1).getDay()
              Severity: Minor
              Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

                Method actionServices has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function actionServices()
                    {
                        $settings = [];
                        $apiEndpoint = $this->model->ngRestApiEndpoint();
                        $userSortSettings = Yii::$app->adminuser->identity->setting->get('ngrestorder.admin/'.$apiEndpoint, false);
                Severity: Minor
                Found in src/ngrest/base/Api.php - About 1 hr to fix

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

                      public function save()
                      {
                          // get the filter model based on the current filter.
                          $filterModel = $this->findModel();
                          // update the name of the filter if changed
                  Severity: Minor
                  Found in src/base/Filter.php - About 1 hr to fix

                    Method ngRestConfigDefine has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function ngRestConfigDefine(ConfigBuilder $config, $assignedType, array $fields)
                        {
                            $types = $this->ngRestAttributeTypes();
                            $extraTypes = $this->ngRestExtraAttributeTypes();
                    
                    
                    Severity: Minor
                    Found in src/ngrest/base/NgRestModel.php - About 1 hr to fix

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

                          public function getCreateThumbnail()
                          {
                              if (!$this->isImage) {
                                  return false;
                              }
                      Severity: Major
                      Found in src/models/StorageFile.php and 1 other location - About 1 hr to fix
                      src/models/StorageFile.php on lines 307..327

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

                      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 function getCreateThumbnailMedium()
                          {
                              if (!$this->isImage) {
                                  return false;
                              }
                      Severity: Major
                      Found in src/models/StorageFile.php and 1 other location - About 1 hr to fix
                      src/models/StorageFile.php on lines 277..297

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

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

                          public function actionExport()
                          {
                              $extension = null;
                              $mime = null;
                              $header = Yii::$app->request->getBodyParam('header', 1);
                      Severity: Minor
                      Found in src/ngrest/base/Api.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

                      Severity
                      Category
                      Status
                      Source
                      Language