File Index.js
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*+***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
Function registerWarningsAlert
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerWarningsAlert: function () {
const alertsContainer = $('#systemWarningAletrs');
if (alertsContainer.length) {
app.showModalWindow(alertsContainer, function () {
alertsContainer.find('.warning').first().removeClass('d-none');
Function registerIconsSelect
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerIconsSelect(container, params) {
AppConnector.request(
$.extend(
{
module: app.getModuleName(),
Function registerAddShortcutDragDropEvent
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerAddShortcutDragDropEvent: function () {
var elements = $('.js-menu__item .js-menu__link--draggable');
var self = this;
var classes = 'ui-draggable-menuShortcut bg-warning';
elements.draggable({
Function registerDeleteShortCutEvent
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerDeleteShortCutEvent: function (shortcutsContainer = $('.js-shortcuts')) {
shortcutsContainer.on('click', '.unpin', (e) => {
e.preventDefault();
var actionEle = $(e.currentTarget);
var closestBlock = actionEle.closest('.js-shortcut');
Function registerPinShortCutEvent
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerPinShortCutEvent: function (element) {
const id = element.data('id');
const url =
'index.php?module=Vtiger&parent=Settings&action=Basic&mode=updateFieldPinnedStatus&pin=true&fieldid=' + id;
const progressIndicatorElement = $.progressIndicator({
Similar blocks of code found in 2 locations. Consider refactoring. Open
widgets.on('hidden.bs.collapse', function (e) {
var widgetContainer = $(e.currentTarget);
var quickWidgetHeader = widgetContainer.closest('.quickWidget').find('.quickWidgetHeader');
var imageEle = quickWidgetHeader.find('.imageElement');
var imagePath = imageEle.data('rightimage');
- Read upRead up
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 98.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
widgets.on('shown.bs.collapse', function (e) {
var widgetContainer = $(e.currentTarget);
var quickWidgetHeader = widgetContainer.closest('.quickWidget').find('.quickWidgetHeader');
var imageEle = quickWidgetHeader.find('.imageElement');
var imagePath = imageEle.data('downimage');
- Read upRead up
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 98.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (isExist) {
var params = {
title: app.vtranslate('JS_MESSAGE'),
text: app.vtranslate('JS_SHORTCUT_ALREADY_ADDED'),
type: 'info'
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76