owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Function save has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function save() {
        if (\is_array($this->tags)) {
            foreach ($this->tags as $tag) {
                try {
                    if (!$this->mapper->tagExists($tag)) {
Severity: Minor
Found in lib/private/Tags.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 sendInternalShareMail has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function sendInternalShareMail($sender, $node, $shareType, $recipientList): array {
        if ($this->config->getAppValue('core', 'shareapi_allow_mail_notification', 'no') !== 'yes') {
            $message_t = $this->l->t('Internal mail notification for shared files is not allowed');
            throw new GenericShareException($message_t, $message_t, 403);
        }
Severity: Minor
Found in lib/private/Share/MailNotifications.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 delete has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public static function delete($parent, $excludeParent = false, $uidOwner = null, $newParent = null, $excludeGroupChildren = false) {
        $ids = [$parent];
        $deletedItems = [];
        $changeParent = [];
        $parents = [$parent];
Severity: Minor
Found in lib/private/Share/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 isAvailable has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function isAvailable(\OCP\Files\FileInfo $file) {
        if (!$this->config->getSystemValue('enable_previews', true)) {
            return false;
        }

Severity: Minor
Found in lib/private/PreviewManager.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 findAppInDirectories has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function findAppInDirectories($appId) {
        $sanitizedAppId = \OC_App::cleanAppId($appId);
        if ($sanitizedAppId !== $appId) {
            return false;
        }
Severity: Minor
Found in lib/private/App/AppManager.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 checkAppForUser has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    private function checkAppForUser($enabled, $appName, $user) {
        if ($user !== null) {
            $userAppAttributes = $user->getExtendedAttributes();
            /**
             * Guests will only have access to some whitelisted apps
Severity: Minor
Found in lib/private/App/AppManager.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 loadRoutes has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public function loadRoutes($app = null) {
        if (\is_string($app)) {
            $app = \OC_App::cleanAppId($app);
        }

Severity: Minor
Found in lib/private/Route/Router.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 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        try {
            $this->checkInput($input);
        } catch (\InvalidArgumentException $e) {
            $output->writeln('<error>' . $e->getMessage() . '</error>');
Severity: Minor
Found in core/Command/User/Setting.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 19 (exceeds 5 allowed). Consider refactoring.
Open

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $outputType = $input->getOption('output');

        \OC_App::loadApps();
        $this->router->loadRoutes();
Severity: Minor
Found in core/Command/Security/ListRoutes.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 getStorageConfig has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getStorageConfig: function($tr) {
        var storageId = $tr.data('id');
        if (!storageId) {
            // new entry
            storageId = null;
Severity: Major
Found in apps/files_external/js/settings.js - About 2 hrs to fix

    Method setPassword has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setPassword($token, $userId, $password) {
            $user = $this->userManager->get($userId);
    
            if ($user === null) {
                $this->log->error('User: ' . $userId . ' does not exist.', ['app' => 'settings']);
    Severity: Major
    Found in settings/Controller/UsersController.php - About 2 hrs to fix

      Method sendLinkShareMail has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function sendLinkShareMail($sender, $recipients, $link, $personalNote = null) {
              if ($this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') !== 'yes') {
                  $message_t = $this->l->t('Public link mail notification is not allowed');
                  throw new GenericShareException($message_t, $message_t, 403);
              }
      Severity: Major
      Found in lib/private/Share/MailNotifications.php - About 2 hrs to fix

        Method lock has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function lock($storageId, $internalPath, $fileId, array $lockInfo) {
                if ($fileId <= 0) {
                    throw new \InvalidArgumentException('Invalid file id');
                }
                if (!isset($lockInfo['token'])) {
        Severity: Major
        Found in lib/private/Lock/Persistent/LockManager.php - About 2 hrs to fix

          File filesharing.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /** @var \OCP\IL10N $l */
          /** @var array $_ */
          ?>
          <div id="shareAPI" class="section">
          Severity: Minor
          Found in settings/templates/panels/admin/filesharing.php - About 2 hrs to fix

            File Server.php has 272 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            /**
             * @author Christoph Wurst <christoph@owncloud.com>
             * @author Georg Ehrke <georg@owncloud.com>
             * @author Lukas Reschke <lukas@statuscode.ch>
            Severity: Minor
            Found in apps/dav/lib/Server.php - About 2 hrs to fix

              Function submit has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  submit: function() {
                      var self = this;
                      var data = this.data;
                      var file = this.getFile();
              
              
              Severity: Major
              Found in apps/files/js/file-upload.js - About 2 hrs to fix

                Function avatar has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    $.fn.avatar = function(user, size, ie8fix, hidedefault, callback, displayname) {
                        if (typeof(size) === 'undefined') {
                            if (this.height() > 0) {
                                size = this.height();
                            } else if (this.data('size') > 0) {
                Severity: Major
                Found in core/js/jquery.avatar.js - About 2 hrs to fix

                  Method setupDatabase has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function setupDatabase($username) {
                          $e_host = \addslashes($this->dbHost);
                          $e_user = \addslashes($this->dbUser);
                          $e_password = \addslashes($this->dbPassword);
                  
                  
                  Severity: Major
                  Found in lib/private/Setup/PostgreSQL.php - About 2 hrs to fix

                    Method __construct has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function __construct($server, $protocolVersion='HTTP/1.1') {
                            $this->server = $server;
                            $this->protocolVersion = $protocolVersion;
                    
                            $this->headers = [
                    Severity: Major
                    Found in lib/private/AppFramework/Http.php - About 2 hrs to fix

                      prototype has 23 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      OC.FileUpload.prototype = {
                      
                          /**
                           * Unique upload id
                           *
                      Severity: Minor
                      Found in apps/files/js/file-upload.js - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language