owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

    public function __construct(
        IUserManager $userManager,
        IGroupManager $groupManager,
        ILockingProvider $lockingProvider,
        IMimeTypeLoader $mimeTypeLoader,
Severity: Major
Found in apps/files/lib/Command/Scan.php and 1 other location - About 1 hr to fix
apps/files/lib/Command/TransferOwnership.php on lines 91..106

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

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 createDragShadow has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var createDragShadow = function(event) {
    // FIXME: inject file list instance somehow
    /* global FileList, Files */

    //select dragged file
Severity: Minor
Found in apps/files/js/files.js - About 1 hr to fix

    Function _updateDetailsView has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _updateDetailsView: function(fileName, show) {
                if (!this._detailsView) {
                    return;
                }
    
    
    Severity: Minor
    Found in apps/files/js/filelist.js - About 1 hr to fix

      Function addResults has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  function addResults(results) {
                      var $template = $searchResults.find('tr.template');
                      jQuery.each(results, function (i, result) {
                          var $row = $template.clone();
                          $row.removeClass('template');
      Severity: Minor
      Found in core/search/js/search.js - About 1 hr to fix

        Method sendTestMail has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function sendTestMail() {
                $email = $this->request->getParam('mail_to_address');
        
                if (empty($email)) {
                    $email = $this->userSession->getUser()->getEMailAddress();
        Severity: Minor
        Found in settings/Controller/MailSettingsController.php - About 1 hr to fix

          Method getMissingInitiator has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getMissingInitiator($n = 1000) {
                  $query = $this->connection->getQueryBuilder();
                  $query->select(['id', 'uid_owner', 'share_type'])
                      ->from($this->table)
                      ->where($query->expr()->in(
          Severity: Minor
          Found in apps/files_sharing/lib/Migration.php - About 1 hr to fix

            Method acceptShare has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function acceptShare($id) {
                    $share = $this->getShare($id);
            
                    if ($share) {
                        $mountPoint = $this->getShareRecipientMountPoint($share);
            Severity: Minor
            Found in apps/files_sharing/lib/External/Manager.php - About 1 hr to fix

              Method emitAccessShareHook has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  protected function emitAccessShareHook($share, $errorCode = 200, $errorMessage = '') {
                      $itemType = $itemSource = $uidOwner = '';
                      $token = $share;
                      $exception = null;
                      if ($share instanceof \OCP\Share\IShare) {
              Severity: Minor
              Found in apps/files_sharing/lib/Controllers/ShareController.php - About 1 hr to fix

                Method parseRetentionObligation has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function parseRetentionObligation() {
                        $splitValues = \explode(',', $this->retentionObligation);
                        if (!isset($splitValues[0])) {
                            $minValue = self::DEFAULT_RETENTION_OBLIGATION;
                        } else {
                Severity: Minor
                Found in apps/files_trashbin/lib/Expiration.php - About 1 hr to fix

                  Method createConfidentialObject has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private static function createConfidentialObject($calData) {
                          $vObject = Reader::read($calData);
                  
                          /** @var Component $vElement */
                          $vElement = null;
                  Severity: Minor
                  Found in apps/dav/lib/CalDAV/CalendarObject.php - About 1 hr to fix

                    Method unshare has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function unshare($remoteId, $shareToken) {
                            $query = $this->dbConnection->getQueryBuilder();
                            $query->select('*')->from($this->externalShareTable)
                                ->where(
                                    $query->expr()->eq(
                    Severity: Minor
                    Found in apps/federatedfilesharing/lib/FederatedShareProvider.php - About 1 hr to fix

                      Method copy has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function copy($source, $destination) {
                              if (!$this->fileView) {
                                  throw new \Sabre\DAV\Exception\ServiceUnavailable('filesystem not setup');
                              }
                      
                      
                      Severity: Minor
                      Found in apps/dav/lib/Connector/Sabre/ObjectTree.php - About 1 hr to fix

                        Method loadChildrenProperties has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            protected function loadChildrenProperties(INode $node, $requestedProperties) {
                                // note: pre-fetching only supported for depth <= 1
                                if (!($node instanceof Directory)) {
                                    return;
                                }
                        Severity: Minor
                        Found in apps/dav/lib/DAV/FileCustomPropertiesBackend.php - About 1 hr to fix

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

                              protected function translateLong($text, IL10N $l, array $params) {
                                  switch ($text) {
                                      case 'created_self':
                                          return (string) $l->t('You created %1$s', $params);
                                      case 'created_by':
                          Severity: Minor
                          Found in apps/files/lib/Activity.php - About 1 hr to fix

                            Method verifyPath has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function verifyPath($path, $fileName) {
                                    $l10n = \OC::$server->getL10N('lib');
                            
                                    // verify empty and dot files
                                    $trimmed = \trim($fileName);
                            Severity: Minor
                            Found in lib/private/Files/View.php - About 1 hr to fix

                              Method touch has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function touch($path, $mtime = null) {
                                      $this->init();
                                      if ($mtime === null) {
                                          $mtime = \OC::$server->getTimeFactory()->getTime();
                                      }
                              Severity: Minor
                              Found in lib/private/Files/Storage/DAV.php - About 1 hr to fix

                                Method getTempBaseDir has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function getTempBaseDir(): string {
                                        if ($this->tmpBaseDir) {
                                            return $this->tmpBaseDir;
                                        }
                                
                                
                                Severity: Minor
                                Found in lib/private/TempManager.php - About 1 hr to fix

                                  Method getTagsForObjects has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function getTagsForObjects(array $objIds) {
                                          $entries = [];
                                  
                                          try {
                                              $conn = \OC::$server->getDatabaseConnection();
                                  Severity: Minor
                                  Found in lib/private/Tags.php - About 1 hr to fix

                                    Method splitUserRemote has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                        public static function splitUserRemote($id) {
                                            if (\strpos($id, '@') === false) {
                                                $l = \OC::$server->getL10N('lib');
                                                $hint = $l->t('Invalid Federated Cloud ID');
                                                throw new HintException('Invalid Federated Cloud ID', $hint);
                                    Severity: Minor
                                    Found in lib/private/Share/Helper.php - About 1 hr to fix

                                      Method run has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                          public function run(IOutput $out) {
                                              $ocVersionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
                                      
                                              // NOTE TO DEVELOPERS: when adding new mime types, please make sure to
                                              // add a version comparison to avoid doing it every time
                                      Severity: Minor
                                      Found in lib/private/Repair/RepairMimeTypes.php - About 1 hr to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language