owncloud/core

View on GitHub

Showing 3,235 of 4,504 total issues

Manager has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Manager extends PublicEmitter implements IUserManager {
    use EventEmitterTrait;
    /** @var UserInterface[] $backends */
    private $backends = [];

Severity: Minor
Found in lib/private/User/Manager.php - About 2 hrs to fix

    Function filter has 58 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        filter: function(query) {
            // FIXME: the caller doesn't properly set the "this" context
            var self = OC.Settings.Apps;
            self._filterQuery = query;
    
    
    Severity: Major
    Found in settings/js/admin-apps.js - About 2 hrs to fix

      Method create has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function create(\OCP\Share\IShare $share) {
              $this->validate($share);
              $qb = $this->dbConn->getQueryBuilder();
      
              $qb->insert('share');
      Severity: Major
      Found in lib/private/Share20/DefaultShareProvider.php - About 2 hrs to fix

        Method getStorageInfo has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function getStorageInfo($path, $rootInfo = null) {
                // return storage info without adding mount points
                $includeExtStorage = \OC::$server->getSystemConfig()->getValue('quota_include_external_storage', false);
        
                if (!$rootInfo) {
        Severity: Major
        Found in lib/private/legacy/helper.php - About 2 hrs to fix

          Method saveColumn has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private static function saveColumn($column, $xml) {
                  $xml->addChild('name', $column->getName());
                  switch ($column->getType()) {
                      case 'SmallInt':
                      case 'Integer':
          Severity: Major
          Found in lib/private/DB/MDB2SchemaWriter.php - About 2 hrs to fix

            Method auth has 58 lines of code (exceeds 25 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: Major
            Found in lib/private/User/BasicAuthModule.php - About 2 hrs to fix

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

                  protected function configure() {
                      parent::configure();
                      $this
                          ->setName('user:setting')
                          ->setDescription('Read and modify user settings.')
              Severity: Major
              Found in core/Command/User/Setting.php - About 2 hrs to fix

                File Notifications.php has 263 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                /**
                 * @author Björn Schießle <bjoern@schiessle.org>
                 * @author Joas Schilling <coding@schilljs.com>
                 * @author Lukas Reschke <lukas@statuscode.ch>
                Severity: Minor
                Found in apps/federatedfilesharing/lib/Notifications.php - About 2 hrs to fix

                  Function RollingQueue has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var RollingQueue = function (functionList, queueWindow, callback) {
                      this.queueWindow = queueWindow || 1;
                      this.functionList = functionList;
                      this.callback = callback;
                      this.counter = 0;
                  Severity: Major
                  Found in apps/files_external/js/rollingqueue.js - About 2 hrs to fix

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

                        protected function translateLong($text, IL10N $l, array $params) {
                            switch ($text) {
                                case self::SUBJECT_REMOTE_SHARE_RECEIVED:
                                    if (\sizeof($params) > 1) {
                                        // New activity ownCloud 8.2+
                    Severity: Major
                    Found in apps/files_sharing/lib/Activity.php - About 2 hrs to fix

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

                          private function updateShareState($id, $state) {
                              $eventName = '';
                              if ($state === Share::STATE_ACCEPTED) {
                                  $eventName = 'accept';
                              } elseif ($state === Share::STATE_REJECTED) {
                      Severity: Major
                      Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 2 hrs to fix

                        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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language