owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

    _.extend(OC.Files.Client, {
        PROPERTY_FILEID:    '{' + OC.Files.Client.NS_OWNCLOUD + '}id',
        PROPERTY_VERSION_EDITED_BY:    '{' + OC.Files.Client.NS_OWNCLOUD + '}meta-version-edited-by',
        PROPERTY_VERSION_EDITED_BY_NAME:    '{' + OC.Files.Client.NS_OWNCLOUD + '}meta-version-edited-by-name',
        PROPERTY_VERSION_TAG:    '{' + OC.Files.Client.NS_OWNCLOUD + '}meta-version-tag',
Severity: Major
Found in apps/files_versions/js/versioncollection.js and 1 other location - About 4 hrs to fix
apps/files_versions/js/versionsrootmodel.js on lines 15..20

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

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

File ShareController.php has 349 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
 * @author Björn Schießle <bjoern@schiessle.org>
 * @author Georg Ehrke <georg@owncloud.com>
Severity: Minor
Found in apps/files_sharing/lib/Controllers/ShareController.php - About 4 hrs to fix

    Function addSelect2 has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function addSelect2 ($elements, userListLimit) {
        if (!$elements.length) {
            return;
        }
        $elements.select2({
    Severity: Major
    Found in apps/files_external/js/settings.js - About 4 hrs to fix

      Local has 34 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Local extends Common {
          protected $datadir;
      
          protected $dataDirLength;
      
      
      Severity: Minor
      Found in lib/private/Files/Storage/Local.php - About 4 hrs to fix

        Request has 34 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Request implements ArrayAccess, Countable, IRequest {
            public const USER_AGENT_IE = '/(MSIE)|(Trident)/';
            public const USER_AGENT_IE_8 = '/MSIE 8.0/';
            // Microsoft Edge User Agent from https://msdn.microsoft.com/en-us/library/hh869301(v=vs.85).aspx
            public const USER_AGENT_MS_EDGE = '/^Mozilla\/5\.0 \([^)]+\) AppleWebKit\/[0-9.]+ \(KHTML, like Gecko\) Chrome\/[0-9.]+ (Mobile Safari|Safari)\/[0-9.]+ Edge\/[0-9.]+$/';
        Severity: Minor
        Found in lib/private/AppFramework/Http/Request.php - About 4 hrs to fix

          OC_Image has 34 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class OC_Image implements \OCP\IImage {
              /** @var false|resource */
              protected $resource = false; // tmp resource.
              /** @var int */
              protected $imageType = IMAGETYPE_PNG; // Default to png if file type isn't evident.
          Severity: Minor
          Found in lib/private/legacy/image.php - About 4 hrs to fix

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

                                $('<li class="shareTree-item">').append( $icon, $name, $path).appendTo($list).click(function() {
                                    self.changeDirectory(share.path.replace(folder.name, ''), true).then(function() {
                                        self._updateDetailsView(folder.name, true);
                                    }).catch(function(e) {
                                        console.error(e);
            Severity: Major
            Found in apps/files/js/filelist.js and 1 other location - About 4 hrs to fix
            apps/files/js/filelist.js on lines 1976..1982

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

            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

                                $('<li class="shareTree-item">').append( $icon, $name, $path).appendTo($list).click(function() {
                                    self.changeDirectory(share.path.replace(folder.name, ''), true).then(function() {
                                        self._updateDetailsView(folder.name, true);
                                    }).catch(function(e) {
                                        console.error(e);
            Severity: Major
            Found in apps/files/js/filelist.js and 1 other location - About 4 hrs to fix
            apps/files/js/filelist.js on lines 2014..2020

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

            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

                    foreach ($changedProperties as $propertyName => $propertyValue) {
                        $propertyExists = \array_key_exists($propertyName, $existingProperties);
                        // If it was null, we need to delete the property
                        if ($propertyValue === null) {
                            if ($propertyExists) {
            Severity: Major
            Found in apps/dav/lib/DAV/FileCustomPropertiesBackend.php and 1 other location - About 4 hrs to fix
            apps/dav/lib/DAV/MiscCustomPropertiesBackend.php on lines 116..153

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

            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

                    foreach ($changedProperties as $propertyName => $propertyValue) {
                        $propertyExists = \array_key_exists($propertyName, $existingProperties);
                        // If it was null, we need to delete the property
                        if ($propertyValue === null) {
                            if ($propertyExists) {
            Severity: Major
            Found in apps/dav/lib/DAV/MiscCustomPropertiesBackend.php and 1 other location - About 4 hrs to fix
            apps/dav/lib/DAV/FileCustomPropertiesBackend.php on lines 171..208

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

            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

            File public.js has 344 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/public.js - About 4 hrs to fix

              File oc-backbone-webdav.js has 344 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /*
               * Copyright (c) 2015
               *
               * This file is licensed under the Affero General Public License version 3
               * or later.
              Severity: Minor
              Found in core/js/oc-backbone-webdav.js - About 4 hrs to fix

                Function updateShare has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function updateShare(\OCP\Share\IShare $share, $skipExpirationValidation = false) {
                        $expirationDateUpdated = false;
                
                        $this->canShare($share);
                
                
                Severity: Minor
                Found in lib/private/Share20/Manager.php - About 4 hrs 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 mergeResponses has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function mergeResponses($responses) {
                        // Sort into shipped and third-party
                        $shipped = [
                            'succeeded' => [],
                            'failed' => [],
                Severity: Minor
                Found in lib/private/legacy/api.php - About 4 hrs 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 upsert has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function upsert($table, $input, $compare) {
                        $this->conn->beginTransaction();
                        $done = false;
                
                        if (empty($compare)) {
                Severity: Minor
                Found in lib/private/DB/Adapter.php - About 4 hrs 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 setLanguageFromRequest has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function setLanguageFromRequest($app = null) {
                        $header = $this->request->getHeader('ACCEPT_LANGUAGE');
                        if ($header) {
                            $available = $this->findAvailableLanguages($app);
                
                
                Severity: Minor
                Found in lib/private/L10N/Factory.php - About 4 hrs 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

                File nl.js has 343 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                OC.L10N.register(
                    "settings",
                    {
                    "No user supplied" : "Geen gebruiker opgegeven",
                    "Authentication error" : "Authenticatie fout",
                Severity: Minor
                Found in settings/l10n/nl.js - About 4 hrs to fix

                  File mk.js has 343 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  OC.L10N.register(
                      "core",
                      {
                      "Please select a file." : "Изберете датотека.",
                      "File is too big" : "Датотеката е пре голема",
                  Severity: Minor
                  Found in core/l10n/mk.js - About 4 hrs to fix

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

                        private function loadFSApps() {
                            $enabledApps = \OC_App::getEnabledApps();
                            foreach ($enabledApps as $enabledApp) {
                                if ($enabledApp !== 'files_external' && \OC_App::isType($enabledApp, ['filesystem'])) {
                                    try {
                    apps/files_external/appinfo/Migrations/Version20210511082903.php on lines 112..131

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

                    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

                        private function loadFSApps() {
                            $enabledApps = \OC_App::getEnabledApps();
                            foreach ($enabledApps as $enabledApp) {
                                if ($enabledApp !== 'files_external' && \OC_App::isType($enabledApp, ['filesystem'])) {
                                    try {
                    apps/files_external/appinfo/Migrations/Version20220329110116.php on lines 86..105

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

                    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

                    Severity
                    Category
                    Status
                    Source
                    Language