smartinmedia/cunity

View on GitHub

Showing 617 of 617 total issues

Function loginRequired has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public static function loginRequired()
    {
        if (!self::loggedIn()) {
            $res = self::checkAutoLogin(false);
            if ($res !== false && $res instanceof User) {
Severity: Minor
Found in lib/modules/Register/Models/Login.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

Function delete has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    public function delete($where)
    {
        $module = new Modules();
        $moduleData = $module->fetchRow($where);
        $moduleDirectory = __DIR__.'/../../../../'.ucfirst($moduleData->namespace);
Severity: Minor
Found in lib/modules/Core/Models/Db/Table/Modules.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

Function resolveContainerWidth has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            function resolveContainerWidth() {
                var style, attrs, matches, i, l, attr;

                if (this.opts.width === "off") {
                    return null;
Severity: Minor
Found in lib/plugins/select2/select2.js - About 1 hr to fix

Function unselect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        unselect: function (selected) {
            var val = this.getVal(),
                data,
                index;
            selected = selected.closest(".select2-search-choice");
Severity: Minor
Found in lib/plugins/select2/select2.js - About 1 hr to fix

Function e has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

            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",
                    position: "absolute",
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Function postprocessResults has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        postprocessResults: function (data, initial, noHighlightUpdate) {
            var val = this.getVal(),
                choices = this.results.find(".select2-result"),
                compound = this.results.find(".select2-result-with-children"),
                self = this;
Severity: Minor
Found in lib/plugins/select2/select2.js - About 1 hr to fix

Function init has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                init: function (s) {
                    var u = this, c = u.getRuntime(), l, d, f, p, h, m;
                    a = s, e = [], f = a.accept.mimes || r.extList2mimes(a.accept, c.can("filter_by_extension")), d = c.getShimContainer(), d.innerHTML = '<input id="' + c.uid + '" type="file" style="font-size:999px;opacity:0;"' + (a.multiple && c.can("select_multiple") ? "multiple" : "") + (a.directory && c.can("select_folder") ? "webkitdirectory directory" : "") + (f ? ' accept="' + f.join(",") + '"' : "") + " />", l = n.get(c.uid), t.extend(l.style, {
                        position: "absolute",
                        top: 0,
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Method createThumbnail has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function createThumbnail($width, $height, $target, $thumb, $source, $oldWidth, $oldHeight)
    {
        imagealphablending($thumb, false);
        imagesavealpha($thumb, true);

Severity: Minor
Found in lib/Skoch/Filter/File/Adapter/Gd.php - About 1 hr to fix

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

    var smallNumbers = {
        2: function(masc) { return (masc ? "dva" : "dve"); },
        3: function() { return "tri"; },
        4: function() { return "štyri"; }
    };
Severity: Major
Found in lib/plugins/select2/select2_locale_sk.js and 1 other location - About 1 hr to fix
lib/plugins/select2/select2_locale_cs.js on lines 10..14

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

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

    var smallNumbers = {
        2: function(masc) { return (masc ? "dva" : "dvě"); },
        3: function() { return "tři"; },
        4: function() { return "čtyři"; }
    }
Severity: Major
Found in lib/plugins/select2/select2_locale_cs.js and 1 other location - About 1 hr to fix
lib/plugins/select2/select2_locale_sk.js on lines 9..13

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

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

        formatInputTooLong: function (input, max) {
          var n = input.length - max;
          if (n === 1) {
            return "Idatzi karaktere bat gutxiago";
          } else {
Severity: Major
Found in lib/plugins/select2/select2_locale_eu.js and 1 other location - About 1 hr to fix
lib/plugins/select2/select2_locale_gl.js on lines 21..28

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

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

        formatInputTooShort: function (input, min) {
          var n = min - input.length;
          if (n === 1) {
            return "Idatzi karaktere bat gehiago";
          } else {
Severity: Major
Found in lib/plugins/select2/select2_locale_eu.js and 1 other location - About 1 hr to fix
lib/plugins/select2/select2_locale_gl.js on lines 13..20

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

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

        formatInputTooLong: function (input, max) {
            var n = input.length - max;
            if (n === 1) {
                return "Elimine un carácter";
            } else {
Severity: Major
Found in lib/plugins/select2/select2_locale_gl.js and 1 other location - About 1 hr to fix
lib/plugins/select2/select2_locale_eu.js on lines 21..28

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

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

        formatInputTooShort: function (input, min) {
            var n = min - input.length;
            if (n === 1) {
                return "Engada un carácter";
            } else {
Severity: Major
Found in lib/plugins/select2/select2_locale_gl.js and 1 other location - About 1 hr to fix
lib/plugins/select2/select2_locale_eu.js on lines 13..20

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

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

        function i() {
            var e, i = [];
            t.extend(this, {
                append: function (r, o) {
                    var a = this, s = t.typeOf(o);
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Function prepareOpts has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        prepareOpts: function () {
            var opts = this.parent.prepareOpts.apply(this, arguments),
                self=this;

            if (opts.element.get(0).tagName.toLowerCase() === "select") {
Severity: Minor
Found in lib/plugins/select2/select2.js - About 1 hr to fix

Function query has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                opts.query = this.bind(function (query) {
                    var data = { results: [], more: false },
                        term = query.term,
                        children, placeholderOption, process;

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

Function File has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    }, o.Uploader.prototype = t.EventTarget.instance, o.File = function () {
        function n(n) {
            o.extend(this, {
                id: o.guid(),
                name: n.name || n.fileName,
Severity: Minor
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Method notify has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function notify($receiver, $sender, $type, $target, $ways = ['alert', 'mail'])
    {
        if (is_array($receiver)) {
            foreach ($receiver as $user) {
                self::notify($user['userid'], $sender, $type, $target, $ways);
Severity: Minor
Found in lib/modules/Notifications/Models/Notifier.php - About 1 hr to fix

Method showData has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function showData($type)
    {
        $data = false;
        $cat = new Categories();
        $view = new View();
Severity: Minor
Found in lib/modules/Forums/Models/Process.php - About 1 hr to fix
Severity
Category
Status
Source
Language