owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Method formatItems has 57 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function formatItems($items, $format, $parameters = null) {
        if ($format == self::FORMAT_SHARED_STORAGE) {
            // Only 1 item should come through for this format call
            $item = \array_shift($items);
            return [
Severity: Major
Found in apps/files_sharing/lib/ShareBackend/File.php - About 2 hrs to fix

    Method restoreVersionsFromTrashbin has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private static function restoreVersionsFromTrashbin(View $view, $filename, $targetLocation) {
            if (\OCP\App::isEnabled('files_versions')) {
                $user = User::getUser();
                $rootView = new View('/');
    
    
    Severity: Major
    Found in apps/files_trashbin/lib/Trashbin.php - About 2 hrs to fix

      Method createCalendarSubscriptionsTable has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function createCalendarSubscriptionsTable(Schema $schema) {
              if (!$schema->hasTable("{$this->prefix}calendarsubscriptions")) {
                  $table = $schema->createTable("{$this->prefix}calendarsubscriptions");
                  $table->addColumn('id', 'integer', [
                      'autoincrement' => true,
      Severity: Major
      Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 2 hrs to fix

        Method updateTag has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function updateTag($tagId, $tagName, $userVisible, $userAssignable, $userEditable = null) {
                $userVisible = (int)$userVisible;
                $userAssignable = (int)$userAssignable;
        
                /**
        Severity: Major
        Found in lib/private/SystemTag/SystemTagManager.php - About 2 hrs to fix

          Method transferShare has 57 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function transferShare(IShare $share, $oldOwner, $newOwner, $finalTarget, $isChild = null) {
                  if ($this->userManager->get($oldOwner) === null) {
                      throw new TransferSharesException("The current owner of the share $oldOwner doesn't exist");
                  }
                  if ($this->userManager->get($newOwner) === null) {
          Severity: Major
          Found in lib/private/Share20/Manager.php - About 2 hrs to fix

            Method afterException has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function afterException($controller, $methodName, \Exception $exception) {
                    $headers = [];
                    if ($controller instanceof OCSController) {
                        if ($this->request->getHeader('OC-RequestAppPassword') === 'true'
                                && ($exception instanceof NotLoggedInException || $exception instanceof LoginException)) {
            Severity: Major
            Found in lib/private/AppFramework/Middleware/Security/SecurityMiddleware.php - About 2 hrs to fix

              Method copyTable has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, InputInterface $input, OutputInterface $output) {
                      $tableName = $table->getName();
                      $chunkSize = $input->getOption('chunk-size');
              
                      $progress = new ProgressBar($output);
              Severity: Major
              Found in core/Command/Db/ConvertType.php - About 2 hrs to fix

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

                    renderApp: function(app, template, selector, firstExperimental) {
                        if (!template) {
                            var source   = $("#app-template").html();
                            template = Handlebars.compile(source);
                        }
                Severity: Minor
                Found in settings/js/admin-apps.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 markFileAsShared has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                    markFileAsShared: function($tr, hasShares, hasLink) {
                        var action = $tr.find('.fileactions .action[data-action="Share"]');
                        var type = $tr.data('type');
                        var icon = action.find('.icon');
                        var message;
                Severity: Minor
                Found in core/js/share.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

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

                        $appName,
                        IRequest $request,
                        IUserManager $userManager,
                        IGroupManager $groupManager,
                        Session $userSession,
                Severity: Major
                Found in settings/Controller/UsersController.php - About 2 hrs to fix

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

                      private function isUsedTlsLibOutdated(): string {
                          // Don't run check when:
                          // 1. Server has `has_internet_connection` set to false
                          // 2. App Store AND S2S is disabled
                          if (!$this->config->getSystemValue('has_internet_connection', true)) {
                  Severity: Minor
                  Found in settings/Controller/CheckSetupController.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 eatOldLicense has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function eatOldLicense($source) {
                          $lines = \explode(PHP_EOL, $source);
                          while (!empty($lines)) {
                              $line = $lines[0];
                              if (\strpos($line, '<?php') !== false) {
                  Severity: Minor
                  Found in build/license.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 getShareFolder has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function getShareFolder($view = null) {
                          if ($view === null) {
                              $view = Filesystem::getView();
                          }
                          // for guests we default to root as their home storage is read-only
                  Severity: Minor
                  Found in apps/files_sharing/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 deleteVersions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private static function deleteVersions(View $view, $file, $user) {
                          $size = 0;
                          if (\OCP\App::isEnabled('files_versions')) {
                              if ($view->is_dir('files_trashbin/versions/' . $file)) {
                                  $size += self::calculateSize(new View('/' . $user . '/files_trashbin/versions/' . $file));
                  Severity: Minor
                  Found in apps/files_trashbin/lib/Trashbin.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 tryHttpPostToShareEndpoint has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function tryHttpPostToShareEndpoint($remoteDomain, $urlSuffix, array $fields, $useOcm = false) {
                          $client = $this->httpClientService->newClient();
                          $protocol = 'https://';
                          $result = [
                              'success' => false,
                  Severity: Minor
                  Found in apps/federatedfilesharing/lib/Notifications.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 httpGet has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function httpGet(RequestInterface $request, ResponseInterface $response) {
                          $queryParams = $request->getQueryParameters();
                          if (!\array_key_exists('preview', $queryParams)) {
                              return true;
                          }
                  Severity: Minor
                  Found in apps/dav/lib/Files/PreviewPlugin.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 validateUserPass has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function validateUserPass($username, $password) {
                          try {
                              $share = $this->shareManager->getShareByToken($username);
                          } catch (ShareNotFound $e) {
                              \OC::$server->getLogger()->error("PublicAuth: share for found $username");
                  Severity: Minor
                  Found in apps/dav/lib/Connector/PublicAuth.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 xmlSerialize has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function xmlSerialize(Writer $writer) {
                          $cs = '{' . Plugin::NS_OWNCLOUD . '}';
                  
                          if ($this->organizer !== null) {
                              $writer->startElement($cs . 'organizer');
                  Severity: Minor
                  Found in apps/dav/lib/DAV/Sharing/Xml/Invite.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 {
                          $mountId = $input->getArgument('mount_id');
                          try {
                              $mount = $this->globalService->getStorage($mountId);
                          } catch (NotFoundException $e) {
                  Severity: Minor
                  Found in apps/files_external/lib/Command/Applicable.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 {
                          $user = $input->getOption('user');
                          $mountPoint = $input->getArgument('mount_point');
                          $storageIdentifier = $input->getArgument('storage_backend');
                          $authIdentifier = $input->getArgument('authentication_backend');
                  Severity: Minor
                  Found in apps/files_external/lib/Command/Create.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