owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

        prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText,
            this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ),
            this._getFormatConfig( inst ) ) );
Severity: Minor
Found in core/js/js.js and 1 other location - About 50 mins to fix
core/js/js.js on lines 2991..2993

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

                    click: function () {
                        if (callback !== undefined) {
                            callback(false, input.val());
                        }
                        $(dialogId).ocdialog('close');
Severity: Minor
Found in core/js/oc-dialogs.js and 1 other location - About 50 mins to fix
core/js/oc-dialogs.js on lines 120..125

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

                if (_.isFunction(actionSpec.icon)) {
                    params.icon = actionSpec.icon(context.$file.attr('data-file'), context);
                }
Severity: Minor
Found in apps/files/js/fileactions.js and 1 other location - About 50 mins to fix
apps/files/js/fileactions.js on lines 362..364

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

    lockBreakersGroupsList.change(function(ev) {
        OC.AppConfig.setValue('core', 'lock-breaker-groups', JSON.stringify(ev.val || []));
    });
Severity: Minor
Found in settings/js/panels/persistentlocking.js and 1 other location - About 50 mins to fix
settings/js/panels/enforce2fa.js on lines 5..7

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

        if (this.$filePicker.data('mimetype') === "http/unix-directory") {
            buttonEnableDisable.prop("disabled", false);
        } else {
            buttonEnableDisable.prop("disabled", true);
        }
Severity: Minor
Found in core/js/oc-dialogs.js and 1 other location - About 50 mins to fix
core/js/oc-dialogs.js on lines 865..869

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

Function _saveToOwnCloud has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    _saveToOwnCloud: function (remote, token, owner, ownerDisplayName, name, isProtected) {
Severity: Minor
Found in apps/files_sharing/js/public.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                    if (OC.isUserAdmin()) {
                                        OC.redirect(OC.generateUrl('/settings/admin?sectionid=storage'));
                                    }
                                    else {
                                        OC.redirect(OC.generateUrl('/settings/personal?sectionid=storage'));
    Severity: Major
    Found in apps/files_external/js/statusmanager.js - About 45 mins to fix

      Function lazyLoadPreview has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              lazyLoadPreview : function(path, mime, ready, width, height, etag) {
      Severity: Minor
      Found in apps/files/js/files.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if (result && result.status == 'success') {
                                            $(token).val(result.access_token);
                                            $(token_secret).val(result.access_token_secret);
                                            $(configured).val('true');
                                            OCA.External.Settings.mountConfig.saveStorageConfig($tr, function(status) {
        Severity: Major
        Found in apps/files_external/js/oauth1.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if ($.isFunction(this.callback)) {
                                      $.when.apply($, this.deferredsList)
                                          .always($.proxy(function(){
                                              this.callback();
                                          }, this)
          Severity: Major
          Found in apps/files_external/js/rollingqueue.js - About 45 mins to fix

            Function preSortSearchString has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                preSortSearchString: function(a, b) {
                    var pattern = this.filter;
                    if(typeof pattern === 'undefined') {
                        return undefined;
                    }
            Severity: Minor
            Found in settings/js/users/users.js - About 45 mins 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 register has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    register: function(mime, name, permissions, icon, action, displayName) {
            Severity: Minor
            Found in apps/files/js/fileactions.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                              if (options.uniqueFilenames) {
                                                  fileName = that._getUniqueFilename(
                                                      fileName,
                                                      options.uniqueFilenames
                                                  );
              Severity: Major
              Found in apps/files/js/jquery.fileupload.js - About 45 mins to fix

                Function register has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    window.FileActions.register = function (mime, name, permissions, icon, action, displayName) {
                Severity: Minor
                Found in apps/files/js/fileactions.js - About 45 mins to fix

                  Function loadPreview has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          loadPreview: function(path, mime, etag, $iconDiv, $container, isImage) {
                  Severity: Minor
                  Found in apps/files/js/mainfileinfodetailview.js - About 45 mins to fix

                    Function position has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    $.fn.position = function( options ) {
                        if ( !options || !options.of ) {
                            return _position.apply( this, arguments );
                        }
                    
                    
                    Severity: Minor
                    Found in core/js/js.js - About 45 mins 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

                    Avoid deeply nested control flow statements.
                    Open

                                            if (upload) {
                                                var response = upload.getResponse();
                                                message = t('files', 'Failed to upload the file "{fileName}": {error}', {fileName: upload.getFileName(), error: response.message});
                                            }
                    Severity: Major
                    Found in apps/files/js/file-upload.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (!paramNameSlice.length) {
                                                  paramNameSlice = paramName;
                                              }
                      Severity: Major
                      Found in apps/files/js/jquery.fileupload.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                        for (j = 0; j < groupsLength; j++) {
                                                            if (groups[j].value.shareWith === share.share_with) {
                                                                groups.splice(j, 1);
                                                                break;
                                                            }
                        Severity: Major
                        Found in core/js/sharedialogview.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                                  if (res.found[i].shareWith === OC.currentUser) {
                                                                      res.found.splice(i, 1);
                                                                      continue;
                                                                  }
                          Severity: Major
                          Found in core/js/sharedialogview.js - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language