owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function renderApp has 46 lines of code (exceeds 25 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 1 hr to fix

    Function lazyLoadPreview has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            lazyLoadPreview : function(options) {
                var self = this;
                var path = options.path;
                var mime = options.mime;
                var ready = options.callback;
    Severity: Minor
    Found in apps/files/js/filelist.js - About 1 hr to fix

      Function initMouseTrack has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function initMouseTrack() {
              var interval = 120;  // 2 minutes
              if (oc_config.session_lifetime) {
                  interval = Math.floor(oc_config.session_lifetime / 2);
              }
      Severity: Minor
      Found in core/js/js.js - About 1 hr to fix

        Method translateShort has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function translateShort($text, IL10N $l, array $params) {
                switch ($text) {
                    case self::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED:
                    case self::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED:
                        return (string) $l->t('Downloaded via public link');
        Severity: Minor
        Found in apps/files_sharing/lib/Activity.php - About 1 hr to fix

          Method prepare has 46 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function prepare(INotification $notification, $languageCode) {
                  if ($notification->getApp() !== 'files_sharing') {
                      // Not my app => throw
                      throw new \InvalidArgumentException();
                  }
          Severity: Minor
          Found in apps/federatedfilesharing/lib/Notifier.php - About 1 hr to fix

            Method commentEvent has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function commentEvent(CommentsEvent $event) {
                    if ($event->getComment()->getObjectType() !== 'files'
                        || !\in_array($event->getEvent(), [CommentsEvent::EVENT_ADD])
                        || !$this->appManager->isInstalled('activity')) {
                        // Comment not for file, not adding a comment or no activity-app enabled (save the energy)
            Severity: Minor
            Found in apps/comments/lib/Activity/Listener.php - About 1 hr to fix

              Method restoreVersion has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function restoreVersion($uid, $filename, $fileToRestore, $revision) {
                      if (\OC::$server->getConfig()->getSystemValue('files_versions', Storage::DEFAULTENABLED) !== true) {
                          return false;
                      }
                      $users_view = new View('/'.$uid);
              Severity: Minor
              Found in apps/files_versions/lib/Storage.php - About 1 hr to fix

                Method get has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function get($file) {
                        if (\is_string($file) or $file == '') {
                            // normalize file
                            $file = $this->normalize($file);
                
                
                Severity: Minor
                Found in lib/private/Files/Cache/Cache.php - About 1 hr to fix

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

                      public function __construct($data = []) {
                          $factory = new InputFilterFactory();
                          $this->inputFilter = $factory->createInputFilter([
                              'file' => [
                                  'required' => true,
                  Severity: Minor
                  Found in lib/private/Share/Filters/MailNotificationFilter.php - About 1 hr to fix

                    Method generalChecks has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function generalChecks(\OCP\Share\IShare $share) {
                            if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
                                // We expect a valid user as sharedWith for user shares
                                if (!$this->userManager->userExists($share->getSharedWith())) {
                                    throw new \InvalidArgumentException('SharedWith is not a valid user');
                    Severity: Minor
                    Found in lib/private/Share20/Manager.php - About 1 hr to fix

                      Method loginWithApache has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function loginWithApache(IApacheBackend $apacheBackend) {
                              $uidAndBackend = $apacheBackend->getCurrentUserId();
                              if (\is_array($uidAndBackend)
                                  && \count($uidAndBackend) === 2
                                  && $uidAndBackend[0] !== ''
                      Severity: Minor
                      Found in lib/private/User/Session.php - About 1 hr to fix

                        Method new has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function new(?string $parent_container_id, ?string $filename): DataResponse {
                                $userAgent = $this->request->getHeader('User-Agent') ?? '-';
                                $this->logger->info("new($parent_container_id, $filename) - $userAgent");
                        
                                if ($parent_container_id === null) {
                        Severity: Minor
                        Found in core/Controller/AppRegistryController.php - About 1 hr to fix

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

                              private function checkBlackListMethod($class, $functionName, Node $node) {
                                  $name = $class . '::' . $functionName;
                                  $lowerName = \strtolower($name);
                          
                                  if (isset($this->blackListedMethods[$lowerName])) {
                          Severity: Major
                          Found in lib/private/App/CodeChecker/NodeVisitor.php and 2 other locations - About 1 hr to fix
                          lib/private/App/CodeChecker/NodeVisitor.php on lines 257..269
                          lib/private/App/CodeChecker/NodeVisitor.php on lines 271..283

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

                          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

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

                              private function checkBlackListConstant($class, $constantName, Node $node) {
                                  $name = $class . '::' . $constantName;
                                  $lowerName = \strtolower($name);
                          
                                  if (isset($this->blackListedConstants[$lowerName])) {
                          Severity: Major
                          Found in lib/private/App/CodeChecker/NodeVisitor.php and 2 other locations - About 1 hr to fix
                          lib/private/App/CodeChecker/NodeVisitor.php on lines 271..283
                          lib/private/App/CodeChecker/NodeVisitor.php on lines 285..297

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

                          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

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

                              private function checkBlackListFunction($class, $functionName, Node $node) {
                                  $name = $class . '::' . $functionName;
                                  $lowerName = \strtolower($name);
                          
                                  if (isset($this->blackListedFunctions[$lowerName])) {
                          Severity: Major
                          Found in lib/private/App/CodeChecker/NodeVisitor.php and 2 other locations - About 1 hr to fix
                          lib/private/App/CodeChecker/NodeVisitor.php on lines 257..269
                          lib/private/App/CodeChecker/NodeVisitor.php on lines 285..297

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

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

                              $.fn.ocFederationAddServer = function() {
                          
                                  /* Go easy on jquery and define some vars
                                  ========================================================================== */
                          
                          
                          Severity: Minor
                          Found in apps/federation/js/settings-admin.js - About 1 hr to fix

                            Function render has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    render: function() {
                                        var self = this;
                                        var fileActions = this._context.fileActions;
                                        var actions = fileActions.getActions(
                                            fileActions.getCurrentMimeType(),
                            Severity: Minor
                            Found in apps/files/js/fileactionsmenu.js - About 1 hr to fix

                              Function done has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  done: function() {
                                      if (!this.data.isChunked) {
                                          return $.Deferred().resolve().promise();
                                      }
                              
                              
                              Severity: Minor
                              Found in apps/files/js/file-upload.js - About 1 hr to fix

                                Method addShare has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function addShare($remote, $token, $password, $name, $owner, $accepted = false, $user = null, $remoteId = -1) {
                                        $user = $user ? $user : $this->uid;
                                        $accepted = $accepted ? 1 : 0;
                                        $name = Filesystem::normalizePath('/' . $name);
                                
                                
                                Severity: Minor
                                Found in apps/files_sharing/lib/External/Manager.php - About 1 hr to fix

                                  Method addUser has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function addUser() {
                                          $userId = isset($_POST['userid']) ? $_POST['userid'] : null;
                                          $password = isset($_POST['password']) ? $_POST['password'] : null;
                                          $groups = isset($_POST['groups']) ? $_POST['groups'] : null;
                                          $user = $this->userSession->getUser();
                                  Severity: Minor
                                  Found in apps/provisioning_api/lib/Users.php - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language