owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Method shareItem has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null, $passwordChanged = null) {
Severity: Major
Found in lib/private/Share/Share.php - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 0) {
                return (string) $l->t('today');
            } elseif ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 1) {
                return (string) $l->t('yesterday');
            } elseif ($dateInterval->y == 0 && $dateInterval->m == 0) {
    Severity: Major
    Found in lib/private/DateTimeFormatter.php - About 1 hr to fix

      Method register has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              $method,
              $url,
              $action,
              $app,
              $authLevel = API::USER_AUTH,
      Severity: Major
      Found in lib/private/legacy/api.php - About 1 hr to fix

        Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                Account $account,
                AccountMapper $mapper,
                $emitter = null,
                IConfig $config = null,
                $urlGenerator = null,
        Severity: Major
        Found in lib/private/User/User.php - About 1 hr to fix

          Function _parseAppAuthor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              _parseAppAuthor: function (author) {
                  if (_.isObject(author) && !_.isUndefined(author['@value'])) {
                      return author['@value'];
                  }
          
          
          Severity: Minor
          Found in settings/js/admin-apps.js - About 55 mins 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 _getFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              _getFile: function(mimeType, files) {
                  var icon = mimeType.replace(new RegExp('/', 'g'), '-');
          
                  // Generate path
                  if (mimeType === 'dir' && $.inArray('folder', files) !== -1) {
          Severity: Minor
          Found in core/js/mimetype.js - About 55 mins 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 handleException has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function handleException($e) {
              $request = \OC::$server->getRequest();
              // in case the request content type is text/xml - we assume it's a WebDAV request
              $isXmlContentType = \strpos($request->getHeader('Content-Type') ?? '', 'text/xml');
              if ($isXmlContentType === 0) {
          Severity: Minor
          Found in remote.php - About 55 mins 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 getSharesFromItem has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function getSharesFromItem($target) {
                  $result = [];
                  $owner = Filesystem::getOwner($target);
                  Filesystem::initMountPoints($owner);
                  $info = Filesystem::getFileInfo($target);
          Severity: Minor
          Found in apps/files_sharing/lib/Helper.php - About 55 mins 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 canAccessShare has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function canAccessShare(IShare $share) {
                  // A file with permissions 0 can't be accessed by us,
                  // unless it's a rejected sub-group share in which case we want it visible to let the user accept it again
                  if ($share->getPermissions() === 0
                      && !($share->getShareType() === Share::SHARE_TYPE_GROUP && $share->getState() === Share::STATE_REJECTED)) {
          Severity: Minor
          Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 55 mins 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 format has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              private function format(INotification $notification, L10N $l) {
                  $params = $notification->getSubjectParameters();
                  if ($params[0] !== $params[1] && $params[1] !== null) {
                      $params[0] = $this->getUserString($params[0]);
                      $params[1] = $this->getUserString($params[1]);
          Severity: Minor
          Found in apps/files_sharing/lib/Notifier.php - About 55 mins 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 event has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function event(ManagerEvent $event) {
                  $actor = $this->session->getUser();
                  if ($actor instanceof IUser) {
                      $actor = $actor->getUID();
                  } else {
          Severity: Minor
          Found in apps/systemtags/lib/Activity/Listener.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function execute(InputInterface $input, OutputInterface $output): int {
                  $retentionEnabled = $this->trashExpiryManager->retentionEnabled();
                  if (!$retentionEnabled) {
                      $output->writeln("Auto expiration is configured - expiration will be handled automatically.");
                      return 1;
          Severity: Minor
          Found in apps/files_trashbin/lib/Command/ExpireTrash.php - About 55 mins 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 validateUserPass has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function validateUserPass($username, $password) {
                  if (\trim($username) === '') {
                      return false;
                  }
                  if ($this->userSession->isLoggedIn() &&
          Severity: Minor
          Found in apps/dav/lib/Connector/Sabre/Auth.php - About 55 mins 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 check has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function check(RequestInterface $request, ResponseInterface $response) {
                  $node = $this->resolveShare($request->getPath());
                  if (!$node instanceof PublicSharedRootNode) {
                      return [true, 'principals/system/public'];
                  }
          Severity: Minor
          Found in apps/dav/lib/Files/PublicFiles/PublicSharingAuth.php - About 55 mins 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 getDavPermissions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getDavPermissions() {
                  $node = $this->getNode();
                  $p = '';
                  if ($node->isDeletable() && $this->checkSharePermissions(Constants::PERMISSION_DELETE)) {
                      $p .= 'D';
          Severity: Minor
          Found in apps/dav/lib/Files/PublicFiles/SharedNodeTrait.php - About 55 mins 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 updateStorageStatus has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              private function updateStorageStatus(IStorageConfig &$storage, $configInput, OutputInterface $output) {
                  try {
                      try {
                          $this->manipulateStorageConfig($storage);
                      } catch (InsufficientDataForMeaningfulAnswerException $e) {
          Severity: Minor
          Found in apps/files_external/lib/Command/Verify.php - About 55 mins 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 onReport has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function onReport($reportName, $report, $uri) {
                  $reportTargetNode = $this->server->tree->getNodeForPath($uri);
                  if (!$reportTargetNode instanceof Directory || $reportName !== self::REPORT_NAME) {
                      return;
                  }
          Severity: Minor
          Found in apps/dav/lib/Connector/Sabre/FilesReportPlugin.php - About 55 mins 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 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handleGetProperties(
                  PropFind $propFind,
                  \Sabre\DAV\INode $sabreNode
              ) {
                  if (!($sabreNode instanceof \OCA\DAV\Connector\Sabre\Node)) {
          Severity: Minor
          Found in apps/dav/lib/Connector/Sabre/SharesPlugin.php - About 55 mins 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 run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function run(IOutput $out) {
                  if (!$this->config->getSystemValue('installed', false)) {
                      // Skip the migration for new installations -> nothing to migrate
                      return;
                  }
          Severity: Minor
          Found in apps/files_external/appinfo/Migrations/Version20210511082903.php - About 55 mins 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 updateCard has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              public function updateCard(VCard $vCard, IUser $user) {
                  $uid = $user->getUID();
                  $displayName = $user->getDisplayName();
                  $displayName = empty($displayName) ? $uid : $displayName;
                  $emailAddress = $user->getEMailAddress();
          Severity: Minor
          Found in apps/dav/lib/CardDAV/Converter.php - About 55 mins 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