owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

Function hasUpdated has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function hasUpdated($path, $time) {
        $this->init();
        $path = $this->cleanPath($path);
        try {
            // force refresh for $path
Severity: Minor
Found in lib/private/Files/Storage/DAV.php - About 2 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 deleteAllMountsForUser has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public function deleteAllMountsForUser(IUser $user) {
        $getUserMounts = $this->userMountCache->getMountsForUser($user);
        $allMounts = $this->dbConfig->getAllMounts();
        $result = false;
        if (\count($getUserMounts) > 0) {
Severity: Minor
Found in lib/private/Files/External/Service/UserStoragesService.php - About 2 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 validateExpirationDate has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function validateExpirationDate(\OCP\Share\IShare $share, $skipPastDateValidation = false) {
        $expirationDate = $share->getExpirationDate();

        if ($expirationDate !== null) {
            // Set the expiration date to just the date at "zero" time in the day
Severity: Minor
Found in lib/private/Share20/Manager.php - About 2 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 copyTable has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function copyTable(Connection $fromDB, Connection $toDB, Table $table, InputInterface $input, OutputInterface $output) {
        $tableName = $table->getName();
        $chunkSize = $input->getOption('chunk-size');

        $progress = new ProgressBar($output);
Severity: Minor
Found in core/Command/Db/ConvertType.php - About 2 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 _attachments has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

$.datepicker._attachments = function (input, inst) {
        var showOn, buttonText, buttonImage,
            appendText = this._get(inst, "appendText"),
            isRTL = this._get(inst, "isRTL");

Severity: Major
Found in core/js/js.js - About 2 hrs to fix

    Method getGroups has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function getGroups($search) {
            $this->result['groups'] = $this->result['exact']['groups'] = [];
    
            if (\strlen(\trim($search)) === 0 && $this->userSearch->getSearchMinLength() > 0) {
                $this->result['groups'] = [];
    Severity: Major
    Found in apps/files_sharing/lib/Controller/ShareesController.php - About 2 hrs to fix

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

          protected function execute(InputInterface $input, OutputInterface $output): int {
              $user = $input->getOption('user');
              $mountPoint = $input->getArgument('mount_point');
              $storageIdentifier = $input->getArgument('storage_backend');
              $authIdentifier = $input->getArgument('authentication_backend');
      Severity: Major
      Found in apps/files_external/lib/Command/Create.php - About 2 hrs to fix

        Method fopen has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function fopen($path, $mode) {
                $this->log('enter: '.__FUNCTION__."($path, $mode)");
                $fullPath = $this->buildPath($path);
                $result = false;
                try {
        Severity: Major
        Found in apps/files_external/lib/Lib/Storage/SMB.php - About 2 hrs to fix

          Method getOrCreateEntry has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function getOrCreateEntry($storageId, $path, $reuseFileId = null) {
                  if ($path === '.') {
                      $path = '';
                  }
                  // find the correct parent
          Severity: Major
          Found in lib/private/Repair/RepairMismatchFileCachePath.php - About 2 hrs to fix

            Method getSingleFile has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private static function getSingleFile($view, $dir, $name, $params) {
                    $filename = "{$dir}/{$name}";
                    OC_Util::obEnd();
                    $view->lockFile($filename, ILockingProvider::LOCK_SHARED);
            
            
            Severity: Major
            Found in lib/private/legacy/files.php - About 2 hrs to fix

              Method initTemplateEngine has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public static function initTemplateEngine($renderAs) {
                      if (self::$initTemplateEngineFirstRun) {
                          //apps that started before the template initialization can load their own scripts/styles
                          //so to make sure this scripts/styles here are loaded first we use OC_Util::addScript() with $prepend=true
                          //meaning the last script/style in this list will be loaded first
              Severity: Major
              Found in lib/private/legacy/template.php - About 2 hrs to fix

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

                OC.L10N.register(
                    "files_external",
                    {
                    "Personal" : "Osobno",
                    "Saved" : "Spremljeno",
                Severity: Major
                Found in apps/files_external/l10n/bs.js and 6 other locations - About 2 hrs to fix
                apps/files_external/l10n/zh_HK.js on lines 1..18
                apps/files_sharing/l10n/bn_IN.js on lines 1..18
                apps/files_sharing/l10n/ka_GE.js on lines 1..18
                apps/systemtags/l10n/et_EE.js on lines 1..18
                lib/l10n/pa.js on lines 1..18
                lib/l10n/ur_PK.js on lines 1..18

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

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

                OC.L10N.register(
                    "systemtags",
                    {
                    "Tags" : "Sildid",
                    "Tagged files" : "Sildistatud failid",
                Severity: Major
                Found in apps/systemtags/l10n/et_EE.js and 6 other locations - About 2 hrs to fix
                apps/files_external/l10n/bs.js on lines 1..18
                apps/files_external/l10n/zh_HK.js on lines 1..18
                apps/files_sharing/l10n/bn_IN.js on lines 1..18
                apps/files_sharing/l10n/ka_GE.js on lines 1..18
                lib/l10n/pa.js on lines 1..18
                lib/l10n/ur_PK.js on lines 1..18

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

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

                OC.L10N.register(
                    "lib",
                    {
                    "Unknown filetype" : "غیر معرروف قسم کی فائل",
                    "Invalid image" : "غلط تصویر",
                Severity: Major
                Found in lib/l10n/ur_PK.js and 6 other locations - About 2 hrs to fix
                apps/files_external/l10n/bs.js on lines 1..18
                apps/files_external/l10n/zh_HK.js on lines 1..18
                apps/files_sharing/l10n/bn_IN.js on lines 1..18
                apps/files_sharing/l10n/ka_GE.js on lines 1..18
                apps/systemtags/l10n/et_EE.js on lines 1..18
                lib/l10n/pa.js on lines 1..18

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

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

                OC.L10N.register(
                    "lib",
                    {
                    "today" : "ਅੱਜ",
                    "yesterday" : "ਕੱਲ੍ਹ",
                Severity: Major
                Found in lib/l10n/pa.js and 6 other locations - About 2 hrs to fix
                apps/files_external/l10n/bs.js on lines 1..18
                apps/files_external/l10n/zh_HK.js on lines 1..18
                apps/files_sharing/l10n/bn_IN.js on lines 1..18
                apps/files_sharing/l10n/ka_GE.js on lines 1..18
                apps/systemtags/l10n/et_EE.js on lines 1..18
                lib/l10n/ur_PK.js on lines 1..18

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

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

                OC.L10N.register(
                    "files_sharing",
                    {
                    "Uploading..." : "আপলোডইং ...",
                    "Cancel" : "বাতিল করা",
                Severity: Major
                Found in apps/files_sharing/l10n/bn_IN.js and 6 other locations - About 2 hrs to fix
                apps/files_external/l10n/bs.js on lines 1..18
                apps/files_external/l10n/zh_HK.js on lines 1..18
                apps/files_sharing/l10n/ka_GE.js on lines 1..18
                apps/systemtags/l10n/et_EE.js on lines 1..18
                lib/l10n/pa.js on lines 1..18
                lib/l10n/ur_PK.js on lines 1..18

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

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

                OC.L10N.register(
                    "files_sharing",
                    {
                    "Uploading..." : "მიმდინარეობს ატვირთვა...",
                    "Cancel" : "უარყოფა",
                Severity: Major
                Found in apps/files_sharing/l10n/ka_GE.js and 6 other locations - About 2 hrs to fix
                apps/files_external/l10n/bs.js on lines 1..18
                apps/files_external/l10n/zh_HK.js on lines 1..18
                apps/files_sharing/l10n/bn_IN.js on lines 1..18
                apps/systemtags/l10n/et_EE.js on lines 1..18
                lib/l10n/pa.js on lines 1..18
                lib/l10n/ur_PK.js on lines 1..18

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

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

                OC.L10N.register(
                    "files_external",
                    {
                    "Personal" : "個人",
                    "Saved" : "已儲存",
                Severity: Major
                Found in apps/files_external/l10n/zh_HK.js and 6 other locations - About 2 hrs to fix
                apps/files_external/l10n/bs.js on lines 1..18
                apps/files_sharing/l10n/bn_IN.js on lines 1..18
                apps/files_sharing/l10n/ka_GE.js on lines 1..18
                apps/systemtags/l10n/et_EE.js on lines 1..18
                lib/l10n/pa.js on lines 1..18
                lib/l10n/ur_PK.js on lines 1..18

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

                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

                                if (d2[0].status === 'success') {
                                    $.each(d2[0].groups, function(group, displayname) {
                                        results.push({name:'g:'+group, displayname:displayname, type:'group'});
                                    });
                                } else {
                Severity: Major
                Found in apps/files_external/js/settings.js and 1 other location - About 2 hrs to fix
                apps/files_external/js/settings.js on lines 153..159

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

                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

                                if (d1[0].status === 'success') {
                                    $.each(d1[0].users, function(user, displayname) {
                                        results.push({name:'u:'+user, displayname:displayname, type:'user'});
                                    });
                                } else {
                Severity: Major
                Found in apps/files_external/js/settings.js and 1 other location - About 2 hrs to fix
                apps/files_external/js/settings.js on lines 160..166

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 83.

                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