smartinmedia/cunity

View on GitHub

Showing 617 of 617 total issues

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

                                    if (e.ctrlKey) {
                                        newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
                                        newViewDate = this.moveYear(focusDate, dir);
                                        this._trigger('changeYear', this.viewDate);
                                    }
lib/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js on lines 1107..1122
lib/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js on lines 1112..1122
lib/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js on lines 1140..1150

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

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

                                    if (e.ctrlKey) {
                                        newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
                                        newViewDate = this.moveYear(focusDate, dir);
                                        this._trigger('changeYear', this.viewDate);
                                    }
lib/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js on lines 1112..1122
lib/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js on lines 1135..1150
lib/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js on lines 1140..1150

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

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.uid), n.addEvent(r, "drop", function (e) {
                    e.preventDefault();
                    var n = t.get(i.uid).dragDrop(e);
                    n && e.stopPropagation()
                }, e.uid), i.shimExec.call(this, "FileDrop", "init")
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 1 hr to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 2901..2905

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

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.uid), n.addEvent(r, "dragenter", function (e) {
                    e.preventDefault();
                    var n = t.get(i.uid).dragEnter(e);
                    n && e.stopPropagation()
                }, e.uid), n.addEvent(r, "drop", function (e) {
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 1 hr to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 2905..2909

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

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

        function x(e, n) {
            var r = this, i = 0, s = [], u = {
                accept: e.filters.mime_types,
                runtime_order: e.runtimes,
                required_caps: e.required_features,
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Method find has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function find($queryString)
    {
        $queryString = trim($queryString);
        if (empty($queryString)) {
            return ['queryString' => $queryString, 'message' => 'No String'];
Severity: Minor
Found in lib/modules/Search/Models/Process.php - About 1 hr to fix

Function opening has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        opening: function() {
            var cid = this.containerEventName,
                scroll = "scroll." + cid,
                resize = "resize."+cid,
                orient = "orientationchange."+cid,
Severity: Minor
Found in lib/plugins/select2/select2.js - About 1 hr to fix

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

        $query = $this->getAdapter()->select()->from(['p' => $this->_name])
            ->joinLeft(['u' => $this->_dbprefix.'users'], 'u.userid=.p.userid', ['name', 'username'])
            ->joinLeft(['pi' => $this->_dbprefix.'gallery_images'], 'pi.id=u.profileImage', ['filename'])
            ->joinLeft(['pc' => $this->getTableName()], 'pc.thread_id=p.thread_id', new \Zend_Db_Expr('COUNT(DISTINCT pc.id) AS postcount'))
            ->where('p.id=?', $postid);
Severity: Major
Found in lib/modules/Forums/Models/Db/Table/Posts.php and 1 other location - About 1 hr to fix
lib/modules/Forums/Models/Db/Table/Posts.php on lines 73..77

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

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

        $query = $this->getAdapter()->select()->from(['p' => $this->_name])
            ->joinLeft(['u' => $this->_dbprefix.'users'], 'u.userid=.p.userid', ['name', 'username'])
            ->joinLeft(['pi' => $this->_dbprefix.'gallery_images'], 'pi.id=u.profileImage', ['filename'])
            ->joinLeft(['pc' => $this->getTableName()], 'pc.thread_id=p.thread_id', new \Zend_Db_Expr('COUNT(DISTINCT pc.id) AS postcount'))
            ->where('p.thread_id=?', $thread_id)
Severity: Major
Found in lib/modules/Forums/Models/Db/Table/Posts.php and 1 other location - About 1 hr to fix
lib/modules/Forums/Models/Db/Table/Posts.php on lines 107..111

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

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

        function c(r) {
            var c = this, d, f, p;
            if (-1 !== e.inArray(e.typeOf(r), ["string", "node"]) && (r = {browse_button: r}), f = n.get(r.browse_button), !f)throw new i.DOMException(i.DOMException.NOT_FOUND_ERR);
            p = {
                accept: [
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

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

        formatSelectionTooBig: function (limit) {
            return "Jūs galite pasirinkti tik " + limit + " element" + ((limit%100 > 9 && limit%100 < 21) || limit%10 == 0 ? "ų" : limit%10 > 1 ? "us" : "ą");
        },
Severity: Major
Found in lib/plugins/select2/select2_locale_lt.js and 1 other location - About 1 hr to fix
lib/plugins/select2/select2_locale_lt.js on lines 23..25

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

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

    function character (n) {
        return " " + n + " simbol" + ((n%100 > 9 && n%100 < 21) || n%10 == 0 ? "ių" : n%10 > 1 ? "ius" : "į");
    }
Severity: Major
Found in lib/plugins/select2/select2_locale_lt.js and 1 other location - About 1 hr to fix
lib/plugins/select2/select2_locale_lt.js on lines 14..16

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

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

    $.fn.select2 = function () {

        var args = Array.prototype.slice.call(arguments, 0),
            opts,
            select2,
Severity: Minor
Found in lib/plugins/select2/select2.js - About 1 hr to fix

Function s has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function s() {
            function i(e, i) {
                function l(e) {
                    o.readyState = s.DONE, o.error = e, o.trigger("error"), d()
                }
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Method save has 44 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function save($form)
    {
        $res = [];
        switch ($form) {
            case 'settings':
Severity: Minor
Found in lib/modules/Admin/Models/Process.php - About 1 hr to fix

Function fillModal has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function fillModal(res, el) {
    currentImgId = res.id;
    if (res.caption.length > 0)
        el.find(".imagetitle").html(res.caption).show();
    else
Severity: Minor
Found in lib/modules/Gallery/styles/javascript/lightbox.js - About 1 hr 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 addUsersToConversation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    public function addUsersToConversation($cid, $users, $invitation = false, $notify = true)
    {
        if (is_array($users) && !empty($users)) {
            foreach ($users as $user) {
                $this->insert(['userid' => intval($user), 'conversation_id' => intval($cid)]);
Severity: Minor
Found in lib/modules/Messages/Models/Db/Table/Conversations.php - About 1 hr 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

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

        toggleControls: function () {
            var a = this.options.controlsClass;
            this.container.hasClass(a) ? this.container.removeClass(a) : this.container.addClass(a)
        },
lib/modules/Gallery/styles/javascript/blueimp-gallery.min.js on lines 374..377

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

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

        toggleControls: function () {
            var a = this.options.controlsClass;
            this.container.hasClass(a) ? this.container.removeClass(a) : this.container.addClass(a)
        },
lib/modules/Gallery/styles/javascript/jquery.blueimp-gallery.min.js on lines 322..325

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

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

        onmousemove: function (a) {
            this.touchStart && ((a.originalEvent || a).touches = [
                {pageX: a.pageX, pageY: a.pageY}
            ], this.ontouchmove(a))
        },
lib/modules/Gallery/styles/javascript/jquery.blueimp-gallery.min.js on lines 190..194

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

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