owncloud/core

View on GitHub
apps/files_sharing/js/share.js

Summary

Maintainability
D
2 days
Test Coverage

Function attach has 169 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        attach: function(fileList) {
            // core sharing is disabled/not loaded
            if (!OC.Share) {
                return;
            }
Severity: Major
Found in apps/files_sharing/js/share.js - About 6 hrs to fix

    File share.js has 332 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_sharing/js/share.js - About 4 hrs to fix

      Function _handlePublicLinkQuickAction has 95 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              _handlePublicLinkQuickAction: function(fileInfoModel, shareTab, shareConfig) {
                  var self = this;
                  var shareDialog = shareTab._dialog;
                  var linkShareView;
                  var initNewShareLinkView = true;
      Severity: Major
      Found in apps/files_sharing/js/share.js - About 3 hrs to fix

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

                    fileList._getWebdavProperties = function() {
                        var props = oldGetWebdavProperties.apply(this, arguments);
                        props.push(OC.Files.Client.PROPERTY_OWNER_DISPLAY_NAME);
                        props.push(OC.Files.Client.PROPERTY_SHARE_TYPES);
                        return props;
        Severity: Major
        Found in apps/files_sharing/js/share.js and 1 other location - About 2 hrs to fix
        apps/files/js/tagsplugin.js on lines 175..180

        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

                            data.shareTypes = _.chain(shareTypesProp).filter(function(xmlvalue) {
                                return (xmlvalue.namespaceURI === OC.Files.Client.NS_OWNCLOUD && xmlvalue.nodeName.split(':')[1] === 'share-type');
                            }).map(function(xmlvalue) {
                                return parseInt(xmlvalue.textContent || xmlvalue.text, 10);
                            }).value();
        Severity: Major
        Found in apps/files_sharing/js/share.js and 1 other location - About 2 hrs to fix
        apps/files/js/tagsplugin.js on lines 188..192

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

        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

            _.extend(OC.Files.Client, {
                PROPERTY_SHARE_TYPES:    '{' + OC.Files.Client.NS_OWNCLOUD + '}share-types',
                PROPERTY_OWNER_DISPLAY_NAME:    '{' + OC.Files.Client.NS_OWNCLOUD + '}owner-display-name'
            });
        Severity: Major
        Found in apps/files_sharing/js/share.js and 1 other location - About 1 hr to fix
        apps/files/js/tagsplugin.js on lines 15..18

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

        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 ((permissions & OC.PERMISSION_SHARE) !== 0) {
                                    var $actionLink = $(self.renderPublicLinkAction());
                                    context.$file.find('a.name>span.fileactions').append($actionLink);
                                    return $actionLink;
                                }
        Severity: Minor
        Found in apps/files_sharing/js/share.js and 1 other location - About 40 mins to fix
        apps/files/js/filelockplugin.js on lines 142..146

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

        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