owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function toXML has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    private static function toXML($array, $writer) {
        foreach ($array as $k => $v) {
            if (isset($k[0]) && ($k[0] === '@')) {
                if (\is_array($v)) {
                    foreach ($v as $name => $value) {
Severity: Minor
Found in lib/private/legacy/api.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 execute has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $appSteps = $this->getAppsRepairSteps($output);
        // Handle listing repair steps
        $steps = \array_merge(
            \OC\Repair::getRepairSteps(),
Severity: Minor
Found in core/Command/Maintenance/Repair.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 tryLogin has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    public function tryLogin($user, $password, $redirect_url, $timezone = null, $remember_login = null) {
        $originalUser = $user;
        // TODO: Add all the insane error handling
        $loginResult = $this->userSession->login($user, $password);
        if ($loginResult !== true && $this->config->getSystemValue('strict_login_enforced', false) !== true) {
Severity: Minor
Found in core/Controller/LoginController.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 3 locations. Consider refactoring.
Open

    $('#sqlite').click(function() {
        $('#use_other_db').slideUp(250);
        $('#use_oracle_db').slideUp(250);
        $('#sqliteInformation').show();
        $('#dbname').attr('pattern','[0-9a-zA-Z$_-]+');
Severity: Major
Found in core/js/setup.js and 2 other locations - About 2 hrs to fix
core/js/setup.js on lines 30..35
core/js/setup.js on lines 37..42

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

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

    $('#mysql,#pgsql').click(function() {
        $('#use_other_db').slideDown(250);
        $('#use_oracle_db').slideUp(250);
        $('#sqliteInformation').hide();
        $('#dbname').attr('pattern','[0-9a-zA-Z$_-]+');
Severity: Major
Found in core/js/setup.js and 2 other locations - About 2 hrs to fix
core/js/setup.js on lines 23..28
core/js/setup.js on lines 37..42

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

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

    $('#oci').click(function() {
        $('#use_other_db').slideDown(250);
        $('#use_oracle_db').show(250);
        $('#sqliteInformation').hide();
        $('#dbname').attr('pattern','[0-9a-zA-Z$_-.]+');
Severity: Major
Found in core/js/setup.js and 2 other locations - About 2 hrs to fix
core/js/setup.js on lines 23..28
core/js/setup.js on lines 30..35

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

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

Function _createFileActions has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _createFileActions: function() {
        var fileActions = new OCA.Files.FileActions();
        fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) {
            var dir = context.fileList.getCurrentDirectory();
            context.fileList.changeDirectory(OC.joinPaths(dir, filename));
Severity: Major
Found in apps/files_trashbin/js/app.js - About 2 hrs to fix

    Function _addConvenienceMethods has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _addConvenienceMethods: function (e, data) {
                var that = this,
                    getPromise = function (args) {
                        return $.Deferred().resolveWith(that, args).promise();
                    };
    Severity: Major
    Found in apps/files/js/jquery.fileupload.js - About 2 hrs to fix

      Function updateIcons has 56 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          updateIcons:function(itemType, fileList){
              var item;
              var $fileList;
              var currentDir;
              if (!fileList && OCA.Files) {
      Severity: Major
      Found in core/js/share.js - About 2 hrs to fix

        Method getNodeForPath has 56 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function getNodeForPath($path) {
                if (!$this->fileView) {
                    throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
                }
        
        
        Severity: Major
        Found in apps/dav/lib/Connector/Sabre/ObjectTree.php - About 2 hrs to fix

          Method configure has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function configure() {
                  parent::configure();
          
                  $this
                      ->setName('files:scan')
          Severity: Major
          Found in apps/files/lib/Command/Scan.php - About 2 hrs to fix

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

                    try {
                        $message = $this->mailer->createMessage();
                        $message->setTo([$mailAddress => $userId]);
                        $message->setSubject($this->l10n->t('%s email address confirm', [$this->defaults->getName()]));
                        $message->setPlainBody($msg);
            Severity: Major
            Found in settings/Controller/UsersController.php and 1 other location - About 2 hrs to fix
            settings/Controller/UsersController.php on lines 1238..1249

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

            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

                        try {
                            $message = $this->mailer->createMessage();
                            $message->setTo([$oldEmailAddress => $userId]);
                            $message->setSubject($this->l10n->t('%s email address changed successfully', [$this->defaults->getName()]));
                            $message->setPlainBody($msg);
            Severity: Major
            Found in settings/Controller/UsersController.php and 1 other location - About 2 hrs to fix
            settings/Controller/UsersController.php on lines 1154..1165

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

            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 eu.js has 259 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            OC.L10N.register(
                "core",
                {
                "Please select a file." : "Mesedez, hautatu fitxategia.",
                "File is too big" : "Fitxategia handiegia da",
            Severity: Minor
            Found in core/l10n/eu.js - About 2 hrs to fix

              Function _onClickRevertVersion has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _onClickRevertVersion: function(ev) {
                          var self = this;
                          var $target = $(ev.target);
                          var fileInfoModel = this.versionsRoot.getFileInfo();
                          var revision;
              Severity: Major
              Found in apps/files_versions/js/versionstabview.js - About 2 hrs to fix

                Function _renderRow has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        _renderRow: function(fileData, options) {
                            options = options || {};
                            var type = fileData.type || 'file',
                                mime = fileData.mimetype,
                                path = fileData.path || this.getCurrentDirectory(),
                Severity: Major
                Found in apps/files/js/filelist.js - About 2 hrs to fix

                  Function _extendFileActions has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          _extendFileActions: function(fileList) {
                              var self = this;
                              fileList.fileActions.registerAction({
                                  name: 'lock-status',
                                  displayName: t('files', 'Lock status'),
                  Severity: Major
                  Found in apps/files/js/filelockplugin.js - About 2 hrs to fix

                    Method checkStorageAvailability has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function checkStorageAvailability() {
                            // WARNING: Disabling this setting is recommended only in tightly integrated federated setups as temporarly setting,
                            // should NOT be used in decentralized federation setup. It could cause bad user experience when dealing
                            // with deleted external shares
                            // NOTE: This allows administrator to disable cleanup of invalid shares so only manual removal by user or admin is possible,
                    Severity: Major
                    Found in apps/files_sharing/lib/External/Storage.php - About 2 hrs to fix

                      Method createShare has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function createShare(
                              Address $ownerAddress,
                              Address $sharedByAddress,
                              $shareWith,
                              $remoteId,
                      Severity: Major
                      Found in apps/federatedfilesharing/lib/FedShareManager.php - About 2 hrs to fix

                        Method createFederatedShare has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function createFederatedShare(IShare $share) {
                                $token = $this->tokenHandler->generateToken();
                                $shareId = $this->addShareToDB(
                                    $share->getNodeId(),
                                    $share->getNodeType(),
                        Severity: Major
                        Found in apps/federatedfilesharing/lib/FederatedShareProvider.php - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language