luyadev/luya-module-admin

View on GitHub
src/resources/js/directives.js

Summary

Maintainability
F
1 wk
Test Coverage

File directives.js has 1434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Directive to generate e chart diagrams.
 *
 * uses echarts.js component.
 *
Severity: Major
Found in src/resources/js/directives.js - About 3 days to fix

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

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

      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

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

                controller: ['$scope', '$http', '$filter', 'ServiceFiltersData', 'ServiceImagesData', 'AdminToastService', 'ServiceFilesData', function ($scope, $http, $filter, ServiceFiltersData, ServiceImagesData, AdminToastService, ServiceFilesData) {
        
                    // ServiceFiltesrData inheritance
        
                    //$scope.ngModel = 0;
        Severity: Major
        Found in src/resources/js/directives.js - About 2 hrs to fix

          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

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

                      link: function (scope, element, attrs) {
                          scope.elementWidth = 0;
              
                          var getElementOriginalWidth = function () {
                              var elementClone = element.clone().insertAfter(element);
              Severity: Minor
              Found in src/resources/js/directives.js - About 1 hr to fix

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

                        controller: ['$scope', '$timeout', function ($scope, $timeout) {
                            $scope.pageNumberInputVal = $scope.currentPage;
                
                            $scope.$watch('currentPage', function(newVal) {
                                $scope.pageNumberInputVal = newVal;
                Severity: Minor
                Found in src/resources/js/directives.js - About 1 hr to fix

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

                          controller: ['$scope', function ($scope) {
                  
                              $scope.input = { showWindow: true };
                  
                              $scope.content = null;
                  Severity: Minor
                  Found in src/resources/js/directives.js - About 1 hr to fix

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

                            link: function ($scope, $element, $attrs) {
                    
                                $scope.$watch('trigger', function (n, o) {
                                    if (n == 0) {
                                        $($attrs.resizerLeft).removeAttr('style');
                    Severity: Minor
                    Found in src/resources/js/directives.js - About 1 hr to fix

                      Consider simplifying this complex logical expression.
                      Open

                                      if ( (!scope.pop || lastValue != scope.tooltipText)
                                        && (typeof scope.tooltipDisabled === 'undefined' || scope.tooltipDisabled === false)
                                        && (scope.tooltipText || scope.tooltipImageUrl || scope.tooltipPreviewUrl) ) {
                      
                                          lastValue = scope.tooltipText
                      Severity: Critical
                      Found in src/resources/js/directives.js - About 1 hr to fix

                        Function update has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                var update = function () {
                                    if ($shadow == null) {
                                        $shadow = angular.element('<div></div>').css({
                                            position: 'absolute',
                                            top: -10000,
                        Severity: Minor
                        Found in src/resources/js/directives.js - 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

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

                                          controller: ['$scope', '$http', '$filter', 'ServiceFiltersData', 'ServiceImagesData', 'AdminToastService', 'ServiceFilesData', function ($scope, $http, $filter, ServiceFiltersData, ServiceImagesData, AdminToastService, ServiceFilesData) {
                                  Severity: Major
                                  Found in src/resources/js/directives.js - About 50 mins 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

                                    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

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

                                                    ServiceFilesData.getFile(n).then(function (response) {
                                                        $scope.fileinfo = response;
                                                    }, function () {
                                                        $scope.fileinfo = null;
                                                    });
                                    Severity: Minor
                                    Found in src/resources/js/directives.js and 1 other location - About 55 mins to fix
                                    src/resources/js/directives.js on lines 828..832

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

                                    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

                                                    ServiceFilesData.getFile(n).then(function (file) {
                                                        $scope.fileinfo = file;
                                                    }, function () {
                                                        $scope.fileinfo = null;
                                                    });
                                    Severity: Minor
                                    Found in src/resources/js/directives.js and 1 other location - About 55 mins to fix
                                    src/resources/js/directives.js on lines 956..960

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

                                    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 3 locations. Consider refactoring.
                                    Open

                                            scope: {
                                                'tooltipText': '@',
                                                'tooltipExpression': '=',
                                                'tooltipPosition': '@',
                                                'tooltipOffsetTop': '@',
                                    Severity: Major
                                    Found in src/resources/js/directives.js and 2 other locations - About 50 mins to fix
                                    src/resources/js/formdirectives.js on lines 1429..1439
                                    src/resources/js/formdirectives.js on lines 1782..1792

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

                                    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.searchPromise = $timeout(function () {
                                                                $scope.getFilesForCurrentPage().then(function () {
                                                                    $scope.searchLoading = false;
                                                                    cfpLoadingBar.complete()
                                                                });
                                    Severity: Minor
                                    Found in src/resources/js/directives.js and 1 other location - About 45 mins to fix
                                    src/resources/js/controllers.js on lines 821..826

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

                                    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

                                    There are no issues that match your filters.

                                    Category
                                    Status