smartinmedia/cunity

View on GitHub

Showing 617 of 617 total issues

Method create has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function create()
    {
        $uploader = new UploadHelper();
        $uploader->setExtension(UploadHelper::generateExtension($_FILES['file']['name']));
        $uploader->setTempFile($_FILES['file']['tmp_name']);
Severity: Minor
Found in lib/modules/Filesharing/Controller.php - About 1 hr to fix

Function renderLikes has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function renderLikes(res, el) {
    $("#lightbox-dislikes > div,#lightbox-likes > div").empty();
    if (typeof res.likes !== "undefined" && res.likes.length > 0) {
        $("#lightbox-likes > span.label").hide();
        for (x in res.likes) {
Severity: Minor
Found in lib/modules/Gallery/styles/javascript/lightbox.js - About 1 hr to fix

Method getWall has 29 lines of code (exceeds 25 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 1 hr to fix

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

                }, shimExec: function (e, t) {
                    var n = [].slice.call(arguments, 2);
                    return c.getShim().exec(this.uid, e, t, n)
                }, init: function () {
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 2863..2866

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

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

                }, shimExec: function (e, t) {
                    var n = [].slice.call(arguments, 2);
                    return c.getShim().exec(this.uid, e, t, n)
                }, init: function () {
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 2614..2617

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

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

    $.ajax({
        type: form.attr('method'),
        url: form.attr('action'),
        data: form.serialize(),
        dataType: "json"
Severity: Major
Found in lib/modules/Core/styles/javascript/cunity-core.js and 1 other location - About 1 hr to fix
lib/modules/Core/styles/javascript/cunity-core.js on lines 303..317

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

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

            $.ajax({
                type: form.attr('method'),
                url: form.attr('action'),
                data: form.serialize(),
                dataType: "json"
Severity: Major
Found in lib/modules/Core/styles/javascript/cunity-core.js and 1 other location - About 1 hr to fix
lib/modules/Core/styles/javascript/cunity-core.js on lines 198..213

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

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

<?php

/**
 * ########################################################################################
 * ## CUNITY(R) V2.0 - An open source social network / "your private social network"     ##
Severity: Major
Found in lib/modules/Forums/View/Thread.php and 1 other location - About 1 hr to fix
lib/modules/Forums/View/Board.php on lines 1..79

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

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

<?php

/**
 * ########################################################################################
 * ## CUNITY(R) V2.0 - An open source social network / "your private social network"     ##
Severity: Major
Found in lib/modules/Forums/View/Board.php and 1 other location - About 1 hr to fix
lib/modules/Forums/View/Thread.php on lines 1..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 103.

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

            addFile: function (e, n) {
                function l(e, n) {
                    var r = [];
                    t.each(s.settings.filters, function (t, n) {
                        i[n] && r.push(function (r) {
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Function sendRequest has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function sendRequest(requestData, module, action, callback) {
    if ($("body").hasClass("blurred"))
        inactiveCounter++;
    else
        inactiveCounter = 0;
Severity: Minor
Found in lib/modules/Core/styles/javascript/cunity-core.js - About 1 hr to fix

Function send has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            send: function (e, i) {
                function r() {
                    e.transport = l.mode, l.shimExec.call(c, "XMLHttpRequest", "send", e, i)
                }

Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Function initSelection has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                opts.initSelection = opts.initSelection || function (element, callback) {
                    var ids = splitVal(element.val(), opts.separator, opts.transformVal);
                    //search in data by array of ids, storing matching items in a list
                    var matches = [];
                    opts.query({
Severity: Minor
Found in lib/plugins/select2/select2.js - About 1 hr to fix

Function i has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            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

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

                return 0 > n ? n = Math.max(e.size + n, 0) : n > 0 && (n = Math.min(n, e.size)), 0 > i ? i = Math.max(e.size + i, 0) : i > 0 && (i = Math.min(i, e.size)), e = o.shimExec.call(this, "Blob", "slice", n, i, r || ""), e && (e = new t(o.uid, e)), 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 2643..2643

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

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

                    typeof a.init == "function" ? a.init(e) : o.each(a.init, function (t, n) {
                        e.bind(n, t)
                    }), n ? (e.runtime = t.Runtime.getInfo(w()).type, e.trigger("Init", {runtime: e.runtime}), e.trigger("PostInit")) : e.trigger("Error", {
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 3584..3586

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

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

        pause: function () {
            window.clearTimeout(this.timeout), this.interval = null, this.container.removeClass(this.options.playingClass)
        },
lib/modules/Gallery/styles/javascript/blueimp-gallery.min.js on lines 187..189

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

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

        pause: function () {
            window.clearTimeout(this.timeout), this.interval = null, this.container.removeClass(this.options.playingClass)
        },
lib/modules/Gallery/styles/javascript/jquery.blueimp-gallery.min.js on lines 135..137

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

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

                typeof a.preinit == "function" ? a.preinit(e) : o.each(a.preinit, function (t, n) {
                    e.bind(n, t)
                });
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 3592..3594

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

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

    public function toSelectedArray(array $fields)
    {
        if (empty($this->_rows) && !empty($this->_data)) {
            foreach ($this->_data as $i => $row) {
                $result = [];
Severity: Minor
Found in lib/modules/Core/Models/Db/Rowset/Rowset.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

Severity
Category
Status
Source
Language