smartinmedia/cunity

View on GitHub

Showing 617 of 617 total issues

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

        getNestedProperty: function (a, b) {
            return b.replace(/\[(?:'([^']+)'|"([^"]+)"|(\d+))\]|(?:(?:^|\.)([^\.\[]+))/g, function (b, c, d, e, f) {
                var g = f || c || d || e && parseInt(e, 10);
                b && a && (a = a[g])
            }), a
Severity: Major
Found in lib/modules/Gallery/styles/javascript/blueimp-gallery.min.js and 1 other location - About 2 hrs to fix
lib/modules/Gallery/styles/javascript/jquery.blueimp-gallery.min.js on lines 332..337

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

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 renderLikes has a Cognitive Complexity of 18 (exceeds 5 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 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    public function getGuests($eventid, $sort = true, $limit = 4)
    {
        $guests = [];
        $res = $this->getAdapter()->fetchAll(
            $this->getAdapter()->select()->from(['g' => $this->_name])
Severity: Minor
Found in lib/modules/Events/Models/Db/Table/Guests.php - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function L has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function L(e, n) {
            function h() {
                u-- > 0 ? r(p, 1e3) : (n.loaded = f, e.trigger("Error", {
                    code: o.HTTP_ERROR,
                    message: o.translate("HTTP Error."),
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js - About 2 hrs to fix

File View.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * ########################################################################################
 * ## CUNITY(R) V2.0 - An open source social network / "your private social network"     ##
Severity: Minor
Found in lib/modules/Core/View/View.php - About 2 hrs to fix

Method show has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function show()
    {
        if (Login::loggedIn() && Get::get('m') !== 'admin') {
            $this->registerScript('search', 'livesearch');
            $this->registerScript('messages', 'message-modal');
Severity: Major
Found in lib/modules/Core/View/View.php - About 2 hrs to fix

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

        onmouseout: function (b) {
            if (this.touchStart) {
                var c = b.target, d = b.relatedTarget;
                (!d || d !== c && !a.contains(c, d)) && this.onmouseup(b)
            }
Severity: Major
Found in lib/modules/Gallery/styles/javascript/blueimp-gallery.min.js and 1 other location - About 2 hrs to fix
lib/modules/Gallery/styles/javascript/jquery.blueimp-gallery.min.js on lines 198..203

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

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

        onmouseout: function (b) {
            if (this.touchStart) {
                var c = b.target, d = b.relatedTarget;
                (!d || d !== c && !a.contains(c, d)) && this.onmouseup(b)
            }
lib/modules/Gallery/styles/javascript/blueimp-gallery.min.js on lines 250..255

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

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

            n.call(this, t, arguments[1] || o, c), e.extend(this, {
                init: function () {
                    this.trigger("Init")
                }, destroy: function (e) {
                    return function () {
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 2 hrs to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 2972..2980

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

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

            }), e.extend(this, {
                init: function () {
                    this.trigger("Init")
                }, destroy: function (e) {
                    return function () {
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 2 hrs to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 1611..1619

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

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

                        case 3:
                            for (d > 2 && (p = a.LONG(p) + c.tiffHeader), o = 0; d > o; o++)m[o] = a.SHORT(p + 2 * o);
                            break;
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 2 hrs to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 2059..2061

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

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

                        case 4:
                            for (d > 1 && (p = a.LONG(p) + c.tiffHeader), o = 0; d > o; o++)m[o] = a.LONG(p + 4 * o);
                            break;
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js and 1 other location - About 2 hrs to fix
lib/plugins/plupload/js/plupload.full.min.js on lines 2056..2058

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

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

    public function run()
    {
        $dir = new \DirectoryIterator($this->_directory);
        foreach ($dir as $fileinfo) {
            if (!$fileinfo->isDot() && $fileinfo->isReadable()) {
Severity: Minor
Found in lib/modules/Admin/Models/Updater/DatabaseUpdater.php - About 2 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function a has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function a() {
            function e() {
                var r = this, l = r.getRuntime(), d, f, p, h, m, g;
                g = t.guid("uid_"), d = l.getShimContainer(), a && (p = n.get(a + "_form"), p && t.extend(p.style, {top: "100%"})), h = document.createElement("form"), h.setAttribute("id", g + "_form"), h.setAttribute("method", "post"), h.setAttribute("enctype", "multipart/form-data"), h.setAttribute("encoding", "multipart/form-data"), t.extend(h.style, {
                    overflow: "hidden",
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js - About 2 hrs to fix

Function r has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        function r(t) {
            var r = this, s = n.capTest, u = n.capTrue, c = e.extend({
                access_binary: s(window.FileReader || window.File && window.File.getAsDataURL),
                access_image_binary: function () {
                    return r.can("access_binary") && !!a.Image
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js - About 2 hrs to fix

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

    $.getJSON(siteurl + "data/resources/fontawesome-icons.json", function (data) {
        for (x in data)
            $("#select-icon-menu").append('<li><a href="javascript:selectIcon(\'' + data[x] + '\');"><i class="fa fa-fw fa-' + data[x] + '"></i>&nbsp;' + data[x] + '</a></li>');
    });
Severity: Major
Found in lib/modules/Admin/styles/appearance/javascript/menus.js and 1 other location - About 2 hrs to fix
lib/modules/Profile/styles/javascript/profile-edit.js on lines 78..81

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

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

            $.getJSON(siteurl + "data/resources/fontawesome-icons.json", function (data) {
                for (x in data)
                    $("#select-icon-menu").append('<li><a href="javascript:selectIcon(\'' + data[x] + '\');"><i class="fa fa-fw fa-' + data[x] + '"></i>&nbsp;' + data[x] + '</a></li>');
            });
Severity: Major
Found in lib/modules/Profile/styles/javascript/profile-edit.js and 1 other location - About 2 hrs to fix
lib/modules/Admin/styles/appearance/javascript/menus.js on lines 2..5

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

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

    $(document).on("mouseenter", ".album-item", function () {
        $(this).find(".buttonbar").show();
    }).on("mouseleave", ".album-item", function () {
        $(this).find(".buttonbar").hide();
    });
Severity: Major
Found in lib/modules/Gallery/styles/javascript/album.js and 1 other location - About 2 hrs to fix
lib/modules/Messages/styles/javascript/conversation.js on lines 18..22

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

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

File ProfileEdit.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * ########################################################################################
 * ## CUNITY(R) V2.0 - An open source social network / "your private social network"     ##
Severity: Minor
Found in lib/modules/Profile/Models/ProfileEdit.php - About 2 hrs to fix

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

        if (getExtentedOption(this, 'first_day') == 1) {
            data.months = [this.locale.d1, this.locale.d2, this.locale.d3, this.locale.d4, this.locale.d5, this.locale.d6, this.locale.d0]
        } else {
Severity: Major
Found in lib/plugins/calendar/js/calendar.min.js and 1 other location - About 2 hrs to fix
lib/plugins/calendar/js/calendar.min.js on lines 254..256

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

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