owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function getVersions has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getVersions($uid, $filename) {
        $versions = [];
        if ($filename === null || $filename === '') {
            return $versions;
        }
Severity: Minor
Found in apps/files_versions/lib/Storage.php - About 3 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 rename has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function rename($path1, $path2) {
        $file = $this->getDriveFile($path1);
        if ($file) {
            $newFile = $this->getDriveFile($path2);
            $toUpdate = new DriveFile();
Severity: Minor
Found in apps/files_external/lib/Lib/Storage/Google.php - About 3 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 rename has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function rename($path1, $path2) {
        $renameOk = false;
        $copyKeysOk = true;  // assume keys are copied, in case we deal with versions

        $isVersion = $this->isVersion($path2) || $this->isVersion($path1);
Severity: Minor
Found in lib/private/Files/Storage/Wrapper/Encryption.php - About 3 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 generateHashes has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    private function generateHashes(
        \RecursiveIteratorIterator $iterator,
        $path
    ) {
        $hashes = [];
Severity: Minor
Found in lib/private/IntegrityCheck/Checker.php - About 3 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 getSharedWith has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function getSharedWith($userId, $shareType, $node = null, $limit = 50, $offset = 0) {
        $provider = $this->factory->getProviderForType($shareType);

        $shares = $provider->getSharedWith($userId, $shareType, $node, $limit, $offset);

Severity: Minor
Found in lib/private/Share20/Manager.php - About 3 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 getDefaultPageUrl has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getDefaultPageUrl() {
        $urlGenerator = \OC::$server->getURLGenerator();
        // Deny the redirect if the URL contains a @
        // This prevents unvalidated redirects like ?redirect_url=:user@domain.com
        if (isset($_REQUEST['redirect_url']) && \strpos($_REQUEST['redirect_url'], '@') === false) {
Severity: Minor
Found in lib/private/legacy/util.php - About 3 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 lock has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function lock($storageId, $internalPath, $fileId, array $lockInfo) {
        if ($fileId <= 0) {
            throw new \InvalidArgumentException('Invalid file id');
        }
        if (!isset($lockInfo['token'])) {
Severity: Minor
Found in lib/private/Lock/Persistent/LockManager.php - About 3 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 _chunkedUpload has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        _chunkedUpload: function (options, testOnly) {
            options.uploadedBytes = options.uploadedBytes || 0;
            var that = this,
                file = options.files[0],
                fs = file.size,
Severity: Major
Found in apps/files/js/jquery.fileupload.js - About 3 hrs to fix

    Method registerListeners has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function registerListeners() {
            $this->eventDispatcher->addListener(
                'files.resolvePrivateLink',
                function (GenericEvent $event) {
                    $uid = $event->getArgument('uid');
    Severity: Major
    Found in apps/files_sharing/lib/Hooks.php - About 3 hrs to fix

      Method editUser has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function editUser($parameters) {
              /** @var string $targetUserId */
              $targetUserId = $parameters['userid'];
      
              // Check if user is logged in
      Severity: Major
      Found in apps/provisioning_api/lib/Users.php - About 3 hrs to fix

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

        <?php
        /**
         * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
         * @author Bart Visscher <bartv@thisnet.nl>
         * @author Brice Maron <brice@bmaron.net>
        Severity: Minor
        Found in lib/private/Installer.php - About 3 hrs to fix

          File uk.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          OC.L10N.register(
              "core",
              {
              "Please select a file." : "Будь ласка, оберіть файл.",
              "File is too big" : "Файл занадто великий",
          Severity: Minor
          Found in core/l10n/uk.js - About 3 hrs to fix

            File da.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            OC.L10N.register(
                "core",
                {
                "Please select a file." : "Vælg fil",
                "File is too big" : "Filen er for stor",
            Severity: Minor
            Found in core/l10n/da.js - About 3 hrs to fix

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

                  protected function execute(InputInterface $input, OutputInterface $output): int {
                      $username = $input->getArgument('user');
                      $emailLink = $input->getOption('send-email');
                      $displayLink = $input->getOption('output-link');
              
              
              Severity: Major
              Found in core/Command/User/ResetPassword.php - About 3 hrs to fix

                UserList has 29 functions (exceeds 20 allowed). Consider refactoring.
                Open

                var UserList = {
                    availableGroups: {},
                    offset: 0,
                    usersToLoad: 200,
                    initialUsersToLoad: 200, // initial number of users to load
                Severity: Minor
                Found in settings/js/users/users.js - About 3 hrs to fix

                  StorageConfig has 29 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class StorageConfig implements IStorageConfig {
                      /**
                       * Storage config id
                       *
                       * @var int
                  Severity: Minor
                  Found in lib/private/Files/External/StorageConfig.php - About 3 hrs to fix

                    Connection has 29 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class Connection extends \Doctrine\DBAL\Connection implements IDBConnection {
                        /**
                         * @var string $tablePrefix
                         */
                        protected $tablePrefix;
                    Severity: Minor
                    Found in lib/private/DB/Connection.php - About 3 hrs to fix

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

                          attach: function (targetName, targetObject, options) {
                              var plugins = this.getPlugins(targetName);
                              plugins = this.sortPluginsByPriority(plugins);
                              for (var i = 0; i < plugins.length; i++) {
                                  var plugin = plugins[i].plugin;
                      Severity: Major
                      Found in core/js/js.js and 1 other location - About 3 hrs to fix
                      core/js/js.js on lines 947..956

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

                      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

                          detach: function (targetName, targetObject, options) {
                              var plugins = this.getPlugins(targetName);
                              plugins = this.sortPluginsByPriority(plugins);
                              for (var i = 0; i < plugins.length; i++) {
                                  var plugin = plugins[i].plugin;
                      Severity: Major
                      Found in core/js/js.js and 1 other location - About 3 hrs to fix
                      core/js/js.js on lines 929..938

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

                      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 setUserConfig() {
                              $acceptedKeys = [];
                              $rejectedKeys = [];
                      
                              $params = $this->getUserRequestParams();
                      apps/files_sharing/lib/Controller/PersonalSettingsController.php on lines 55..81

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language