owncloud/core

View on GitHub

Showing 4,503 of 4,503 total issues

Method createShare has 181 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function createShare() {
        $share = $this->shareManager->newShare();

        if (!$this->shareManager->shareApiEnabled()) {
            return new Result(null, 404, $this->l->t('Share API is disabled'));
Severity: Major
Found in apps/files_sharing/lib/Controller/Share20OcsController.php - About 7 hrs to fix

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

        protected function execute(InputInterface $input, OutputInterface $output): int {
            if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL
                && !$input->hasParameterOption('--verbose=0', true)) {
                // set to more verbose on upgrade if no explicit verbosity was set
                $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
    Severity: Major
    Found in core/Command/Upgrade.php - About 7 hrs to fix

      File statusmanager.js has 466 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       * ownCloud
       *
       * @author Juan Pablo Villafañez Ramos <jvillafanez@owncloud.com>
       * @author Jesus Macias Portela <jesus@owncloud.com>
      Severity: Minor
      Found in apps/files_external/js/statusmanager.js - About 7 hrs to fix

        Util has 51 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Util {
            // consts for Logging
            public const DEBUG=0;
            public const INFO=1;
            public const WARN=2;
        Severity: Major
        Found in lib/public/Util.php - About 7 hrs to fix

          Method init has 179 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public static function init() {
                  // calculate the root directories
                  OC::$SERVERROOT = \str_replace("\\", '/', \substr(__DIR__, 0, -4));
          
                  // register autoloader
          Severity: Major
          Found in lib/kernel.php - About 7 hrs to fix

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

            <?php
            /**
             * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
             * @author Joas Schilling <coding@schilljs.com>
             * @author Lukas Reschke <lukas@statuscode.ch>
            Severity: Minor
            Found in apps/provisioning_api/lib/Users.php - About 7 hrs to fix

              Function create has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function create($username, $password, array $groups= [], $email='') {
                      $resp = $this->validateString($username, 255);
                      if ($resp) {
                          return $resp;
                      }
              Severity: Minor
              Found in settings/Controller/UsersController.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 getRemote has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
              Open

                  protected function getRemote($search) {
                      $this->result['remotes'] = $this->result['exact']['remotes'] = $users = [];
              
                      if (\strlen(\trim($search)) === 0 && $this->userSearch->getSearchMinLength() > 0) {
                          $this->result['remotes'] = [];
              Severity: Minor
              Found in apps/files_sharing/lib/Controller/ShareesController.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 expire has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function expire($filename, $uid) {
                      $config = \OC::$server->getConfig();
                      $expiration = self::getExpiration();
              
                      if ($config->getSystemValue('files_versions', Storage::DEFAULTENABLED)=='true' && $expiration->isEnabled()) {
              Severity: Minor
              Found in apps/files_versions/lib/Storage.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 enterNode has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function enterNode(Node $node) {
                      if ($this->checkEqualOperatorUsage && $node instanceof Node\Expr\BinaryOp\Equal) {
                          $this->errors[]= [
                              'disallowedToken' => '==',
                              'errorCode' => CodeChecker::OP_OPERATOR_USAGE_DISCOURAGED,
              Severity: Minor
              Found in lib/private/App/CodeChecker/NodeVisitor.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

                  protected function execute(InputInterface $input, OutputInterface $output): int {
                      $maxAge = $this->expiration->getMaxAgeAsTimestamp();
                      if (!$maxAge) {
                          $output->writeln("Auto expiration is configured - expiration will be handled automatically.");
                          return 1;
              Severity: Major
              Found in apps/files_versions/lib/Command/ExpireVersions.php and 1 other location - About 7 hrs to fix
              apps/files_trashbin/lib/Command/ExpireTrash.php on lines 70..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 224.

              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 {
                      $retentionEnabled = $this->trashExpiryManager->retentionEnabled();
                      if (!$retentionEnabled) {
                          $output->writeln("Auto expiration is configured - expiration will be handled automatically.");
                          return 1;
              Severity: Major
              Found in apps/files_trashbin/lib/Command/ExpireTrash.php and 1 other location - About 7 hrs to fix
              apps/files_versions/lib/Command/ExpireVersions.php on lines 71..100

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

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

                  public function changeSchema(Schema $schema, array $options) {
                      $prefix = $options['tablePrefix'];
              
                      if (!$schema->hasTable("{$prefix}authtoken")) {
                          $authTokenTable = $schema->createTable("{$prefix}authtoken");
              Severity: Major
              Found in core/Migrations/Version20170101215145.php - About 6 hrs to fix

                Function initialize has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                Open

                    initialize: function ($el) {
                        var self = this;
                        var fileActions;
                        if (this._initialized) {
                            return;
                Severity: Minor
                Found in apps/files_sharing/js/public.js - About 6 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 setPermissions has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                Open

                    public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) {
                        $l = \OC::$server->getL10N('lib');
                        $connection = \OC::$server->getDatabaseConnection();
                
                        $intArrayToLiteralArray = function ($intArray, $eb) {
                Severity: Minor
                Found in lib/private/Share/Share.php - About 6 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 execute has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected function execute(InputInterface $input, OutputInterface $output): int {
                        if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL
                            && !$input->hasParameterOption('--verbose=0', true)) {
                            // set to more verbose on upgrade if no explicit verbosity was set
                            $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
                Severity: Minor
                Found in core/Command/Upgrade.php - About 6 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 20 locations. Consider refactoring.
                Open

                OC.L10N.register(
                    "federatedfilesharing",
                    {
                    "Federated sharing" : "연합 공유",
                    "Add to" : "다음에 추가",
                Severity: Major
                Found in apps/federatedfilesharing/l10n/ko.js and 19 other locations - About 6 hrs to fix
                apps/federatedfilesharing/l10n/bg_BG.js on lines 1..36
                apps/federatedfilesharing/l10n/de.js on lines 1..36
                apps/federatedfilesharing/l10n/de_DE.js on lines 1..36
                apps/federatedfilesharing/l10n/el.js on lines 1..36
                apps/federatedfilesharing/l10n/en_GB.js on lines 1..36
                apps/federatedfilesharing/l10n/es.js on lines 1..36
                apps/federatedfilesharing/l10n/fr.js on lines 1..36
                apps/federatedfilesharing/l10n/it.js on lines 1..36
                apps/federatedfilesharing/l10n/pt_BR.js on lines 1..36
                apps/federatedfilesharing/l10n/ru.js on lines 1..36
                apps/federatedfilesharing/l10n/ru_RU.js on lines 1..36
                apps/federatedfilesharing/l10n/sq.js on lines 1..36
                apps/federatedfilesharing/l10n/th_TH.js on lines 1..36
                apps/federatedfilesharing/l10n/tr.js on lines 1..36
                apps/federatedfilesharing/l10n/ug.js on lines 1..36
                apps/federatedfilesharing/l10n/zh_CN.js on lines 1..36
                apps/federatedfilesharing/l10n/zh_TW.js on lines 1..36
                apps/files_external/l10n/lv.js on lines 1..36
                lib/l10n/ug.js on lines 1..36

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

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

                OC.L10N.register(
                    "federatedfilesharing",
                    {
                    "Federated sharing" : "聯合分享",
                    "Add to" : "增加到",
                Severity: Major
                Found in apps/federatedfilesharing/l10n/zh_TW.js and 19 other locations - About 6 hrs to fix
                apps/federatedfilesharing/l10n/bg_BG.js on lines 1..36
                apps/federatedfilesharing/l10n/de.js on lines 1..36
                apps/federatedfilesharing/l10n/de_DE.js on lines 1..36
                apps/federatedfilesharing/l10n/el.js on lines 1..36
                apps/federatedfilesharing/l10n/en_GB.js on lines 1..36
                apps/federatedfilesharing/l10n/es.js on lines 1..36
                apps/federatedfilesharing/l10n/fr.js on lines 1..36
                apps/federatedfilesharing/l10n/it.js on lines 1..36
                apps/federatedfilesharing/l10n/ko.js on lines 1..36
                apps/federatedfilesharing/l10n/pt_BR.js on lines 1..36
                apps/federatedfilesharing/l10n/ru.js on lines 1..36
                apps/federatedfilesharing/l10n/ru_RU.js on lines 1..36
                apps/federatedfilesharing/l10n/sq.js on lines 1..36
                apps/federatedfilesharing/l10n/th_TH.js on lines 1..36
                apps/federatedfilesharing/l10n/tr.js on lines 1..36
                apps/federatedfilesharing/l10n/ug.js on lines 1..36
                apps/federatedfilesharing/l10n/zh_CN.js on lines 1..36
                apps/files_external/l10n/lv.js on lines 1..36
                lib/l10n/ug.js on lines 1..36

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

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

                OC.L10N.register(
                    "federatedfilesharing",
                    {
                    "Federated sharing" : "แบ่งปันกับสหพันธ์",
                    "Add to" : "เพิ่มไปยัง",
                Severity: Major
                Found in apps/federatedfilesharing/l10n/th_TH.js and 19 other locations - About 6 hrs to fix
                apps/federatedfilesharing/l10n/bg_BG.js on lines 1..36
                apps/federatedfilesharing/l10n/de.js on lines 1..36
                apps/federatedfilesharing/l10n/de_DE.js on lines 1..36
                apps/federatedfilesharing/l10n/el.js on lines 1..36
                apps/federatedfilesharing/l10n/en_GB.js on lines 1..36
                apps/federatedfilesharing/l10n/es.js on lines 1..36
                apps/federatedfilesharing/l10n/fr.js on lines 1..36
                apps/federatedfilesharing/l10n/it.js on lines 1..36
                apps/federatedfilesharing/l10n/ko.js on lines 1..36
                apps/federatedfilesharing/l10n/pt_BR.js on lines 1..36
                apps/federatedfilesharing/l10n/ru.js on lines 1..36
                apps/federatedfilesharing/l10n/ru_RU.js on lines 1..36
                apps/federatedfilesharing/l10n/sq.js on lines 1..36
                apps/federatedfilesharing/l10n/tr.js on lines 1..36
                apps/federatedfilesharing/l10n/ug.js on lines 1..36
                apps/federatedfilesharing/l10n/zh_CN.js on lines 1..36
                apps/federatedfilesharing/l10n/zh_TW.js on lines 1..36
                apps/files_external/l10n/lv.js on lines 1..36
                lib/l10n/ug.js on lines 1..36

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

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

                OC.L10N.register(
                    "files_external",
                    {
                    "Step 1 failed. Exception: %s" : "Pirmais solis neizdevās. Izņēmums: %s",
                    "Step 2 failed. Exception: %s" : "Otrais solis neizdevās. Izņēmums: %s",
                Severity: Major
                Found in apps/files_external/l10n/lv.js and 19 other locations - About 6 hrs to fix
                apps/federatedfilesharing/l10n/bg_BG.js on lines 1..36
                apps/federatedfilesharing/l10n/de.js on lines 1..36
                apps/federatedfilesharing/l10n/de_DE.js on lines 1..36
                apps/federatedfilesharing/l10n/el.js on lines 1..36
                apps/federatedfilesharing/l10n/en_GB.js on lines 1..36
                apps/federatedfilesharing/l10n/es.js on lines 1..36
                apps/federatedfilesharing/l10n/fr.js on lines 1..36
                apps/federatedfilesharing/l10n/it.js on lines 1..36
                apps/federatedfilesharing/l10n/ko.js on lines 1..36
                apps/federatedfilesharing/l10n/pt_BR.js on lines 1..36
                apps/federatedfilesharing/l10n/ru.js on lines 1..36
                apps/federatedfilesharing/l10n/ru_RU.js on lines 1..36
                apps/federatedfilesharing/l10n/sq.js on lines 1..36
                apps/federatedfilesharing/l10n/th_TH.js on lines 1..36
                apps/federatedfilesharing/l10n/tr.js on lines 1..36
                apps/federatedfilesharing/l10n/ug.js on lines 1..36
                apps/federatedfilesharing/l10n/zh_CN.js on lines 1..36
                apps/federatedfilesharing/l10n/zh_TW.js on lines 1..36
                lib/l10n/ug.js on lines 1..36

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

                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