smartinmedia/cunity

View on GitHub

Showing 617 of 617 total issues

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

    public function __construct()
    {
        parent::__construct();
        $this->registerCss('events', 'events');
        $this->registerScript('events', 'events');
Severity: Minor
Found in lib/modules/Events/View/Events.php - About 1 hr to fix

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

    public function registerNewUser(array $data, $groupId = 0, $sendVerfificationMail = true)
    {
        $salt = Unique::createSalt(25);

        if (Cunity::get('settings')->getSetting('core.fullname')) {
Severity: Minor
Found in lib/modules/Core/Models/Db/Table/Users.php - About 1 hr to fix

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

    public function deleteImage()
    {
        if ($this->owner_id == Session::get('user')->userid && $this->owner_type === null) {
            $albums = new GalleryAlbums();
            $album = $albums->find($this->albumid);
Severity: Minor
Found in lib/modules/Gallery/Models/Db/Row/Image.php - About 1 hr to fix

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

    private function insert($form)
    {
        $object = new \stdClass();

        switch ($form) {
Severity: Minor
Found in lib/modules/Admin/Models/Process.php - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

                        if (c = h.type || this.type || "image/jpeg", l = h.quality || 90, d = "undefined" !== e.typeOf(h.crop) ? h.crop : !1, h.width)m = h.width, g = h.height || m; else {
                            var y = t.getSize(i);
                            y.w && y.h && (m = y.w, g = y.h)
                        }
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

            if (n = n.toLowerCase(), t[r] && i[t[r]] && i[t[r]][n]) {
                a = i[t[r]][n];
                for (var u = a.length - 1; u >= 0 && (a[u].orig !== o && a[u].key !== o || (t.removeEventListener ? t.removeEventListener(n, a[u].func, !1) : t.detachEvent && t.detachEvent("on" + n, a[u].func), a[u].orig = null, a[u].func = null, a.splice(u, 1), o === s)); u--);
                if (a.length || delete i[t[r]][n], e.isEmptyObj(i[t[r]])) {
                    delete i[t[r]];
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

                    if (R = u || l.user, b = c || l.pass, w = s || !0, w === !1 && (n("timeout") || n("withCredentials") || "" !== n("responseType")))throw new t.DOMException(t.DOMException.INVALID_ACCESS_ERR);
Severity: Major
Found in lib/plugins/plupload/js/plupload.full.min.js - About 1 hr to fix

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

        function n(e, n) {
            switch (n) {
                case"readAsText":
                    return t.atob(e, "utf8");
                case"readAsBinaryString":
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 2685..2695

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

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

        function n(e, n) {
            switch (n) {
                case"readAsText":
                    return t.atob(e, "utf8");
                case"readAsBinaryString":
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 2659..2669

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

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

    if (res.status) {
        $('#' + res.panel + " > .panel-heading .panel-feedback-success").show();
        $('#' + res.panel + " > .panel-heading .panel-feedback-error").hide();
    } else {
Severity: Major
Found in lib/modules/Admin/styles/javascript/cunity-admin.js and 1 other location - About 1 hr to fix
lib/modules/Admin/styles/javascript/cunity-admin.js on lines 67..70

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

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

                        if (((user.privacy.message === 1 && user.status > 1) || user.privacy.message === 3) && typeof selectedReceiver[user.userid] == "undefined")
                            $("#receiver-suggestions").append(tmpl("message-modal-result", {
                                userid: user.userid,
                                name: user.name,
                                profileImage: checkImage(user.pimg, "user", "cr_")
Severity: Major
Found in lib/modules/Messages/styles/javascript/message-modal.js and 1 other location - About 1 hr to fix
lib/modules/Events/styles/javascript/event.js on lines 27..32

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

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

                        if (typeof selectedReceiver[user.userid] == "undefined")
                            $("#guest-suggestions").append(tmpl("event-invitation-result", {
                                userid: user.userid,
                                name: user.name,
                                profileImage: checkImage(user.pimg, "user", "cr_")
Severity: Major
Found in lib/modules/Events/styles/javascript/event.js and 1 other location - About 1 hr to fix
lib/modules/Messages/styles/javascript/message-modal.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 55.

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

                    f = n, d = e(f.accept), s = f.container, i.addEvent(s, "dragover", function (e) {
                        e.preventDefault(), e.stopPropagation(), e.dataTransfer.dropEffect = "copy"
                    }, r.uid), i.addEvent(s, "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 2899..2901

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

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 {
        $('#' + res.panel + " > .panel-heading .panel-feedback-success").hide();
        $('#' + res.panel + " > .panel-heading .panel-feedback-error").show();
    }
Severity: Major
Found in lib/modules/Admin/styles/javascript/cunity-admin.js and 1 other location - About 1 hr to fix
lib/modules/Admin/styles/javascript/cunity-admin.js on lines 64..67

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

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

                return r = i.getShimContainer(), n.addEvent(r, "dragover", function (e) {
                    e.preventDefault(), e.stopPropagation(), e.dataTransfer.dropEffect = "copy"
                }, e.uid), n.addEvent(r, "dragenter", 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 1785..1787

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

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

    public function __construct()
    {
        $action = Get::get('action');
        if (Get::hasAction()) {
            Login::loginRequired();
Severity: Minor
Found in lib/modules/Admin/Controller.php - About 55 mins 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 handleQuery has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    protected function handleQuery()
    {
        if (Get::get('m') === null || Get::get('m') == '') {
            if (Login::loggedIn()) {
                header(
Severity: Minor
Found in lib/modules/Core/Controller.php - About 55 mins 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 handleRequest has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    private function handleRequest()
    {
        $view = new View(true);
        switch (Post::get('action')) {
            case 'loadMenu':
Severity: Minor
Found in lib/modules/Admin/Models/Pages/Appearance.php - About 55 mins 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

                                if (this.isInput) {
                                    element = this.element;
                                }
                                else if (this.component) {
                                    element = this.element.find('input');
Severity: Minor
Found in lib/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js and 1 other location - About 55 mins to fix
lib/plugins/bootstrap-datepicker/js/bootstrap-datepicker.js on lines 1014..1019

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

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

                if (e.which === KEY.TAB || KEY.isControl(e) || KEY.isFunctionKey(e)
                 || e.which === KEY.BACKSPACE || e.which === KEY.ESC) {
Severity: Minor
Found in lib/plugins/select2/select2.js and 1 other location - About 55 mins to fix
lib/plugins/select2/select2.js on lines 2201..2201

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

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