YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Settings/Countries/resources/Index.js

Summary

Maintainability
F
5 days
Test Coverage

Function registerAllStatuses has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        registerAllStatuses: function (content) {
            var thisInstance = this;
            content.find('button.all-statuses').on('click', function () {
                var status = thisInstance.allStatuses ? 0 : 1;
                AppConnector.request({

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

            registerPhone: function (content) {
                content.find('button.phone').on('click', function () {
                    var element = $(this);
                    var id = element.closest('tr').data('id');
                    var phone = element.data('phone') ? 0 : 1;
    public_html/layouts/basic/modules/Settings/Countries/resources/Index.js on lines 29..53
    public_html/layouts/basic/modules/Settings/Countries/resources/Index.js on lines 79..103

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

    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

            registerUitype: function (content) {
                content.find('button.uitype').on('click', function () {
                    var element = $(this);
                    var id = element.closest('tr').data('id');
                    var uitype = element.data('uitype') ? 0 : 1;
    public_html/layouts/basic/modules/Settings/Countries/resources/Index.js on lines 29..53
    public_html/layouts/basic/modules/Settings/Countries/resources/Index.js on lines 54..78

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

    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

            registerStatus: function (content) {
                content.find('button.status').on('click', function () {
                    var element = $(this);
                    var id = element.closest('tr').data('id');
                    var status = element.data('status') ? 0 : 1;
    public_html/layouts/basic/modules/Settings/Countries/resources/Index.js on lines 54..78
    public_html/layouts/basic/modules/Settings/Countries/resources/Index.js on lines 79..103

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

    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

            registerRowToBottom: function (content) {
                var thisInstance = this;
                content.find('button.to-bottom').on('click', function () {
                    var row = $(this).closest('tr');
                    $(this).closest('table.listViewEntriesTable tbody').append(row);
    public_html/layouts/basic/modules/Settings/Countries/resources/Index.js on lines 137..144

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

    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

            registerRowToTop: function (content) {
                var thisInstance = this;
                content.find('button.to-top').on('click', function () {
                    var row = $(this).closest('tr');
                    $(this).closest('table.listViewEntriesTable tbody').prepend(row);
    public_html/layouts/basic/modules/Settings/Countries/resources/Index.js on lines 145..152

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

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

                    AppConnector.request({
                        module: app.getModuleName(),
                        parent: app.getParentModuleName(),
                        action: 'SaveAjax',
                        mode: 'updateAllStatuses',
    public_html/layouts/basic/modules/CustomView/resources/CustomView.js on lines 334..347
    public_html/layouts/basic/modules/Settings/InterestsConflict/resources/Index.js on lines 51..63
    public_html/layouts/basic/modules/Settings/Mail/resources/List.js on lines 14..25
    public_html/layouts/basic/modules/Settings/ModuleManager/resources/ModuleManager.js on lines 59..76
    public_html/layouts/basic/modules/Settings/PublicHoliday/resources/PublicHoliday.js on lines 271..285
    public_html/layouts/basic/modules/Settings/RecordNumbering/resources/Index.js on lines 110..127
    public_html/layouts/basic/modules/Vtiger/resources/Detail.js on lines 156..165

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

    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

                $('tbody tr').each(function (i) {
                    sequenceList[++i] = $(this).data('id');
                });
    public_html/layouts/basic/modules/Settings/CronTasks/resources/List.js on lines 104..106

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

    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

    There are no issues that match your filters.

    Category
    Status