owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

<?php
/**
 * @author Viktar Dubiniuk <dubiniuk@owncloud.com>
 *
 * @copyright Copyright (c) 2018, ownCloud GmbH
Severity: Minor
Found in apps/dav/appinfo/Migrations/Version20170116150538.php - About 6 hrs to fix

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

    <?php
    /**
     * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
     * @author Christoph Schaefer <christophł@wolkesicher.de>
     * @author Christoph Wurst <christoph@owncloud.com>
    Severity: Minor
    Found in lib/private/App/AppManager.php - About 6 hrs to fix

      Jail has 49 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Jail extends Wrapper { /* implements IVersionedStorage */
          /**
           * @var string
           */
          protected $rootPath;
      Severity: Minor
      Found in lib/private/Files/Storage/Wrapper/Jail.php - About 6 hrs to fix

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

            private function getMimetypeFromDB($id) {
                $qb = $this->dbConnection->getQueryBuilder();
                $qb->select('id', 'mimetype')
                    ->from('mimetypes')
                    ->where(
        Severity: Major
        Found in lib/private/Files/Type/Loader.php and 1 other location - About 6 hrs to fix
        lib/private/Files/Type/Loader.php on lines 214..241

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

        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 getIdFromDB($mimetype) {
                $qb = $this->dbConnection->getQueryBuilder();
                $qb->select('id', 'mimetype')
                    ->from('mimetypes')
                    ->where(
        Severity: Major
        Found in lib/private/Files/Type/Loader.php and 1 other location - About 6 hrs to fix
        lib/private/Files/Type/Loader.php on lines 248..275

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

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

        <?php
        /**
         * @author Joas Schilling <coding@schilljs.com>
         * @author Jörn Friedrich Dreyer <jfd@butonic.de>
         * @author Morris Jobke <hey@morrisjobke.de>
        Severity: Minor
        Found in lib/private/Files/ObjectStore/ObjectStoreStorage.php - About 6 hrs to fix

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

                      <?php foreach ($_['adminNav'] as $item): ?>
                          <li class="<?php $item['active'] ? p(' active ') : p('') ?>">
                              <?php if (\strpos($item['icon'], '/', 1) !== false): ?>
                                  <a class="svg <?php $item['active'] ? p(' active ') : p('') ?>" style="background-image: url(<?php p($item['icon']) ?>)" href='<?php p($item['link']); ?>'><?php p($item['name']) ?></a>
                              <?php else: ?>
          Severity: Major
          Found in settings/templates/settingsPage.php and 1 other location - About 6 hrs to fix
          settings/templates/settingsPage.php on lines 25..33

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

          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

                  <?php foreach ($_['personalNav'] as $item): ?>
                  <li class="<?php $item['active'] ? p(' active ') : p('') ?>">
                      <?php if (\strpos($item['icon'], '/', 1) !== false): ?>
                          <a class="svg <?php $item['active'] ? p(' active ') : p('') ?>" style="background-image: url(<?php p($item['icon']) ?>)" href='<?php p($item['link']); ?>'><?php p($item['name']) ?></a>
                      <?php else: ?>
          Severity: Major
          Found in settings/templates/settingsPage.php and 1 other location - About 6 hrs to fix
          settings/templates/settingsPage.php on lines 38..46

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

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

                  attach: function(fileList) {
                      // core sharing is disabled/not loaded
                      if (!OC.Share) {
                          return;
                      }
          Severity: Major
          Found in apps/files_sharing/js/share.js - About 6 hrs to fix

            Method getUsersSharingFile has 169 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public static function getUsersSharingFile($path, $ownerUser, $includeOwner = false, $returnUserPaths = false, $recursive = true) {
                    $userManager = \OC::$server->getUserManager();
                    $userObject = $userManager->get($ownerUser);
            
                    if ($userObject === null) {
            Severity: Major
            Found in lib/private/Share/Share.php - About 6 hrs to fix

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

              OC.L10N.register(
                  "files",
                  {
                  "Close" : "වසන්න",
                  "Upload cancelled." : "උඩුගත කිරීම අත් හරින්න ලදී",
              Severity: Major
              Found in apps/files/l10n/si.js and 2 other locations - About 6 hrs to fix
              apps/files/l10n/zh_HK.js on lines 1..35
              lib/l10n/nn_NO.js on lines 1..35

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

              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" : "不明錯誤",
                  "All files" : "所有文件",
              Severity: Major
              Found in apps/files/l10n/zh_HK.js and 2 other locations - About 6 hrs to fix
              apps/files/l10n/si.js on lines 1..35
              lib/l10n/nn_NO.js on lines 1..35

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

              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(
                  "lib",
                  {
                  "Unknown filetype" : "Ukjend filtype",
                  "Invalid image" : "Ugyldig bilete",
              Severity: Major
              Found in lib/l10n/nn_NO.js and 2 other locations - About 6 hrs to fix
              apps/files/l10n/si.js on lines 1..35
              apps/files/l10n/zh_HK.js on lines 1..35

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

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

              <?php
              /**
               * @author Bart Visscher <bartv@thisnet.nl>
               * @author Bernhard Posselt <dev@bernhard-posselt.com>
               * @author Joas Schilling <coding@schilljs.com>
              Severity: Minor
              Found in lib/private/AppFramework/Http/Request.php - About 6 hrs to fix

                Function opendir has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function opendir($path) {
                        $folder = $this->getDriveFile($path);
                        if ($folder) {
                            $files = [];
                            $duplicates = [];
                Severity: Minor
                Found in apps/files_external/lib/Lib/Storage/Google.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 __construct has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function __construct($renderAs, $appId = '') {
                        // yes - should be injected ....
                        $this->config = \OC::$server->getConfig();
                
                        // Decide which page we show
                Severity: Minor
                Found in lib/private/TemplateLayout.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

                Method listMounts has 164 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function listMounts($userId, array $mounts, InputInterface $input, OutputInterface $output) {
                        $outputType = $input->getOption('output');
                        $outputIsJson = ($outputType === self::OUTPUT_FORMAT_JSON) || ($outputType === self::OUTPUT_FORMAT_JSON_PRETTY);
                        $shortView = $input->getOption('short');
                        $importableView = $input->getOption('importable-format');
                Severity: Major
                Found in apps/files_external/lib/Command/ListCommand.php - About 6 hrs to fix

                  Function extend has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                  Open

                  jQuery.extend = jQuery.fn.extend = function() {
                      var options, name, src, copy, copyIsArray, clone,
                          target = arguments[0] || {},
                          i = 1,
                          length = arguments.length,
                  Severity: Minor
                  Found in core/js/js.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 getShares has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function getShares() {
                          if (!$this->shareManager->shareApiEnabled()) {
                              return new Result();
                          }
                  
                  
                  Severity: Minor
                  Found in apps/files_sharing/lib/Controller/Share20OcsController.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 17 locations. Consider refactoring.
                  Open

                  OC.L10N.register(
                      "systemtags",
                      {
                      "Tags" : "Etiquetas",
                      "Tagged files" : "Archivos etiquetados",
                  Severity: Major
                  Found in apps/systemtags/l10n/es.js and 16 other locations - About 6 hrs to fix
                  apps/systemtags/l10n/bg_BG.js on lines 1..34
                  apps/systemtags/l10n/de.js on lines 1..34
                  apps/systemtags/l10n/de_DE.js on lines 1..34
                  apps/systemtags/l10n/el.js on lines 1..34
                  apps/systemtags/l10n/en_GB.js on lines 1..34
                  apps/systemtags/l10n/he.js on lines 1..34
                  apps/systemtags/l10n/pt_BR.js on lines 1..34
                  apps/systemtags/l10n/ru.js on lines 1..34
                  apps/systemtags/l10n/ru_RU.js on lines 1..34
                  apps/systemtags/l10n/sq.js on lines 1..34
                  apps/systemtags/l10n/th_TH.js on lines 1..34
                  apps/systemtags/l10n/tr.js on lines 1..34
                  apps/systemtags/l10n/ug.js on lines 1..34
                  apps/systemtags/l10n/zh_CN.js on lines 1..34
                  core/l10n/ku_IQ.js on lines 1..34
                  lib/l10n/cy_GB.js on lines 1..34

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

                  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