owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function edit has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    edit:function(type, cb) {
        if(!type && !this.type) {
            throw {
                name: 'MissingParameter',
                message: t(
Severity: Major
Found in core/js/tags.js - About 2 hrs to fix

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

        protected function execute(InputInterface $input, OutputInterface $output): int {
            $user = $input->getOption('user');
            $path = $input->getArgument('path');
            if ($path === '-') {
                $json = \file_get_contents('php://stdin');
    Severity: Major
    Found in apps/files_external/lib/Command/Import.php - About 2 hrs to fix

      Method copyBetweenStorage has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function copyBetweenStorage(Storage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime, $isRename) {
              // for versions we have nothing to do, because versions should always use the
              // key from the original file. Just create a 1:1 copy and done
              if ($this->isVersion($targetInternalPath) ||
                  $this->isVersion($sourceInternalPath)) {
      Severity: Major
      Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 2 hrs to fix

        Method getAllStorages has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getAllStorages() {
                $mountPoints = $this->readLegacyConfig();
                /**
                 * Here is the how the horribly messy mount point array looks like
                 * from the mount.json file:
        Severity: Major
        Found in lib/private/Files/External/Service/LegacyStoragesService.php - About 2 hrs to fix

          Method run has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function run(IOutput $output) {
                  if ($this->config->getSystemValue('has_internet_connection', true) !== true) {
                      $link = $this->defaults->buildDocLinkToKey('admin-marketplace-apps');
                      $output->info('No internet connection available - no app updates will be taken from the marketplace.');
                      $output->info("How to update apps in such situation please see $link");
          Severity: Major
          Found in lib/private/Repair/Apps.php - About 2 hrs to fix

            Method enterNode has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function enterNode(Node $node) {
                    if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\Equal) {
                        $this->errors[]= [
                            'disallowedToken' => '==',
                            'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
            Severity: Major
            Found in lib/private/App/CodeChecker/NodeVisitor.php - About 2 hrs to fix

              Method listAllApps has 69 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function listAllApps(bool $listEveryApp = false) {
                      $installedApps = OC_App::getAllApps();
              
                      //TODO which apps do we want to blacklist and how do we integrate
                      // blacklisting with the multi apps folder feature?
              Severity: Major
              Found in lib/private/legacy/app.php - About 2 hrs to fix

                Function add has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    add: function (user) {
                        if (this.currentGid && this.currentGid !== '_everyone' && user.groups[this.currentGid] === undefined) {
                            return;
                        }
                
                
                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 getGroups has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function getGroups($search) {
                        $this->result['groups'] = $this->result['exact']['groups'] = [];
                
                        if (\strlen(\trim($search)) === 0 && $this->userSearch->getSearchMinLength() > 0) {
                            $this->result['groups'] = [];
                Severity: Minor
                Found in apps/files_sharing/lib/Controller/ShareesController.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 getTrashFiles has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function getTrashFiles($dir, $user, $sortAttribute = '', $sortDescending = false, $addExtraData = true) {
                        $result = [];
                        $timestamp = null;
                
                        $view = new \OC\Files\View('/' . $user . '/files_trashbin/files');
                Severity: Minor
                Found in apps/files_trashbin/lib/Helper.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 fopen has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function fopen($path, $mode) {
                        $pos = \strrpos($path, '.');
                        if ($pos !== false) {
                            $ext = \substr($path, $pos);
                        } else {
                Severity: Minor
                Found in apps/files_external/lib/Lib/Storage/Google.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 getAutoExpireList has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected static function getAutoExpireList($time, $versions) {
                        $size = 0;
                        $toDelete = [];  // versions we want to delete
                
                        $interval = 1;
                Severity: Minor
                Found in apps/files_versions/lib/Storage.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 searchCommon has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function searchCommon($method, $args) {
                        $files = [];
                        $rootLength = \strlen($this->fakeRoot);
                
                        $mount = $this->getMount('');
                Severity: Minor
                Found in lib/private/Files/View.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 calculateFolderSize has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function calculateFolderSize($path, $entry = null) {
                        $totalSize = 0;
                        if ($entry === null or !isset($entry['fileid'])) {
                            $entry = $this->get($path);
                        }
                Severity: Minor
                Found in lib/private/Files/Cache/Cache.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 getAllSharedWith has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getAllSharedWith($userId, $node) {
                        // Create array of sharedWith objects (target user -> $userId or group of which user is a member
                        $user = $this->userManager->get($userId);
                
                        // Check if user is member of some groups and chunk them
                Severity: Minor
                Found in lib/private/Share20/DefaultShareProvider.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 getSingleFile has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    private static function getSingleFile($view, $dir, $name, $params) {
                        $filename = "{$dir}/{$name}";
                        OC_Util::obEnd();
                        $view->lockFile($filename, ILockingProvider::LOCK_SHARED);
                
                
                Severity: Minor
                Found in lib/private/legacy/files.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 auth has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function auth(IRequest $request) {
                        if (!isset($request->server['PHP_AUTH_USER'], $request->server['PHP_AUTH_PW'])) {
                            return null;
                        }
                        if ($this->session->exists('app_password')) {
                Severity: Minor
                Found in lib/private/User/BasicAuthModule.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

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

                        if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) {
                            prev = $( "<a>" )
                                .attr( {
                                    "class": "ui-datepicker-prev ui-corner-all",
                                    "data-handler": "prev",
                Severity: Major
                Found in core/js/js.js and 1 other location - About 2 hrs to fix
                core/js/js.js on lines 2995..3023

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

                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._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) {
                            next = $( "<a>" )
                                .attr( {
                                    "class": "ui-datepicker-next ui-corner-all",
                                    "data-handler": "next",
                Severity: Major
                Found in core/js/js.js and 1 other location - About 2 hrs to fix
                core/js/js.js on lines 2960..2988

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

                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

                        try {
                            \OC\Files\Filesystem::initMountPoints($userId);
                
                            $brokenPath = \substr_replace(
                                \substr_replace(\md5($userId), '/', 4, 0),
                Severity: Major
                Found in lib/private/Repair/MoveAvatarIntoSubFolder.php and 1 other location - About 2 hrs to fix
                lib/private/Repair/MoveAvatarOutsideHome.php on lines 111..140

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

                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