smartinmedia/cunity

View on GitHub

Showing 617 of 617 total issues

Avoid too many return statements within this function.
Open

                        return;
Severity: Major
Found in lib/plugins/select2/select2.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                        return;
Severity: Major
Found in lib/plugins/select2/select2.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                    return null;
Severity: Major
Found in lib/plugins/select2/select2.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                        return (this.opts.element.outerWidth(false) === 0 ? 'auto' : this.opts.element.outerWidth(false) + 'px');
Severity: Major
Found in lib/plugins/select2/select2.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                    return;
Severity: Major
Found in lib/plugins/select2/select2.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

                        return;
Severity: Major
Found in lib/plugins/select2/select2.js - About 30 mins to fix

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

        return s.EMPTY = 0, s.LOADING = 1, s.DONE = 2, s.prototype = i.instance, s
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 30 mins to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 1403..1403

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

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

                    return i || (n = this.options.container ? t.get(this.options.container) : document.body, i = document.createElement("div"), i.id = this.shimid, i.className = "moxie-shim moxie-shim-" + this.type, e.extend(i.style, {
                        position: "absolute",
                        top: "0px",
                        left: "0px",
                        width: "1px",
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 30 mins to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 2619..2626

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

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 (res.result.length < imageLoad)
                $(".album-load-more").hide();
            else
                $(".album-load-more").show();
Severity: Minor
Found in lib/modules/Gallery/styles/javascript/album.js and 1 other location - About 30 mins to fix
lib/modules/Newsfeed/styles/javascript/newsfeed.js on lines 277..280

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

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

                    o = this.getShimContainer(), e.extend(o.style, {
                        position: "absolute",
                        top: "-8px",
                        left: "-8px",
                        width: "9px",
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 30 mins to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 798..805

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

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 (res.posts.length < postLoad)
                    $(".newsfeed-postbox-load-more").hide();
                else
                    $(".newsfeed-postbox-load-more").show();
Severity: Minor
Found in lib/modules/Newsfeed/styles/javascript/newsfeed.js and 1 other location - About 30 mins to fix
lib/modules/Gallery/styles/javascript/album.js on lines 71..74

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

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

        return r.IDLE = 0, r.BUSY = 1, r.DONE = 2, r.prototype = i.instance, r
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 30 mins to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 1099..1099

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

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 like()
    {
        $res = $this->table->like(Post::get('ref_id'), Post::get('ref_name'));
        $this->view->setStatus($res !== false);
        if (Post::get('ref_name') == 'image') {
Severity: Minor
Found in lib/modules/Likes/Models/Likes.php and 1 other location - About 30 mins to fix
lib/modules/Likes/Models/Likes.php on lines 102..109

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

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 unlike()
    {
        $res = $this->table->unlike(Post::get('ref_id'), Post::get('ref_name'));
        $this->view->setStatus($res !== false);
        if (Post::get('ref_name') == 'image') {
Severity: Minor
Found in lib/modules/Likes/Models/Likes.php and 1 other location - About 30 mins to fix
lib/modules/Likes/Models/Likes.php on lines 78..85

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

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

                    (e.which == KEY.LEFT || e.which == KEY.RIGHT || e.which == KEY.BACKSPACE || e.which == KEY.DELETE || e.which == KEY.ENTER)) {
Severity: Minor
Found in lib/plugins/select2/select2.js and 1 other location - About 30 mins to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 3476..3476

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

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 (n.status == o.DONE || n.status == o.FAILED || e.state == o.STOPPED)return;
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 30 mins to fix
lib/plugins/select2/select2.js on lines 2753..2753

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

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

function CunityStorage(type) {
    if (type === "session")
        this.storage = sessionStorage;
    else if (type === "local")
        this.storage = localStorage;
Severity: Minor
Found in lib/modules/Core/styles/javascript/cunity-core.js - About 25 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

Function getMainMenu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getMainMenu()
    {
        $res = $this->fetchAll($this->select()->where("menu='main'")->order('pos'));
        $menu = $res->toArray();
        $menus = [];
Severity: Minor
Found in lib/modules/Core/Models/Db/Table/Menu.php - About 25 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

Function getWall has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public function getWall($ownerid, $ownertype, $offset, $refresh = 0, $filter = [])
    {
        $query = $this->getAdapter()->select()->from(['p' => $this->_dbprefix.'posts'])
            ->join(['w' => $this->getTableName()], 'w.wall_id=p.wall_id')
            ->join(['u' => $this->_dbprefix.'users'], 'u.userid=p.userid', ['name', 'username'])
Severity: Minor
Found in lib/modules/Newsfeed/Models/Db/Table/Walls.php - About 25 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

Function handleAjaxAction has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleAjaxAction()
    {
        switch (Get::get('action')) {
            case 'getpins':
                $pins = new Db\Table\ProfilePins();
Severity: Minor
Found in lib/modules/Profile/Models/Profile.php - About 25 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