owncloud/core

View on GitHub

Showing 4,504 of 4,504 total issues

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

    public function getMountsForStorageId($numericStorageId) {
        $builder = $this->connection->getQueryBuilder();
        $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point')
            ->from('mounts')
            ->where($builder->expr()->eq('storage_id', $builder->createPositionalParameter($numericStorageId, IQueryBuilder::PARAM_INT)));
Severity: Minor
Found in lib/private/Files/Config/UserMountCache.php and 1 other location - About 1 hr to fix
lib/private/Files/Config/UserMountCache.php on lines 251..260

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

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

    public function __construct(AppManager $appManager, ISession $session, IGroupManager $groupManager, IConfig $config, IRequest $request, ILogger $logger) {
        $this->appManager = $appManager;
        $this->session = $session;
        $this->groupManager = $groupManager;
        $this->config = $config;
Severity: Major
Found in lib/private/Authentication/TwoFactorAuth/Manager.php and 3 other locations - About 1 hr to fix
apps/federatedfilesharing/lib/Notifications.php on lines 63..77
apps/files_sharing/lib/Capabilities.php on lines 70..84
lib/private/License/LicenseManager.php on lines 46..60

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

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

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

        $qb = $qb->select('s.*')
            ->from('share', 's')
            ->leftJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'))
            ->where($qb->expr()->isNull('f.fileid'))
            ->andWhere(
Severity: Minor
Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 1 hr to fix
apps/federatedfilesharing/lib/FederatedShareProvider.php on lines 872..882

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

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 ($node instanceof \OCP\Files\File) {
                // Single file download
                $event = $this->activityManager->generateEvent();
                $event->setApp('files_sharing')
                    ->setType(Activity::TYPE_PUBLIC_LINKS)
Severity: Minor
Found in apps/files_sharing/lib/Controllers/ShareController.php and 1 other location - About 1 hr to fix
apps/files_sharing/lib/Controllers/ShareController.php on lines 511..520

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

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

            } else {
                // The folder is downloaded
                $event = $this->activityManager->generateEvent();
                $event->setApp('files_sharing')
                    ->setType(Activity::TYPE_PUBLIC_LINKS)
Severity: Minor
Found in apps/files_sharing/lib/Controllers/ShareController.php and 1 other location - About 1 hr to fix
apps/files_sharing/lib/Controllers/ShareController.php on lines 481..520

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    public function getMountsForRootId($rootFileId) {
        $builder = $this->connection->getQueryBuilder();
        $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point')
            ->from('mounts')
            ->where($builder->expr()->eq('root_id', $builder->createPositionalParameter($rootFileId, IQueryBuilder::PARAM_INT)));
Severity: Minor
Found in lib/private/Files/Config/UserMountCache.php and 1 other location - About 1 hr to fix
lib/private/Files/Config/UserMountCache.php on lines 236..245

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

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

        template: function(vars) {
            if (!this._template) {
                this._template = Handlebars.compile(TEMPLATE);
            }
            return this._template(vars);
Severity: Major
Found in apps/files/js/detailsview.js and 8 other locations - About 55 mins to fix
apps/files/js/locktabview.js on lines 92..98
apps/files/js/mainfileinfodetailview.js on lines 66..71
apps/files_sharing/js/sharetabview.js on lines 25..30
apps/files_versions/js/versionstabview.js on lines 266..272
apps/files_versions/js/versionstabview.js on lines 274..280
apps/files_versions/js/versionstabview.js on lines 282..288
core/js/systemtags/systemtagsinputfield.js on lines 62..67
core/js/systemtags/systemtagslist.js on lines 41..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 54.

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

            template: function (data) {
                if (!this._template) {
                    this._template = Handlebars.compile(TEMPLATE);
                }
                return this._template(data);
Severity: Major
Found in core/js/systemtags/systemtagslist.js and 8 other locations - About 55 mins to fix
apps/files/js/detailsview.js on lines 120..125
apps/files/js/locktabview.js on lines 92..98
apps/files/js/mainfileinfodetailview.js on lines 66..71
apps/files_sharing/js/sharetabview.js on lines 25..30
apps/files_versions/js/versionstabview.js on lines 266..272
apps/files_versions/js/versionstabview.js on lines 274..280
apps/files_versions/js/versionstabview.js on lines 282..288
core/js/systemtags/systemtagsinputfield.js on lines 62..67

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

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

        template: function(data) {
            if (!this._template) {
                this._template = Handlebars.compile(TEMPLATE);
            }

Severity: Major
Found in apps/files_versions/js/versionstabview.js and 8 other locations - About 55 mins to fix
apps/files/js/detailsview.js on lines 120..125
apps/files/js/locktabview.js on lines 92..98
apps/files/js/mainfileinfodetailview.js on lines 66..71
apps/files_sharing/js/sharetabview.js on lines 25..30
apps/files_versions/js/versionstabview.js on lines 274..280
apps/files_versions/js/versionstabview.js on lines 282..288
core/js/systemtags/systemtagsinputfield.js on lines 62..67
core/js/systemtags/systemtagslist.js on lines 41..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 54.

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

        versionTemplate: function(data) {
            if (!this._versionTemplate) {
                this._versionTemplate = Handlebars.compile(TEMPLATE_VERSION);
            }

Severity: Major
Found in apps/files_versions/js/versionstabview.js and 8 other locations - About 55 mins to fix
apps/files/js/detailsview.js on lines 120..125
apps/files/js/locktabview.js on lines 92..98
apps/files/js/mainfileinfodetailview.js on lines 66..71
apps/files_sharing/js/sharetabview.js on lines 25..30
apps/files_versions/js/versionstabview.js on lines 266..272
apps/files_versions/js/versionstabview.js on lines 282..288
core/js/systemtags/systemtagsinputfield.js on lines 62..67
core/js/systemtags/systemtagslist.js on lines 41..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 54.

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

            template: function (data) {
                if (!this._template) {
                    this._template = Handlebars.compile(TEMPLATE);
                }

Severity: Major
Found in apps/files/js/locktabview.js and 8 other locations - About 55 mins to fix
apps/files/js/detailsview.js on lines 120..125
apps/files/js/mainfileinfodetailview.js on lines 66..71
apps/files_sharing/js/sharetabview.js on lines 25..30
apps/files_versions/js/versionstabview.js on lines 266..272
apps/files_versions/js/versionstabview.js on lines 274..280
apps/files_versions/js/versionstabview.js on lines 282..288
core/js/systemtags/systemtagsinputfield.js on lines 62..67
core/js/systemtags/systemtagslist.js on lines 41..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 54.

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

        template: function(data) {
            if (!this._template) {
                this._template = Handlebars.compile(TEMPLATE);
            }
            return this._template(data);
Severity: Major
Found in core/js/systemtags/systemtagsinputfield.js and 8 other locations - About 55 mins to fix
apps/files/js/detailsview.js on lines 120..125
apps/files/js/locktabview.js on lines 92..98
apps/files/js/mainfileinfodetailview.js on lines 66..71
apps/files_sharing/js/sharetabview.js on lines 25..30
apps/files_versions/js/versionstabview.js on lines 266..272
apps/files_versions/js/versionstabview.js on lines 274..280
apps/files_versions/js/versionstabview.js on lines 282..288
core/js/systemtags/systemtagslist.js on lines 41..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 54.

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

        template: function(params) {
            if (!this._template) {
                this._template = Handlebars.compile(TEMPLATE);
            }
            return this._template(params);
Severity: Major
Found in apps/files_sharing/js/sharetabview.js and 8 other locations - About 55 mins to fix
apps/files/js/detailsview.js on lines 120..125
apps/files/js/locktabview.js on lines 92..98
apps/files/js/mainfileinfodetailview.js on lines 66..71
apps/files_versions/js/versionstabview.js on lines 266..272
apps/files_versions/js/versionstabview.js on lines 274..280
apps/files_versions/js/versionstabview.js on lines 282..288
core/js/systemtags/systemtagsinputfield.js on lines 62..67
core/js/systemtags/systemtagslist.js on lines 41..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 54.

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

        template: function(data) {
            if (!this._template) {
                this._template = Handlebars.compile(TEMPLATE);
            }
            return this._template(data);
Severity: Major
Found in apps/files/js/mainfileinfodetailview.js and 8 other locations - About 55 mins to fix
apps/files/js/detailsview.js on lines 120..125
apps/files/js/locktabview.js on lines 92..98
apps/files_sharing/js/sharetabview.js on lines 25..30
apps/files_versions/js/versionstabview.js on lines 266..272
apps/files_versions/js/versionstabview.js on lines 274..280
apps/files_versions/js/versionstabview.js on lines 282..288
core/js/systemtags/systemtagsinputfield.js on lines 62..67
core/js/systemtags/systemtagslist.js on lines 41..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 54.

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

        currentTemplate: function(data) {
            if (!this._currentTemplate) {
                this._currentTemplate = Handlebars.compile(TEMPLATE_CURRENT);
            }

Severity: Major
Found in apps/files_versions/js/versionstabview.js and 8 other locations - About 55 mins to fix
apps/files/js/detailsview.js on lines 120..125
apps/files/js/locktabview.js on lines 92..98
apps/files/js/mainfileinfodetailview.js on lines 66..71
apps/files_sharing/js/sharetabview.js on lines 25..30
apps/files_versions/js/versionstabview.js on lines 266..272
apps/files_versions/js/versionstabview.js on lines 274..280
core/js/systemtags/systemtagsinputfield.js on lines 62..67
core/js/systemtags/systemtagslist.js on lines 41..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 54.

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

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

                if (
                    event.target !== self.$dialog.get(0) &&
                    self.$dialog.find($(event.target)).length === 0
                ) {
                    return;
Severity: Minor
Found in core/js/jquery.ocdialog.js and 1 other location - About 55 mins to fix
core/js/jquery.ocdialog.js on lines 149..153

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

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

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

                if (event.target !== self.$dialog.get(0) && self.$dialog.find($(event.target)).length === 0) {
                    event.preventDefault();
                    event.stopPropagation();
                    return;
                }
Severity: Minor
Found in core/js/jquery.ocdialog.js and 1 other location - About 55 mins to fix
core/js/jquery.ocdialog.js on lines 25..30

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

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

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

        if ($reshares === false) {
            $qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId)));
        } else {
            $qb->andWhere(
                $qb->expr()->orX(
Severity: Minor
Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 55 mins to fix
lib/private/Share20/DefaultShareProvider.php on lines 473..482

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

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

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

        if ($reshares === false) {
            $qb->andWhere($qb->expr()->eq('uid_initiator', $qb->createNamedParameter($userId)));
        } else {
            $qb->andWhere(
                $qb->expr()->orX(
Severity: Minor
Found in lib/private/Share20/DefaultShareProvider.php and 1 other location - About 55 mins to fix
lib/private/Share20/DefaultShareProvider.php on lines 519..528

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

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 _parseAppAuthor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    _parseAppAuthor: function (author) {
        if (_.isObject(author) && !_.isUndefined(author['@value'])) {
            return author['@value'];
        }

Severity: Minor
Found in settings/js/admin-apps.js - About 55 mins 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

Severity
Category
Status
Source
Language