owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Method getFile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function getFile($size) {
        $ext = $this->getExtension();

        $basePath = "{$this->path}/avatar.$ext";

Severity: Minor
Found in lib/private/Avatar.php - About 1 hr to fix

    Method findMigrations has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function findMigrations() {
            $directory = \realpath($this->migrationsPath);
            $iterator = new \RegexIterator(
                new \RecursiveIteratorIterator(
                    new \RecursiveDirectoryIterator($directory, \FilesystemIterator::SKIP_DOTS),
    Severity: Minor
    Found in lib/private/DB/MigrationService.php - About 1 hr to fix

      Method setValues has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function setValues($table, array $keys, array $values, array $updatePreconditionValues = []) {
              // Try to insert whole record into the table ($toInsert) if predicate NOT EXISTS ($compare) is satisfied
              $toInsert = \array_merge($keys, $values);
              $compare = \array_keys($keys);
              $tableName = $this->tablePrefix . $table;
      Severity: Minor
      Found in lib/private/DB/Connection.php - About 1 hr to fix

        Method processLines has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function processLines(array $params, array &$data) {
                static $lastProcessedChar = null;
        
                if (!isset($data['linesNumber'])) {
                    $data = [
        Severity: Minor
        Found in lib/private/Utf8Analyzer.php - About 1 hr to fix

          Method loginWithCookie has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function loginWithCookie($uid, $currentToken) {
                  $this->logger->debug(
                      'regenerating session id for uid {uid}, currentToken {currentToken}',
                      ['app' => __METHOD__, 'uid' => $uid, 'currentToken' => $currentToken]
                  );
          Severity: Minor
          Found in lib/private/User/Session.php - About 1 hr to fix

            Method getNumberOfUnreadCommentsForNodes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getNumberOfUnreadCommentsForNodes($objectType, $objectIds, IUser $user) {
                    $qbMain = $this->dbConn->getQueryBuilder();
                    $qbSup = $this->dbConn->getQueryBuilder();
            
                    $unreadCountsForNodes = [];
            Severity: Minor
            Found in lib/private/Comments/Manager.php - About 1 hr to fix

              Method getTree has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function getTree($id, $limit = 0, $offset = 0) {
                      $tree = [];
                      $tree['comment'] = $this->get($id);
                      $tree['replies'] = [];
              
              
              Severity: Minor
              Found in lib/private/Comments/Manager.php - About 1 hr to fix

                Method execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    protected function execute(InputInterface $input, OutputInterface $output): int {
                        // validate the environment
                        $server = \OC::$server;
                        $setupHelper = new Setup(
                            $this->config,
                Severity: Minor
                Found in core/Command/Maintenance/Install.php - About 1 hr to fix

                  Method execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function execute(InputInterface $input, OutputInterface $output): int {
                          $configNames = $input->getArgument('name');
                          $configName = $configNames[0];
                  
                          if (\sizeof($configNames) > 1) {
                  Severity: Minor
                  Found in core/Command/Config/System/DeleteConfig.php - About 1 hr to fix

                    Method execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        protected function execute(InputInterface $input, OutputInterface $output): int {
                            '@phan-var \OC\Files\MimetypeDetector $this->mimetypeDetector';
                            $mappings = $this->mimetypeDetector->getAllMappings();
                    
                            $totalFilecacheUpdates = 0;
                    Severity: Minor
                    Found in core/Command/Maintenance/Mimetype/UpdateDB.php - About 1 hr to fix

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

                          public function rename($path1, $path2) {
                              if (!$this->isReadable($path1)) {
                                  return false;
                              }
                              if ($this->file_exists($path2)) {
                      Severity: Major
                      Found in lib/private/Files/Storage/Wrapper/DirMask.php and 1 other location - About 1 hr to fix
                      lib/private/Files/Storage/Wrapper/DirMask.php on lines 112..126

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

                      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 2 locations. Consider refactoring.
                      Open

                          public function copy($path1, $path2) {
                              if (!$this->isReadable($path1)) {
                                  return false;
                              }
                              if ($this->file_exists($path2)) {
                      Severity: Major
                      Found in lib/private/Files/Storage/Wrapper/DirMask.php and 1 other location - About 1 hr to fix
                      lib/private/Files/Storage/Wrapper/DirMask.php on lines 96..110

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

                      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

                      Consider simplifying this complex logical expression.
                      Open

                                  if (
                                  $.inArray(keyCodes.n, keys) !== -1 && ($.inArray(keyCodes.cmdFirefox, keys) !== -1 || $.inArray(keyCodes.cmdOpera, keys) !== -1 || $.inArray(keyCodes.leftCmdWebKit, keys) !== -1 || $.inArray(keyCodes.rightCmdWebKit, keys) !== -1 || $.inArray(keyCodes.ctrl, keys) !== -1 || event.ctrlKey)) {
                                      if ($.inArray(keyCodes.shift, keys) !== -1) { //16=shift, New File
                                          newFile();
                                      } else { //New Folder
                      Severity: Major
                      Found in apps/files/js/keyboardshortcuts.js - About 1 hr to fix

                        Consider simplifying this complex logical expression.
                        Open

                                    if (
                                    $.inArray(keyCodes.n, keys) !== -1 && ($.inArray(keyCodes.cmdFirefox, keys) !== -1 || $.inArray(keyCodes.cmdOpera, keys) !== -1 || $.inArray(keyCodes.leftCmdWebKit, keys) !== -1 || $.inArray(keyCodes.rightCmdWebKit, keys) !== -1 || $.inArray(keyCodes.ctrl, keys) !== -1 || event.ctrlKey)) {
                                        preventDefault = true; //new file/folder prevent browser from responding
                                    }
                        Severity: Major
                        Found in apps/files/js/keyboardshortcuts.js - About 1 hr to fix

                          Function prompt has 8 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              prompt: function (text, title, callback, modal, name, password, buttonDeclineText, buttonConfirmText) {
                          Severity: Major
                          Found in core/js/oc-dialogs.js - About 1 hr to fix

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

                                    $appName,
                                    IRequest $request,
                                    IL10N $l10n,
                                    IConfig $config,
                                    Session $userSession,
                            Severity: Major
                            Found in settings/Controller/MailSettingsController.php - About 1 hr to fix

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

                                      $mail_domain,
                                      $mail_from_address,
                                      $mail_smtpmode,
                                      $mail_smtpsecure,
                                      $mail_smtphost,
                              Severity: Major
                              Found in settings/Controller/MailSettingsController.php - About 1 hr to fix

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

                                    public function addShare($remote, $token, $password, $name, $owner, $accepted = false, $user = null, $remoteId = -1) {
                                Severity: Major
                                Found in apps/files_sharing/lib/External/Manager.php - About 1 hr to fix

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

                                          IRootFolder $rootFolder,
                                          IUrlGenerator $urlGenerator,
                                          EventDispatcher $eventDispatcher,
                                          \OCP\Share\IManager $shareManager,
                                          NotificationPublisher $notificationPublisher,
                                  Severity: Major
                                  Found in apps/files_sharing/lib/Hooks.php - About 1 hr to fix

                                    Consider simplifying this complex logical expression.
                                    Open

                                                if ($newPermissions !== null &&
                                                    $newPermissions !== Constants::PERMISSION_READ &&
                                                    $newPermissions !== Constants::PERMISSION_CREATE &&
                                                    $newPermissions !== (Constants::PERMISSION_READ | Constants::PERMISSION_UPDATE) &&
                                                    $newPermissions !== (Constants::PERMISSION_READ | Constants::PERMISSION_CREATE) &&
                                    Severity: Major
                                    Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language