owncloud/core

View on GitHub

Showing 4,503 of 4,503 total issues

QueryBuilder has 55 functions (exceeds 20 allowed). Consider refactoring.
Open

class QueryBuilder implements IQueryBuilder {
    /** @var \OCP\IDBConnection */
    private $connection;

    /** @var \Doctrine\DBAL\Query\QueryBuilder */
Severity: Major
Found in lib/private/DB/QueryBuilder/QueryBuilder.php - About 7 hrs to fix

    OC_Util has 55 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class OC_Util {
        public static $scripts = [];
        public static $styles = [];
        public static $headers = [];
        private static $rootMounted = false;
    Severity: Major
    Found in lib/private/legacy/util.php - About 7 hrs to fix

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

              if ($minValue === 'auto' && $maxValue === 'auto') {
                  // Default: Keep for 30 days but delete anytime if space needed
                  $this->minAge = self::DEFAULT_RETENTION_OBLIGATION;
                  $this->maxAge = self::NO_OBLIGATION;
                  $this->canPurgeToSaveSpace = true;
      Severity: Major
      Found in apps/files_trashbin/lib/Expiration.php and 1 other location - About 7 hrs to fix
      apps/files_versions/lib/Expiration.php on lines 168..194

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

      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

              if ($minValue === 'auto' && $maxValue === 'auto') {
                  // Default: Delete anytime if space needed
                  $this->minAge = self::NO_OBLIGATION;
                  $this->maxAge = self::NO_OBLIGATION;
                  $this->canPurgeToSaveSpace = true;
      Severity: Major
      Found in apps/files_versions/lib/Expiration.php and 1 other location - About 7 hrs to fix
      apps/files_trashbin/lib/Expiration.php on lines 136..162

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

      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 ShareesController.php has 490 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 Roeland Jago Douma <rullzer@owncloud.com>
      Severity: Minor
      Found in apps/files_sharing/lib/Controller/ShareesController.php - About 7 hrs to fix

        Function retainVersions has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

            private static function retainVersions($filename, $owner, $ownerPath, $timestamp, $sourceStorage = null, $forceCopy = false) {
                if (\OCP\App::isEnabled('files_versions') && !empty($ownerPath)) {
                    $copyKeysResult = false;
        
                    // Temporary
        Severity: Minor
        Found in apps/files_trashbin/lib/Trashbin.php - About 7 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

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

        OC.L10N.register(
            "files_sharing",
            {
            "Server to server sharing is not enabled on this server" : "Dijeljenje resursa s poslužitelja na poslužitelj s ovog poslužitelja nije omogućeno.",
            "Shared with you" : "Podijeljeno s vama",
        Severity: Major
        Found in apps/files_sharing/l10n/hr.js and 2 other locations - About 7 hrs to fix
        apps/files/l10n/km.js on lines 1..39
        settings/l10n/ms_MY.js on lines 1..39

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

        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

        OC.L10N.register(
            "settings",
            {
            "Authentication error" : "Ralat pengesahan",
            "Create" : "Buat",
        Severity: Major
        Found in settings/l10n/ms_MY.js and 2 other locations - About 7 hrs to fix
        apps/files/l10n/km.js on lines 1..39
        apps/files_sharing/l10n/hr.js on lines 1..39

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

        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

        OC.L10N.register(
            "files",
            {
            "Unknown error" : "មិន​ស្គាល់​កំហុស",
            "Close" : "បិទ",
        Severity: Major
        Found in apps/files/l10n/km.js and 2 other locations - About 7 hrs to fix
        apps/files_sharing/l10n/hr.js on lines 1..39
        settings/l10n/ms_MY.js on lines 1..39

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

        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 loadField has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
        Open

            private function loadField($table, $xml) {
                $options = ['notnull' => false];
                $primary = null;
                foreach ($xml->children() as $child) {
                    /**
        Severity: Minor
        Found in lib/private/DB/MDB2SchemaReader.php - About 7 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

        Method checkServer has 189 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public static function checkServer(\OCP\IConfig $config) {
                $l = \OC::$server->getL10N('lib');
                $errors = [];
                $CONFIG_DATADIRECTORY = $config->getSystemValue('datadirectory', OC::$SERVERROOT . '/data');
        
        
        Severity: Major
        Found in lib/private/legacy/util.php - About 7 hrs to fix

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

                  if ($syncToken) {
                      $query = 'SELECT `uri`, `operation` FROM `*PREFIX*calendarchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `calendarid` = ? ORDER BY `synctoken`';
          
                      // Fetching all changes
                      $stmt = $this->db->prepare($query, $limit ?: null, $limit ? 0 : null);
          Severity: Major
          Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 7 hrs to fix
          apps/dav/lib/CardDAV/CardDavBackend.php on lines 732..767

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

          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

                  if ($syncToken) {
                      $query = 'SELECT `uri`, `operation` FROM `*PREFIX*addressbookchanges` WHERE `synctoken` >= ? AND `synctoken` < ? AND `addressbookid` = ? ORDER BY `synctoken`';
          
                      // Fetching all changes
                      $stmt = $this->db->prepare($query, $limit ?: null, $limit ? 0 : null);
          Severity: Major
          Found in apps/dav/lib/CardDAV/CardDavBackend.php and 1 other location - About 7 hrs to fix
          apps/dav/lib/CalDAV/CalDavBackend.php on lines 1144..1179

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

          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 updateShare has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

              public function updateShare($id) {
                  if (!$this->shareManager->shareApiEnabled()) {
                      return new Result(null, 404, $this->l->t('Share API is disabled'));
                  }
          
          
          Severity: Minor
          Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 7 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 getAllStorages has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

              public function getAllStorages() {
                  $mountPoints = $this->readLegacyConfig();
                  /**
                   * Here is the how the horribly messy mount point array looks like
                   * from the mount.json file:
          Severity: Minor
          Found in lib/private/Files/External/Service/LegacyStoragesService.php - About 7 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

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

          OC.L10N.register(
              "files",
              {
              "Unknown error" : "უცნობი შეცდომა",
              "Close" : "დახურვა",
          Severity: Major
          Found in apps/files/l10n/ka_GE.js and 1 other location - About 7 hrs to fix
          apps/files_sharing/l10n/bn_BD.js on lines 1..38

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

          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

          OC.L10N.register(
              "files_sharing",
              {
              "Server to server sharing is not enabled on this server" : "এই সার্ভারে সার্ভার হতে সার্ভারে ভাগাভাগি কার্যকর নয়",
              "Shared with you" : "আপনার সাথে ভাগাভাগি করেছেন",
          Severity: Major
          Found in apps/files_sharing/l10n/bn_BD.js and 1 other location - About 7 hrs to fix
          apps/files/l10n/ka_GE.js on lines 1..38

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

          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 Manager.php has 474 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          /**
           * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
           * @author Joas Schilling <coding@schilljs.com>
           * @author Thomas Müller <thomas.mueller@tmit.eu>
          Severity: Minor
          Found in lib/private/Comments/Manager.php - About 7 hrs to fix

            Function put has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
            Open

                public function put($data) {
                    try {
                        $exists = $this->fileView->file_exists($this->path);
                        if ($this->info && $exists && !$this->info->isUpdateable()) {
                            throw new Forbidden();
            Severity: Minor
            Found in apps/dav/lib/Connector/Sabre/File.php - About 7 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 create has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
            Open

                private function create() {
                    $isConnectionParametersSupported = $this->isConnectionParametersSupported();
            
                    if ($config = $this->config->getValue('redis.cluster', [])) {
                        if (!\class_exists('RedisCluster')) {
            Severity: Minor
            Found in lib/private/RedisFactory.php - About 7 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