smartinmedia/cunity

View on GitHub

Showing 617 of 617 total issues

Function loadSinglePost has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function loadSinglePost(postid) {
    sendRequest({"postid": postid}, "newsfeed", "loadPost", function (res) {
        if ((typeof res.likes === "undefined" || res.likes.length === 0) && (typeof res.dislikes === "undefined" || res.dislikes.length === 0))
            $("#post-" + postid + " .newsfeed-post-detail-likebox").hide();
        else
Severity: Minor
Found in lib/modules/Newsfeed/styles/javascript/newsfeed.js - About 1 hr to fix

Function Datepicker has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var Datepicker = function(element, options) {
        this.dates = new DateArray();
        this.viewDate = UTCToday();
        this.focusDate = null;

Severity: Minor
Found in lib/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js - About 1 hr to fix

Function createChoice has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        createChoice: function (data) {
            var enableChoice = !data.locked,
                enabledItem = $(
                    "<li class='select2-search-choice'>" +
                    "    <div></div>" +
Severity: Minor
Found in lib/plugins/select2/select2.js - About 1 hr to fix

Function success has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        success: function () {
            uploader = new plupload.Uploader({
                runtimes: 'html5,flash,silverlight,html4',
                browse_button: 'newsfeed-upload',
                multi_selection: false,
Severity: Minor
Found in lib/modules/Newsfeed/styles/javascript/newsfeed.js - About 1 hr to fix

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

        function a() {
            var e = [], a;
            t.extend(this, {
                init: function (s) {
                    var u = this, c = u.getRuntime(), l, d, f, p, h, m;
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Function populateResults has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                populateResults: function(container, results, query) {
                    var populate, id=this.opts.id, liveRegion=this.liveRegion;

                    populate=function(results, container, depth) {

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

Function sendRequest has a Cognitive Complexity of 13 (exceeds 5 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

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

                send: function (d, f) {
                    function p() {
                        var n = m.getShimContainer() || document.body, r = document.createElement("div");
                        r.innerHTML = '<iframe id="' + g + '_iframe" name="' + g + '_iframe" src="javascript:&quot;&quot;" style="display:none"></iframe>', l = r.firstChild, n.appendChild(l), o.addEvent(l, "load", function () {
                            var n;
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Function success has 39 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            success: function () {
                uploader = new plupload.Uploader({
                    runtimes: 'html5,flash,silverlight,html4',
                    browse_button: type + '-upload',
                    multi_selection: false,
Severity: Minor
Found in lib/modules/Profile/styles/javascript/profile-edit.js - About 1 hr to fix

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

        if (res.footer !== null && res.footer.length > 0)
            for (x in res.footer)
                $("#footer-menu-list").append(tmpl("menu-item", res.footer[x]));
Severity: Major
Found in lib/modules/Admin/styles/appearance/javascript/menus.js and 2 other locations - About 1 hr to fix
lib/modules/Admin/styles/appearance/javascript/menus.js on lines 45..47
lib/modules/Admin/styles/settings/javascript/pages.js on lines 50..52

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

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

        if (res.pages !== null && res.pages.length > 0)
            for (x in res.pages)
                $("#pagesbody").append(tmpl("pages-row", res.pages[x]));
Severity: Major
Found in lib/modules/Admin/styles/settings/javascript/pages.js and 2 other locations - About 1 hr to fix
lib/modules/Admin/styles/appearance/javascript/menus.js on lines 45..47
lib/modules/Admin/styles/appearance/javascript/menus.js on lines 48..50

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

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

$(document).ready(function () {
    $('#updateButton').on('click', function () {
        var $btn = $(this).button('loading');
        update();
    });
lib/modules/Admin/styles/update/javascript/update.js on lines 1..6

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

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

$(document).ready(function () {
    $('#updateButton').on('click', function () {
        var $btn = $(this).button('loading');
        update();
    });
Severity: Major
Found in lib/modules/Admin/styles/update/javascript/update.js and 1 other location - About 1 hr to fix
lib/modules/Admin/styles/filesharing/javascript/filesharing.js on lines 1..6

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

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

        if (res.main !== null && res.main.length > 0)
            for (x in res.main)
                $("#main-menu-list").append(tmpl("menu-item", res.main[x]));
Severity: Major
Found in lib/modules/Admin/styles/appearance/javascript/menus.js and 2 other locations - About 1 hr to fix
lib/modules/Admin/styles/appearance/javascript/menus.js on lines 48..50
lib/modules/Admin/styles/settings/javascript/pages.js on lines 50..52

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

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

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

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

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

Refactorings

Further Reading

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

        else if (data.partners.length === 1 && $("#chat-user-" + data.partners[0]).length === 1 && userData.onlineStatus === 1 && userData.online === 1)
            $("#chat-panel-" + data.conversation_id + " .panel-heading i.fa:first").addClass("fa-circle chat-panel-status-active");
Severity: Major
Found in lib/modules/Messages/styles/javascript/chat.js and 1 other location - About 1 hr to fix
lib/modules/Messages/styles/javascript/chat.js on lines 77..80

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

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

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

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

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

Refactorings

Further Reading

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

        else if (data.partners.length === 1 && $("#chat-user-" + data.partners[0]).length === 1 && userData.onlineStatus === 0 && userData.online === 1)
            $("#chat-panel-" + data.conversation_id + " .panel-heading i.fa:first").addClass("fa-circle chat-panel-status-inactive");
        else if (data.partners.length === 1 && $("#chat-user-" + data.partners[0]).length === 1 && userData.onlineStatus === 1 && userData.online === 1)
            $("#chat-panel-" + data.conversation_id + " .panel-heading i.fa:first").addClass("fa-circle chat-panel-status-active");
Severity: Major
Found in lib/modules/Messages/styles/javascript/chat.js and 1 other location - About 1 hr to fix
lib/modules/Messages/styles/javascript/chat.js on lines 79..80

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

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

            function f(e, t, n) {
                var r = a[e];
                switch (e) {
                    case"max_file_size":
                        e === "max_file_size" && (a.max_file_size = a.filters.max_file_size = t);
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Function callback has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                    callback: this.bind(function (data) {
                var def; // default choice

                // ignore old responses
                if (queryNumber != this.queryCount) {
Severity: Minor
Found in lib/plugins/select2/select2.js - About 1 hr to fix

Method handleRequest has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function handleRequest()
    {
        switch (Request::get('action')) {
            case 'sendTestMail':
                $mail = new Mail();
Severity: Minor
Found in lib/modules/Admin/Models/Pages/Settings.php - About 1 hr to fix

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

    $("#newfiles_modal input[name='privacy']").change(function () {
        if ($("#newfiles_shared").is(":checked"))
            $("#newfiles_shared_options").show();
        else
            $("#newfiles_shared_options").hide();
Severity: Major
Found in lib/modules/Filesharing/styles/javascript/filesharing.js and 2 other locations - About 1 hr to fix
lib/modules/Admin/styles/settings/javascript/mail.js on lines 24..29
lib/modules/Gallery/styles/javascript/album-edit.js on lines 24..29

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

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