owncloud/core

View on GitHub
core/js/setupchecks.js

Summary

Maintainability
D
1 day
Test Coverage

Function checkSetup has 83 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        checkSetup: function() {
            var deferred = $.Deferred();
            var afterCall = function(data, statusText, xhr) {
                var messages = [];
                if (xhr.status === 200 && data) {
Severity: Major
Found in core/js/setupchecks.js - About 3 hrs to fix

    Function afterCall has 74 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                var afterCall = function(data, statusText, xhr) {
                    var messages = [];
                    if (xhr.status === 200 && data) {
                        if (!data.serverHasInternetConnection) {
                            messages.push({
    Severity: Major
    Found in core/js/setupchecks.js - About 2 hrs to fix

      File setupchecks.js has 264 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 core/js/setupchecks.js - About 2 hrs to fix

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

                _checkSecurityHeaders: function(xhr) {
                    var messages = [];
        
                    if (xhr.status === 200) {
                        var securityHeaders = {
        Severity: Minor
        Found in core/js/setupchecks.js - About 1 hr to fix

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

                  _checkSSL: function(xhr) {
                      var messages = [];
          
                      if (xhr.status === 200) {
                          var docPlaceholderUrl = '';
          Severity: Minor
          Found in core/js/setupchecks.js - About 1 hr to fix

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

                                if(!data.isUrandomAvailable) {
                                    messages.push({
                                        msg: t('core', '/dev/urandom is not readable by PHP which is highly discouraged for security reasons. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.securityDocs}),
                                        type: OC.SetupChecks.MESSAGE_TYPE_WARNING
                                    });
            Severity: Major
            Found in core/js/setupchecks.js and 2 other locations - About 1 hr to fix
            core/js/setupchecks.js on lines 101..106
            core/js/setupchecks.js on lines 125..130

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

                                if(!data.forwardedForHeadersWorking) {
                                    messages.push({
                                        msg: t('core', 'The reverse proxy headers configuration is incorrect, or you are accessing ownCloud from a trusted proxy. If you are not accessing ownCloud from a trusted proxy, this is a security issue and can allow an attacker to spoof their IP address as visible to ownCloud. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.reverseProxyDocs}),
                                        type: OC.SetupChecks.MESSAGE_TYPE_WARNING
                                    });
            Severity: Major
            Found in core/js/setupchecks.js and 2 other locations - About 1 hr to fix
            core/js/setupchecks.js on lines 101..106
            core/js/setupchecks.js on lines 107..112

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

                                if(!data.isMemcacheConfigured) {
                                    messages.push({
                                        msg: t('core', 'No memory cache has been configured. To enhance your performance please configure a memcache if available. Further information can be found in our <a target="_blank" rel="noreferrer" href="{docLink}">documentation</a>.', {docLink: data.memcacheDocs}),
                                        type: OC.SetupChecks.MESSAGE_TYPE_INFO
                                    });
            Severity: Major
            Found in core/js/setupchecks.js and 2 other locations - About 1 hr to fix
            core/js/setupchecks.js on lines 107..112
            core/js/setupchecks.js on lines 125..130

            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

            There are no issues that match your filters.

            Category
            Status