YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/OSSTimeControl/resources/QuickCreate.js

Summary

Maintainability
F
3 days
Test Coverage

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

    registerSwitchEvents() {
        if (app.getMainParams('hiddenDays', true) !== false) {
            this.switchContainer.html(this.createSwitch());
            this.switchContainer.find('input').on('change', (e) => {
                const currentTarget = $(e.currentTarget);
public_html/layouts/basic/modules/Calendar/resources/CalendarQuickCreate.js on lines 58..74
public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 48..64
public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 48..64

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

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

    setCalendarModuleOptions() {
        let options = super.setCalendarModuleOptions();
        options.selectable = true;
        options.eventClick = function (info) {
            info.jsEvent.preventDefault();
public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 22..33
public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 22..33

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

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

    createSwitch() {
        let on = app.vtranslate('JS_WORK_DAYS'),
            off = app.vtranslate('JS_ALL'),
            state = this.isSwitchAllDays;
        return `<div class="btn-group btn-group-toggle js-switch c-calendar-switch" data-toggle="buttons">
public_html/layouts/basic/modules/Calendar/resources/CalendarQuickCreate.js on lines 79..91
public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 69..81
public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 69..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 113.

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

    constructor(container, readonly) {
        super(container, readonly);
        this.isSwitchAllDays = false;
        this.sidebarName = 'add'; //available: add, status, edit
        this.eventCreate = false;
public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 9..17
public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 9..17

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

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

    registerEvents() {
        const calendarView = this.getCalendarView();
        this.switchContainer = $(`<div class="js-calendar-switch-container"></div>`).insertAfter(
            calendarView.find('.fc-center')
        );
public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 37..44
public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 37..44

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

$.Class(
    'OSSTimeControl_QuickCreate_Js',
    {},
    {
        registerEvents: function (container) {
public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 123..132
public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 124..133

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

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

        if (this.sidebarName === 'status') {
            this.sidebarName = 'add';
            this.getCalendarCreateView().done(() => {
                this.selectDays(info);
            });
public_html/layouts/basic/modules/Calendar/resources/CalendarQuickCreate.js on lines 106..112
public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 103..109
public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 102..108

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

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

    registerUsersChange() {
        this.container.find('.assigned_user_id').on('change', () => {
            this.reloadCalendarData();
        });
    }
public_html/layouts/basic/modules/Calendar/resources/CalendarQuickCreate.js on lines 95..99
public_html/layouts/basic/modules/CustomView/resources/CustomView.js on lines 374..378
public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 85..89
public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 85..89

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

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

    getSelectedUsersCalendar() {
        return { selectedIds: [this.container.find('.assigned_user_id').val()], excludedIds: [] };
    }
public_html/layouts/basic/modules/Calendar/resources/CalendarQuickCreate.js on lines 39..41
public_html/layouts/basic/modules/Occurrences/resources/QuickCreate.js on lines 94..96
public_html/layouts/basic/modules/Reservations/resources/QuickCreate.js on lines 94..96

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

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