owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Method createCalendarsTable has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

    Method httpGet has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function httpGet(RequestInterface $request, ResponseInterface $response) {
            $queryParams = $request->getQueryParameters();
            if (!\array_key_exists('preview', $queryParams)) {
                return true;
            }
    Severity: Major
    Found in apps/dav/lib/Files/PreviewPlugin.php - About 2 hrs to fix

      Method fopen has 55 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function fopen($path, $mode) {
              $pos = \strrpos($path, '.');
              if ($pos !== false) {
                  $ext = \substr($path, $pos);
              } else {
      Severity: Major
      Found in apps/files_external/lib/Lib/Storage/Google.php - About 2 hrs to fix

        Method findInvalidShareOwner has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function findInvalidShareOwner(InputInterface $input, OutputInterface $output, $fix, $scopeUid) {
                $output->writeln([
                    "<info>==========================</info>",
                    "<info>Searching for shares that have invalid uid_owner, meaning share uid_owner that does not match associated file storage id.</info>",
                    "<info>==========================</info>",
        Severity: Major
        Found in apps/files/lib/Command/TroubleshootTransferOwnership.php - About 2 hrs to fix

          Method getFileInfo has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function getFileInfo($path, $includeMountPoints = true) {
                  $this->assertPathLength($path);
                  if (!Filesystem::isValidPath($path)) {
                      return false;
                  }
          Severity: Major
          Found in lib/private/Files/View.php - About 2 hrs to fix

            Method updateForRecipient has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function updateForRecipient(\OCP\Share\IShare $share, $recipient) {
                    if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) {
                        if ($share->getSharedWith() !== $recipient) {
                            throw new ProviderException('Recipient does not match');
                        }
            Severity: Major
            Found in lib/private/Share20/DefaultShareProvider.php - About 2 hrs to fix

              Method getAllowedCorsHeaders has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static function getAllowedCorsHeaders(\OCP\IConfig $config = null) {
                      if ($config === null) {
                          $config = \OC::$server->getConfig();
                      }
                      $allowedDefaultHeaders = [
              Severity: Major
              Found in lib/private/legacy/response.php - About 2 hrs to fix

                Method loadRoutes has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function loadRoutes($app = null) {
                        if (\is_string($app)) {
                            $app = \OC_App::cleanAppId($app);
                        }
                
                
                Severity: Major
                Found in lib/private/Route/Router.php - About 2 hrs to fix

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

                      protected function configure() {
                          $this
                              ->setName('db:convert-type')
                              ->setDescription('Convert the ownCloud database to the newly configured one. This feature is currently experimental.')
                              ->addArgument(
                  Severity: Major
                  Found in core/Command/Db/ConvertType.php - About 2 hrs to fix

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

                        $.get(OC.generateUrl(
                            '/avatar/{user}/{size}',
                            {user: OC.currentUser, size: 1}
                        ), function (result) {
                            if (typeof(result) === 'string') {
                    Severity: Major
                    Found in settings/js/panels/profile.js and 1 other location - About 2 hrs to fix
                    settings/js/panels/profile.js on lines 325..333

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

                    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

                        $.get(OC.generateUrl(
                            '/avatar/{user}/{size}',
                            {user: OC.currentUser, size: 1}
                        ), function (result) {
                            if (typeof(result) === 'string') {
                    Severity: Major
                    Found in settings/js/panels/profile.js and 1 other location - About 2 hrs to fix
                    settings/js/panels/profile.js on lines 69..77

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

                    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

                    File JobList.php has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    /**
                     * @author Joas Schilling <coding@schilljs.com>
                     * @author Morris Jobke <hey@morrisjobke.de>
                     * @author Robin Appelman <icewind@owncloud.com>
                    Severity: Minor
                    Found in lib/private/BackgroundJob/JobList.php - About 2 hrs to fix

                      Storage has 21 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class Storage extends DAV implements ISharedStorage {
                          /** @var string */
                          private $remoteUser;
                          /** @var string */
                          private $remote;
                      Severity: Minor
                      Found in apps/files_sharing/lib/External/Storage.php - About 2 hrs to fix

                        Share20OcsController has 21 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class Share20OcsController extends OCSController {
                            /** @var IManager */
                            private $shareManager;
                            /** @var IGroupManager */
                            private $groupManager;
                        Severity: Minor
                        Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 2 hrs to fix

                          Calendar has 21 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Calendar extends \Sabre\CalDAV\Calendar implements IShareable {
                              public function __construct(BackendInterface $caldavBackend, $calendarInfo, IL10N $l10n) {
                                  parent::__construct($caldavBackend, $calendarInfo);
                          
                                  if ($this->getName() === BirthdayService::BIRTHDAY_CALENDAR_URI) {
                          Severity: Minor
                          Found in apps/dav/lib/CalDAV/Calendar.php - About 2 hrs to fix

                            Checker has 21 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class Checker {
                                public const CACHE_KEY = 'oc.integritycheck.checker';
                                /** @var EnvironmentHelper */
                                private $environmentHelper;
                                /** @var AppLocator */
                            Severity: Minor
                            Found in lib/private/IntegrityCheck/Checker.php - About 2 hrs to fix

                              Storage has 21 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Storage implements IStorage {
                                  // hidden file which indicate that the folder is a valid key storage
                                  public const KEY_STORAGE_MARKER = '.oc_key_storage';
                              
                                  /** @var View */
                              Severity: Minor
                              Found in lib/private/Encryption/Keys/Storage.php - About 2 hrs to fix

                                OC_Defaults has 21 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class OC_Defaults {
                                    private $theme;
                                    private $l;
                                
                                    private $defaultEntity;
                                Severity: Minor
                                Found in lib/private/legacy/defaults.php - About 2 hrs to fix

                                  Function move has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          move: function(fileNames, targetPath) {
                                              var self = this;
                                              var dir = this.getCurrentDirectory();
                                              if (dir.charAt(dir.length - 1) !== '/') {
                                                  dir += '/';
                                  Severity: Major
                                  Found in apps/files/js/filelist.js - About 2 hrs to fix

                                    Function _handleUpdateShareAttributes has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                            _handleUpdateShareAttributes: function(shareId, properties, options) {
                                                var shareAttributesV1 = [];
                                                var filteredAttributes = [];
                                                var filteredRegisteredAttributes = this._filterRegisteredAttributes(properties.permissions);
                                                _.map(filteredRegisteredAttributes, function(filteredRegisteredAttribute) {
                                    Severity: Major
                                    Found in core/js/shareitemmodel.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language