owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Method findInvalidReshareInitiator has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function findInvalidReshareInitiator(InputInterface $input, OutputInterface $output, $fix, $scopeUid) {
        $output->writeln([
            "<info>==========================</info>",
            "<info>Searching for reshares that have invalid uid_initiator(resharer), meaning resharer which does not have the received share mounted anymore (that he reshared with other user).</info>",
            "<info>==========================</info>",
Severity: Major
Found in apps/files/lib/Command/TroubleshootTransferOwnership.php - About 2 hrs to fix

    Method validatePermissions has 61 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function validatePermissions(IShare $share) {
            // Permissions should be set
            if ($share->getPermissions() === null) {
                throw new \InvalidArgumentException('A share requires permissions');
            }
    Severity: Major
    Found in lib/private/Share20/Manager.php - About 2 hrs to fix

      Method installApp has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function installApp($data = []) {
              $l = \OC::$server->getL10N('lib');
      
              list($extractDir, $path) = self::downloadApp($data);
      
      
      Severity: Major
      Found in lib/private/Installer.php - About 2 hrs to fix

        Method fixOrientation has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function fixOrientation() {
                $o = $this->getOrientation();
                $this->logger->debug('OC_Image->fixOrientation() Orientation: ' . $o, ['app' => 'core']);
                $rotate = 0;
                $flip = false;
        Severity: Major
        Found in lib/private/legacy/image.php - About 2 hrs to fix

          Method execute has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output): int {
                  $outputType = $input->getOption('output');
          
                  \OC_App::loadApps();
                  $this->router->loadRoutes();
          Severity: Major
          Found in core/Command/Security/ListRoutes.php - About 2 hrs to fix

            Method execute has 61 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function execute(InputInterface $input, OutputInterface $output): int {
                    $appNameSubString = $input->getArgument('search-pattern');
                    $minimalView = $input->getOption('minimal');
            
                    if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') {
            Severity: Major
            Found in core/Command/App/ListApps.php - About 2 hrs to fix

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

                  public function getLength() {
                      $req = $this->server->httpRequest;
                      $length = $req->getHeader('X-Expected-Entity-Length');
                      if (!\is_numeric($length)) {
                          $length = $req->getHeader('Content-Length');
              Severity: Major
              Found in apps/dav/lib/Connector/Sabre/QuotaPlugin.php and 1 other location - About 2 hrs to fix
              apps/dav/lib/Files/PublicFiles/PublicFilesPlugin.php on lines 279..293

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

              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

                  public function getLength() {
                      $req = $this->server->httpRequest;
                      $length = $req->getHeader('X-Expected-Entity-Length');
                      if (!\is_numeric($length)) {
                          $length = $req->getHeader('Content-Length');
              Severity: Major
              Found in apps/dav/lib/Files/PublicFiles/PublicFilesPlugin.php and 1 other location - About 2 hrs to fix
              apps/dav/lib/Connector/Sabre/QuotaPlugin.php on lines 231..245

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

              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

                  private static function lockFiles($view, $dir, $files) {
                      foreach ($files as $file) {
                          $filePath = "{$dir}/{$file}";
                          $view->lockFile($filePath, ILockingProvider::LOCK_SHARED);
                          if ($view->is_dir($filePath)) {
              Severity: Major
              Found in lib/private/legacy/files.php and 1 other location - About 2 hrs to fix
              lib/private/legacy/files.php on lines 366..381

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

              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

                  private static function unlockFiles($view, $dir, $files) {
                      foreach ($files as $file) {
                          $filePath = "{$dir}/{$file}";
                          $view->unlockFile($filePath, ILockingProvider::LOCK_SHARED);
                          if ($view->is_dir($filePath)) {
              Severity: Major
              Found in lib/private/legacy/files.php and 1 other location - About 2 hrs to fix
              lib/private/legacy/files.php on lines 344..359

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

              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 response.php has 268 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              /**
               * @author Andreas Fischer <bantu@owncloud.com>
               * @author Bart Visscher <bartv@thisnet.nl>
               * @author Jörn Friedrich Dreyer <jfd@butonic.de>
              Severity: Minor
              Found in lib/private/legacy/response.php - About 2 hrs to fix

                Function setupGroupsSelect has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    setupGroupsSelect: function($elements, extraOptions, options) {
                        var self = this;
                        options = options || {};
                        if ($elements.length > 0) {
                            // note: settings are saved through a "change" event registered
                Severity: Minor
                Found in settings/js/settings.js - About 2 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 alphanum has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    alphanum: function(a, b) {
                        function chunkify(t) {
                            var tz = [], x = 0, y = -1, n = 0, i, j;
                
                            while (i = (j = t.charAt(x++)).charCodeAt(0)) {
                Severity: Minor
                Found in settings/js/users/users.js - About 2 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 tipsy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                jQuery.fn.tipsy = function (argument) {
                    console.warn('Deprecation warning: tipsy is deprecated. Use tooltip instead.');
                    if (typeof argument === 'object' && argument !== null) {
                
                        // tipsy defaults
                Severity: Minor
                Found in core/js/js.js - About 2 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 getResponse has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    getResponse: function() {
                        var response = this.data.response();
                        if (response.errorThrown) {
                            if (response.errorThrown === 'timeout') {
                                return {
                Severity: Minor
                Found in apps/files/js/file-upload.js - About 2 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 getSharedWithMe has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function getSharedWithMe($node, $includeTags, $requestedShareTypes, $stateFilter = 0) {
                        // sharedWithMe is limited to user and group shares for compatibility.
                        $shares = [];
                        if (isset($requestedShareTypes[Share::SHARE_TYPE_USER]) && $requestedShareTypes[Share::SHARE_TYPE_USER]) {
                            $shares = \array_merge(
                Severity: Minor
                Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 2 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 showShare has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function showShare($token, $path = '') {
                        \OC_User::setIncognitoMode(true);
                
                        // Check whether share exists
                        try {
                Severity: Minor
                Found in apps/files_sharing/lib/Controllers/ShareController.php - About 2 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 handleGetProperties has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function handleGetProperties(
                        PropFind $propFind,
                        \Sabre\DAV\INode $node
                    ) {
                        if (!($node instanceof File) && !($node instanceof Directory)) {
                Severity: Minor
                Found in apps/dav/lib/Connector/Sabre/CommentPropertiesPlugin.php - About 2 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 findInvalidReshareInitiator has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function findInvalidReshareInitiator(InputInterface $input, OutputInterface $output, $fix, $scopeUid) {
                        $output->writeln([
                            "<info>==========================</info>",
                            "<info>Searching for reshares that have invalid uid_initiator(resharer), meaning resharer which does not have the received share mounted anymore (that he reshared with other user).</info>",
                            "<info>==========================</info>",
                Severity: Minor
                Found in apps/files/lib/Command/TroubleshootTransferOwnership.php - About 2 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 propfind has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function propfind($path, $strictNotFoundCheck=false) {
                        $path = $this->cleanPath($path);
                        $cachedResponse = $this->statCache->get($path);
                        // we either don't know it, or we know it exists but need more details
                        if ($cachedResponse === null || $cachedResponse === true) {
                Severity: Minor
                Found in lib/private/Files/Storage/DAV.php - About 2 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

                Severity
                Category
                Status
                Source
                Language