owncloud/core

View on GitHub
apps/files_trashbin/js/filelist.js

Summary

Maintainability
F
3 days
Test Coverage

File filelist.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2014
 *
 * This file is licensed under the Affero General Public License version 3
 * or later.
Severity: Minor
Found in apps/files_trashbin/js/filelist.js - About 2 hrs to fix

    Function _onClickDeleteSelected has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _onClickDeleteSelected: function(event) {
                event.preventDefault();
                var self = this;
                var allFiles = this.$el.find('.select-all').is(':checked');
                var files = [];
    Severity: Minor
    Found in apps/files_trashbin/js/filelist.js - About 1 hr to fix

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

              _onClickRestoreSelected: function(event) {
                  event.preventDefault();
                  var self = this;
                  var allFiles = this.$el.find('.select-all').is(':checked');
                  var files = [];
      Severity: Minor
      Found in apps/files_trashbin/js/filelist.js - About 1 hr to fix

        Function reloadCallback has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                reloadCallback: function(result) {
                    delete this._reloadCall;
                    this.hideMask();
        
                    if (!result || result.status === 'error') {
        Severity: Minor
        Found in apps/files_trashbin/js/filelist.js - About 1 hr to fix

          Avoid too many return statements within this function.
          Open

                          return false;
          Severity: Major
          Found in apps/files_trashbin/js/filelist.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return true;
            Severity: Major
            Found in apps/files_trashbin/js/filelist.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return true;
              Severity: Major
              Found in apps/files_trashbin/js/filelist.js - About 30 mins to fix

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

                            $.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'),
                                params,
                                function(result) {
                                    if (allFiles) {
                                        if (result.status !== 'success') {
                Severity: Major
                Found in apps/files_trashbin/js/filelist.js and 1 other location - About 4 hrs to fix
                apps/files_trashbin/js/filelist.js on lines 258..274

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

                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

                            $.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
                                    params,
                                    function(result) {
                                        if (allFiles) {
                                            if (result.status !== 'success') {
                Severity: Major
                Found in apps/files_trashbin/js/filelist.js and 1 other location - About 4 hrs to fix
                apps/files_trashbin/js/filelist.js on lines 208..224

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

                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

                                for (var i = 0; i < files.length; i++) {
                                    var deleteAction = this.findFileEl(files[i]).children("td.date").children(".action.delete");
                                    deleteAction.removeClass('icon-delete').addClass('icon-loading-small');
                                }
                Severity: Major
                Found in apps/files_trashbin/js/filelist.js and 1 other location - About 2 hrs to fix
                apps/files_trashbin/js/filelist.js on lines 252..255

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

                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

                                for (var i = 0; i < files.length; i++) {
                                    var deleteAction = this.findFileEl(files[i]).children("td.date").children(".action.delete");
                                    deleteAction.removeClass('icon-delete').addClass('icon-loading-small');
                                }
                Severity: Major
                Found in apps/files_trashbin/js/filelist.js and 1 other location - About 2 hrs to fix
                apps/files_trashbin/js/filelist.js on lines 198..201

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

                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

                        getAjaxUrl: function(action, params) {
                            var q = '';
                            if (params) {
                                q = '?' + OC.buildQueryString(params);
                            }
                Severity: Major
                Found in apps/files_trashbin/js/filelist.js and 1 other location - About 1 hr to fix
                apps/files/js/files.js on lines 198..204

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

                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

                        disableActions: function() {
                            this.$el.find('.action').css('display', 'none');
                            this.$el.find('input:checkbox').addClass('u-hidden');
                        },
                Severity: Major
                Found in apps/files_trashbin/js/filelist.js and 1 other location - About 1 hr to fix
                apps/files_trashbin/js/filelist.js on lines 286..289

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

                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

                        enableActions: function() {
                            this.$el.find('.action').css('display', 'inline');
                            this.$el.find('input:checkbox').removeClass('u-hidden');
                        },
                Severity: Major
                Found in apps/files_trashbin/js/filelist.js and 1 other location - About 1 hr to fix
                apps/files_trashbin/js/filelist.js on lines 291..294

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

                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 (result.data.error === 'authentication_error' ||
                                    result.data.error === 'token_expired' ||
                                    result.data.error === 'application_not_enabled'
                                ) {
                                    OC.redirect(OC.generateUrl('apps/files'));
                Severity: Minor
                Found in apps/files_trashbin/js/filelist.js and 1 other location - About 35 mins to fix
                apps/files_sharing/js/external.js on lines 82..85

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

                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