owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function moveInto has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function moveInto($targetName, $fullSourcePath, INode $sourceNode) {
        if (!$sourceNode instanceof Node) {
            if ($sourceNode instanceof ITrashBinNode) {
                if (!$this->fileView->isCreatable($this->getPath())) {
                    throw new SabreForbidden('Destination directory is not writable');
Severity: Minor
Found in apps/dav/lib/Connector/Sabre/Directory.php - About 4 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 setupFS has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public static function setupFS($user = '', $fullInit = true) {
        //setting up the filesystem twice can only lead to trouble
        if (self::$fsSetup) {
            return false;
        }
Severity: Minor
Found in lib/private/legacy/util.php - About 4 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 showLoginForm has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function showLoginForm($user, $redirect_url, $remember_login) {
        // check if there is apache auth backend available and try to obtain session,
        // if apache backend not registered or failed to login, proceed with show login form
        if ($this->handleApacheAuth()) {
            // apache auth was completed server-side and there is active session,
Severity: Minor
Found in core/Controller/LoginController.php - About 4 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 newStorage has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    newStorage: function(storageConfig, onCompletion) {
        var mountPoint = storageConfig.mountPoint;
        var backend = this._allBackends[storageConfig.backend];
        var isInvalidAuth = false;

Severity: Major
Found in apps/files_external/js/settings.js - About 4 hrs to fix

    File ja.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    OC.L10N.register(
        "settings",
        {
        "Wrong current password" : "現在のパスワードが間違っています",
        "The new password cannot be the same as the previous one" : "新しいパスワードは前のパスワードと同じにできません",
    Severity: Minor
    Found in settings/l10n/ja.js - About 4 hrs to fix

      File cs_CZ.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      OC.L10N.register(
          "core",
          {
          "Please select a file." : "Prosím vyberte soubor.",
          "File is too big" : "Soubor je příliš velký",
      Severity: Minor
      Found in core/l10n/cs_CZ.js - About 4 hrs to fix

        File is.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        OC.L10N.register(
            "settings",
            {
            "Wrong current password" : "Rangt núverandi lykilorð",
            "The new password cannot be the same as the previous one" : "Nýja lykilorðið má ekki vera eins og það fyrra",
        Severity: Minor
        Found in settings/l10n/is.js - About 4 hrs to fix

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

          <?php
          /**
           * @author Joas Schilling <coding@schilljs.com>
           * @author Vincent Petry <pvince81@owncloud.com>
           *
          Severity: Minor
          Found in lib/private/SystemTag/SystemTagManager.php - About 4 hrs to fix

            Trashbin has 35 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Trashbin {
                /**
                 * @var IURLGenerator
                 */
                private $urlGenerator;
            Severity: Minor
            Found in apps/files_trashbin/lib/Trashbin.php - About 4 hrs to fix

              AppManager has 35 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class AppManager implements IAppManager {
                  /**
                   * Apps with these types can not be enabled for certain groups only
                   * @var string[]
                   */
              Severity: Minor
              Found in lib/private/App/AppManager.php - About 4 hrs to fix

                Function setupUploadEvents has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        setupUploadEvents: function(uploader) {
                            var self = this;
                
                            self._uploads = {};
                
                
                Severity: Major
                Found in apps/files/js/filelist.js - About 4 hrs to fix

                  Method expire has 112 lines of code (exceeds 25 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: Major
                  Found in apps/files_versions/lib/Storage.php - About 4 hrs to fix

                    Method getDirectoryContent has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getDirectoryContent($directory, $mimetype_filter = '') {
                            $this->assertPathLength($directory);
                            if (!Filesystem::isValidPath($directory)) {
                                return [];
                            }
                    Severity: Major
                    Found in lib/private/Files/View.php - About 4 hrs to fix

                      File commentstabview.js has 352 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /*
                       * Copyright (c) 2016
                       *
                       * This file is licensed under the Affero General Public License version 3
                       * or later.
                      Severity: Minor
                      Found in apps/comments/js/commentstabview.js - About 4 hrs to fix

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

                        <?php
                        /**
                         * @author Robin Appelman <icewind@owncloud.com>
                         * @author Robin McCorkell <robin@mccorkell.me.uk>
                         *
                        Severity: Minor
                        Found in lib/private/Files/Storage/Wrapper/Availability.php - About 4 hrs to fix

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

                          <?php
                          /**
                           * @author Andreas Fischer <bantu@owncloud.com>
                           * @author Bart Visscher <bartv@thisnet.nl>
                           * @author Joas Schilling <coding@schilljs.com>
                          Severity: Minor
                          Found in core/Command/Db/ConvertType.php - About 4 hrs to fix

                            Method updateShare has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

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

                              Function init has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  private function init() {
                                      if ($this->init) {
                                          return;
                                      }
                                      $this->init = true;
                              Severity: Minor
                              Found in lib/private/NavigationManager.php - About 4 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 match has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function match($url) {
                                      if (\substr($url, 0, 6) === '/apps/') {
                                          // empty string / 'apps' / $app / rest of the route
                                          list(, , $app, ) = \explode('/', $url, 4);
                              
                              
                              Severity: Minor
                              Found in lib/private/Route/Router.php - About 4 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 60 locations. Consider refactoring.
                              Open

                              OC.L10N.register(
                                  "comments",
                                  {
                                  "Type in a new comment..." : "新しいコメントを入力...",
                                  "Delete comment" : "コメントを削除",
                              Severity: Major
                              Found in apps/comments/l10n/ja.js and 59 other locations - About 4 hrs to fix
                              apps/comments/l10n/ar.js on lines 1..26
                              apps/comments/l10n/bg_BG.js on lines 1..26
                              apps/comments/l10n/ca.js on lines 1..26
                              apps/comments/l10n/cs_CZ.js on lines 1..26
                              apps/comments/l10n/da.js on lines 1..26
                              apps/comments/l10n/de.js on lines 1..26
                              apps/comments/l10n/de_CH.js on lines 1..26
                              apps/comments/l10n/de_DE.js on lines 1..26
                              apps/comments/l10n/el.js on lines 1..26
                              apps/comments/l10n/en_GB.js on lines 1..26
                              apps/comments/l10n/es.js on lines 1..26
                              apps/comments/l10n/es_AR.js on lines 1..26
                              apps/comments/l10n/es_MX.js on lines 1..26
                              apps/comments/l10n/eu.js on lines 1..26
                              apps/comments/l10n/fa.js on lines 1..26
                              apps/comments/l10n/fi_FI.js on lines 1..26
                              apps/comments/l10n/fr.js on lines 1..26
                              apps/comments/l10n/gl.js on lines 1..26
                              apps/comments/l10n/he.js on lines 1..26
                              apps/comments/l10n/hu_HU.js on lines 1..26
                              apps/comments/l10n/id.js on lines 1..26
                              apps/comments/l10n/is.js on lines 1..26
                              apps/comments/l10n/it.js on lines 1..26
                              apps/comments/l10n/ko.js on lines 1..26
                              apps/comments/l10n/lt_LT.js on lines 1..26
                              apps/comments/l10n/mk.js on lines 1..26
                              apps/comments/l10n/nb_NO.js on lines 1..26
                              apps/comments/l10n/nl.js on lines 1..26
                              apps/comments/l10n/oc.js on lines 1..26
                              apps/comments/l10n/pl.js on lines 1..26
                              apps/comments/l10n/pt_BR.js on lines 1..26
                              apps/comments/l10n/pt_PT.js on lines 1..26
                              apps/comments/l10n/ru.js on lines 1..26
                              apps/comments/l10n/ru_RU.js on lines 1..26
                              apps/comments/l10n/sl.js on lines 1..26
                              apps/comments/l10n/sq.js on lines 1..26
                              apps/comments/l10n/sv.js on lines 1..26
                              apps/comments/l10n/th_TH.js on lines 1..26
                              apps/comments/l10n/tr.js on lines 1..26
                              apps/comments/l10n/ug.js on lines 1..26
                              apps/comments/l10n/uk.js on lines 1..26
                              apps/comments/l10n/uz.js on lines 1..26
                              apps/comments/l10n/zh_CN.js on lines 1..26
                              apps/comments/l10n/zh_TW.js on lines 1..26
                              apps/federatedfilesharing/l10n/ast.js on lines 1..26
                              apps/federatedfilesharing/l10n/ca.js on lines 1..26
                              apps/federatedfilesharing/l10n/cs_CZ.js on lines 1..26
                              apps/federatedfilesharing/l10n/da.js on lines 1..26
                              apps/federatedfilesharing/l10n/fi_FI.js on lines 1..26
                              apps/federatedfilesharing/l10n/hu_HU.js on lines 1..26
                              apps/federatedfilesharing/l10n/ja.js on lines 1..26
                              apps/federatedfilesharing/l10n/oc.js on lines 1..26
                              apps/federatedfilesharing/l10n/pl.js on lines 1..26
                              apps/federatedfilesharing/l10n/pt_PT.js on lines 1..26
                              apps/federatedfilesharing/l10n/ro.js on lines 1..26
                              apps/federatedfilesharing/l10n/sl.js on lines 1..26
                              apps/files_external/l10n/nn_NO.js on lines 1..26
                              lib/l10n/si.js on lines 1..26
                              settings/l10n/mn.js on lines 1..26

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

                              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