luyadev/luya-module-admin

View on GitHub

Showing 503 of 503 total issues

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

                    } else if (percentage >= 65) {
                        scope.removeClass(scope.dndCss.onHoverTop);
                        scope.removeClass(scope.dndCss.onHoverMiddle);
                        scope.addClass(scope.dndCss.onHoverBottom);
                        dndFactory.setPos('bottom');
Severity: Major
Found in src/resources/js/dnd.js and 1 other location - About 5 hrs to fix
src/resources/js/dnd.js on lines 184..194

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

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

                    if (percentage <= 50) {
                        scope.addClass(scope.dndCss.onHoverTop);
                        scope.removeClass(scope.dndCss.onHoverMiddle);
                        scope.removeClass(scope.dndCss.onHoverBottom);
                        dndFactory.setPos('top');
Severity: Major
Found in src/resources/js/dnd.js and 1 other location - About 5 hrs to fix
src/resources/js/dnd.js on lines 201..211

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

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

var observeLogin = function (form, url, secureUrl, twoFaUrl) {

    $(form).submit(function (e) {
        $('#errorsContainer').hide();
        $('.login-btn[type="submit"]').attr('disabled', true);
Severity: Major
Found in src/resources/js/login.js - About 5 hrs to fix

    RenderCrud has 41 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RenderCrud extends Render implements ViewContextInterface, RenderCrudInterface
    {
        public const TYPE_LIST = 'list';
    
        public const TYPE_CREATE = 'create';
    Severity: Minor
    Found in src/ngrest/render/RenderCrud.php - About 5 hrs to fix

      User has 41 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class User extends NgRestModel implements IdentityInterface, ChangePasswordInterface
      {
          use SoftDeleteTrait;
          public const USER_SETTING_ISDEVELOPER = 'isDeveloper';
      
      
      Severity: Minor
      Found in src/models/User.php - About 5 hrs to fix

        File services.js has 394 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // service resolver
        adminServiceResolver = ['ServiceFoldersData', 'ServiceFiltersData', 'ServiceLanguagesData', 'ServicePropertiesData', 'AdminLangService', 'ServiceFoldersDirectoryId', function(ServiceFoldersData, ServiceFiltersData, ServiceLanguagesData, ServicePropertiesData, AdminLangService, ServiceFoldersDirectoryId) {
            ServiceFiltersData.load();
            ServiceFoldersData.load();
            ServiceLanguagesData.load();
        Severity: Minor
        Found in src/resources/js/services.js - About 5 hrs to fix

          BaseFileSystemStorage has 40 functions (exceeds 20 allowed). Consider refactoring.
          Open

          abstract class BaseFileSystemStorage extends Component
          {
              use CacheableTrait;
          
              /**
          Severity: Minor
          Found in src/storage/BaseFileSystemStorage.php - About 5 hrs to fix

            Plugin has 39 functions (exceeds 20 allowed). Consider refactoring.
            Open

            abstract class Plugin extends Component implements TypesInterface
            {
                public const CREATE_CONTEXT_PREFIX = 'create.';
            
                public const UPDATE_CONTEXT_RPEFXI = 'update.';
            Severity: Minor
            Found in src/ngrest/base/Plugin.php - About 5 hrs to fix

              Function generateRules has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function generateRules($table)
                  {
                      $types = [];
                      $lengths = [];
                      foreach ($table->columns as $column) {
              Severity: Minor
              Found in src/base/BaseCrudController.php - About 5 hrs 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 link has 119 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      link: function(scope, element, attrs) {
                          // In standard-compliant browsers we use a custom mime type and also encode the dnd-type in it.
                          // However, IE and Edge only support a limited number of mime types. The workarounds are described
                          // in https://github.com/marceljuenemann/angular-drag-and-drop-lists/wiki/Data-Transfer-Design
                          var MIME_TYPE = 'application/x-dnd';
              Severity: Major
              Found in src/resources/js/dnd.js - About 4 hrs to fix

                File Config.php has 363 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace luya\admin\ngrest;
                
                use luya\admin\Module;
                Severity: Minor
                Found in src/ngrest/Config.php - About 4 hrs to fix

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

                  <?php
                  
                  namespace luya\admin\ngrest\plugins;
                  
                  use luya\admin\ngrest\base\Plugin;
                  Severity: Major
                  Found in src/ngrest/plugins/Datetime.php and 1 other location - About 4 hrs to fix
                  src/ngrest/plugins/Date.php on lines 1..65

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

                  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

                  <?php
                  
                  namespace luya\admin\ngrest\plugins;
                  
                  use luya\admin\ngrest\base\Plugin;
                  Severity: Major
                  Found in src/ngrest/plugins/Date.php and 1 other location - About 4 hrs to fix
                  src/ngrest/plugins/Datetime.php on lines 1..65

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

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

                          link: function (scope, element, attr) {
                              var defaultPosition = 'right';
                  
                              var lastValue = null;
                  
                  
                  Severity: Major
                  Found in src/resources/js/directives.js - About 4 hrs to fix

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

                                        $state.go('default.route', { moduleRouteId : res[0], controllerId : res[1], actionId : res[2]}).then(function() {
                                            if (itemConfig.stateProvider) {
                                                var params = {};
                                                angular.forEach(itemConfig.stateProvider.params, function(value, key) {
                                                    params[key] = itemData[value];
                    Severity: Major
                    Found in src/resources/js/controllers.js and 1 other location - About 4 hrs to fix
                    src/resources/js/controllers.js on lines 1245..1258

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

                    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

                                    $scope.click(itemConfig.menuItem, true).then(function() {
                                        if (itemConfig.stateProvider) {
                                            var params = {};
                                            angular.forEach(itemConfig.stateProvider.params, function(value, key) {
                                                params[key] = itemData[value];
                    Severity: Major
                    Found in src/resources/js/controllers.js and 1 other location - About 4 hrs to fix
                    src/resources/js/controllers.js on lines 1263..1275

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

                    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

                    File User.php has 352 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace luya\admin\models;
                    
                    use luya\admin\aws\ApiRequestInsightActiveWindow;
                    Severity: Minor
                    Found in src/models/User.php - About 4 hrs to fix

                      Function ngRestConfigDefine has a Cognitive Complexity of 30 (exceeds 5 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 4 hrs 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

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

                                  $scope.moveRight = function (index) {
                                      index = parseInt(index);
                                      for (var i in $scope.model) {
                                          var oldValue = $scope.model[i][index];
                                          $scope.model[i][index] = $scope.model[i][index + 1];
                      Severity: Major
                      Found in src/resources/js/formdirectives.js and 1 other location - About 4 hrs to fix
                      src/resources/js/formdirectives.js on lines 2483..2490

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

                      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

                                  $scope.moveLeft = function (index) {
                                      index = parseInt(index);
                                      for (var i in $scope.model) {
                                          var oldValue = $scope.model[i][index];
                                          $scope.model[i][index] = $scope.model[i][index - 1];
                      Severity: Major
                      Found in src/resources/js/formdirectives.js and 1 other location - About 4 hrs to fix
                      src/resources/js/formdirectives.js on lines 2492..2499

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language