owncloud/core

View on GitHub

Showing 4,503 of 4,503 total issues

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

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $users = $input->getArgument('user_id');
        if (!empty($users)) {
            foreach ($users as $user) {
                if ($this->userManager->userExists($user)) {
Severity: Major
Found in apps/files_versions/lib/Command/CleanUp.php and 1 other location - About 1 day to fix
apps/files_trashbin/lib/Command/CleanUp.php on lines 67..99

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

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

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $users = $input->getArgument('user_id');
        if (!empty($users)) {
            foreach ($users as $user) {
                if ($this->userManager->userExists($user)) {
Severity: Major
Found in apps/files_trashbin/lib/Command/CleanUp.php and 1 other location - About 1 day to fix
apps/files_versions/lib/Command/CleanUp.php on lines 60..95

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

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

Wrapper has 58 functions (exceeds 20 allowed). Consider refactoring.
Open

class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage, IPersistentLockingStorage {
    /**
     * @var \OC\Files\Storage\Storage $storage
     */
    protected $storage;
Severity: Major
Found in lib/private/Files/Storage/Wrapper/Wrapper.php - About 1 day to fix

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

    <?php
    /**
     * @author Bart Visscher <bartv@thisnet.nl>
     * @author Björn Schießle <bjoern@schiessle.org>
     * @author Jakob Sack <mail@jakobsack.de>
    Severity: Major
    Found in apps/dav/lib/Connector/Sabre/File.php - About 1 day to fix

      Function initCore has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

      function initCore() {
          // setup tooltip
          $('.section .icon-info').tooltip({placement: 'right'});
      
          /**
      Severity: Minor
      Found in core/js/js.js - About 1 day 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

      File Common.php has 510 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
       * @author Bart Visscher <bartv@thisnet.nl>
       * @author Björn Schießle <bjoern@schiessle.org>
      Severity: Major
      Found in lib/private/Files/Storage/Common.php - About 1 day to fix

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

                while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
                    $components = [];
                    if ($row['components']) {
                        $components = \explode(',', $row['components']);
                    }
        Severity: Major
        Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 1 day to fix
        apps/dav/lib/CalDAV/CalDavBackend.php on lines 287..310

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

        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

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

                while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) {
                    $components = [];
                    if ($row['components']) {
                        $components = \explode(',', $row['components']);
                    }
        Severity: Major
        Found in apps/dav/lib/CalDAV/CalDavBackend.php and 1 other location - About 1 day to fix
        apps/dav/lib/CalDAV/CalDavBackend.php on lines 187..210

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

        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" : "Máy chủ để chia sẻ máy chủ không được kích hoạt trên máy chủ này",
            "The mountpoint name contains invalid characters." : "Tên mountpoint chứa các ký tự không hợp lệ.",
        Severity: Major
        Found in apps/files_sharing/l10n/vi.js and 1 other location - About 1 day to fix
        apps/files/l10n/lb.js on lines 1..41

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

        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",
            {
            "Unknown error" : "Et ass en onbekannte Fehler opgetrueden",
            "All files" : "All d'Fichieren",
        Severity: Major
        Found in apps/files/l10n/lb.js and 1 other location - About 1 day to fix
        apps/files_sharing/l10n/vi.js on lines 1..41

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

        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

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

            public function __construct(IRequest $request, $baseUri) {
                $this->request = $request;
                $this->baseUri = $baseUri;
                $logger = OC::$server->getLogger();
                $dispatcher = OC::$server->getEventDispatcher();
        Severity: Major
        Found in apps/dav/lib/Server.php - About 1 day to fix

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

              private static function put(
                  $itemType,
                  $itemSource,
                  $shareType,
                  $shareWith,
          Severity: Minor
          Found in lib/private/Share/Share.php - About 1 day 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 listAllApps has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
          Open

              public static function listAllApps(bool $listEveryApp = false) {
                  $installedApps = OC_App::getAllApps();
          
                  //TODO which apps do we want to blacklist and how do we integrate
                  // blacklisting with the multi apps folder feature?
          Severity: Minor
          Found in lib/private/legacy/app.php - About 1 day 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

          Share has 56 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Share extends Constants {
              /** CRUDS permissions (Create, Read, Update, Delete, Share) using a bitmask
               * Construct permissions for share() and setPermissions with Or (|) e.g.
               * Give user read and update permissions: PERMISSION_READ | PERMISSION_UPDATE
               *
          Severity: Major
          Found in lib/private/Share/Share.php - About 1 day to fix

            File fileactions.js has 499 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /*
             * Copyright (c) 2014
             *
             * This file is licensed under the Affero General Public License version 3
             * or later.
            Severity: Minor
            Found in apps/files/js/fileactions.js - About 1 day to fix

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

                  _getTemplate: function() {
                      var defer = $.Deferred();
                      if(!this.$template) {
                          var self = this;
                          $.get(OC.filePath('core', 'templates', 'tags.html'), function(tmpl) {
              Severity: Major
              Found in core/js/tags.js and 1 other location - About 7 hrs to fix
              core/js/oc-dialogs.js on lines 693..709

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

              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

                  _getFilePickerTemplate: function() {
                      var defer = $.Deferred();
                      if(!this.$filePickerTemplate) {
                          var self = this;
                          $.get(OC.filePath('core', 'templates', 'filepicker.html'), function(tmpl) {
              Severity: Major
              Found in core/js/oc-dialogs.js and 1 other location - About 7 hrs to fix
              core/js/tags.js on lines 309..325

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

              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

                  private function createCalendarChangesTable(Schema $schema) {
                      if (!$schema->hasTable("{$this->prefix}calendarchanges")) {
                          $table = $schema->createTable("{$this->prefix}calendarchanges");
                          $table->addColumn('id', 'integer', [
                              'autoincrement' => true,
              Severity: Major
              Found in apps/dav/appinfo/Migrations/Version20170116150538.php and 1 other location - About 7 hrs to fix
              apps/dav/appinfo/Migrations/Version20170116150538.php on lines 135..166

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

              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

                  private function createAddressbookChangesTable(Schema $schema) {
                      if (!$schema->hasTable("{$this->prefix}addressbookchanges")) {
                          $table = $schema->createTable("{$this->prefix}addressbookchanges");
                          $table->addColumn('id', 'integer', [
                              'autoincrement' => true,
              Severity: Major
              Found in apps/dav/appinfo/Migrations/Version20170116150538.php and 1 other location - About 7 hrs to fix
              apps/dav/appinfo/Migrations/Version20170116150538.php on lines 300..331

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

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

                  initialize: function ($el) {
                      var self = this;
                      var fileActions;
                      if (this._initialized) {
                          return;
              Severity: Major
              Found in apps/files_sharing/js/public.js - About 7 hrs to fix
                Severity
                Category
                Status
                Source
                Language