YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/resources/Fields.js

Summary

Maintainability
F
1 mo
Test Coverage

File Fields.js has 3161 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */
'use strict';

window.App.Fields = {
    Date: {
Severity: Major
Found in public_html/layouts/resources/Fields.js - About 1 wk to fix

    Function autoLink has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
    Open

                autoLink() {
                    let fillChar = '\u200B';
                    let sel = window.getSelection(),
                        range = sel.getRangeAt(0).cloneRange(),
                        offset,
    Severity: Minor
    Found in public_html/layouts/resources/Fields.js - About 1 day 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 loadEditor has 164 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                loadEditor(element, customConfig) {
                    this.setElement(element);
                    const instance = this.getEditorInstanceFromName();
                    let config = {
                        language: CONFIG.langKey,
    Severity: Major
    Found in public_html/layouts/resources/Fields.js - About 6 hrs to fix

      Function registerParams has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

              registerParams(selectElement, params) {
                  if (typeof params.dropdownParent === 'undefined') {
                      const modalParent = $(selectElement).closest('.modal-body');
                      if (modalParent.length) {
                          params.dropdownParent = modalParent;
      Severity: Minor
      Found in public_html/layouts/resources/Fields.js - About 4 hrs 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 registerParams has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              registerParams(selectElement, params) {
                  if (typeof params.dropdownParent === 'undefined') {
                      const modalParent = $(selectElement).closest('.modal-body');
                      if (modalParent.length) {
                          params.dropdownParent = modalParent;
      Severity: Major
      Found in public_html/layouts/resources/Fields.js - About 3 hrs to fix

        Function autoLink has 95 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    autoLink() {
                        let fillChar = '\u200B';
                        let sel = window.getSelection(),
                            range = sel.getRangeAt(0).cloneRange(),
                            offset,
        Severity: Major
        Found in public_html/layouts/resources/Fields.js - About 3 hrs to fix

          Function registerRange has 88 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  registerRange(parentElement, customParams = {}) {
                      if (typeof parentElement === 'undefined') {
                          parentElement = $('body');
                      } else {
                          parentElement = $(parentElement);
          Severity: Major
          Found in public_html/layouts/resources/Fields.js - About 3 hrs to fix

            Function registerAjaxParams has 77 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    registerAjaxParams(selectElement, params) {
                        params.tags = false;
                        params.language.searching = function () {
                            return app.vtranslate('JS_SEARCHING');
                        };
            Severity: Major
            Found in public_html/layouts/resources/Fields.js - About 3 hrs to fix

              `` has 25 functions (exceeds 20 allowed). Consider refactoring.
              Open

                  MultiAttachment: class MultiAttachment {
                      /**
                       * Constructor
                       * @param {jQuery} container
                       * @param {Object} options
              Severity: Minor
              Found in public_html/layouts/resources/Fields.js - About 2 hrs to fix

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

                        init() {
                            const field = this.getField();
                            $('.js-pwd-auto-generate', this.container)
                                .off('click')
                                .on('click', (e) => {
                Severity: Major
                Found in public_html/layouts/resources/Fields.js - About 2 hrs to fix

                  Function showSelect2ElementView has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          showSelect2ElementView(selectElement, params) {
                              let self = this;
                              selectElement = $(selectElement);
                              if (typeof params === 'undefined') {
                                  params = {};
                  Severity: Major
                  Found in public_html/layouts/resources/Fields.js - About 2 hrs to fix

                    Function register has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            register(parentElement, registerForAddon, customParams, className = 'dateField') {
                                if (typeof parentElement === 'undefined') {
                                    parentElement = $('body');
                                } else {
                                    parentElement = $(parentElement);
                    Severity: Major
                    Found in public_html/layouts/resources/Fields.js - About 2 hrs to fix

                      Function formatToDisplay has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                      Open

                              formatToDisplay(value, fixed = true, numberOfDecimal = CONFIG.noOfCurrencyDecimals) {
                                  if (!value) {
                                      value = 0;
                                  }
                                  let strDecimal = value.toString().split('.')[1];
                      Severity: Minor
                      Found in public_html/layouts/resources/Fields.js - About 2 hrs 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 init has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              init(customParams) {
                                  $('.input-group-text', this.container.closest('.dateTime')).on('click', function (e) {
                                      $(e.currentTarget).closest('.dateTime').find('input.dateTimePickerField').get(0).focus();
                                  });
                                  let dateFormat = CONFIG.dateFormat.toUpperCase();
                      Severity: Major
                      Found in public_html/layouts/resources/Fields.js - About 2 hrs to fix

                        Function registerAjaxParams has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                                registerAjaxParams(selectElement, params) {
                                    params.tags = false;
                                    params.language.searching = function () {
                                        return app.vtranslate('JS_SEARCHING');
                                    };
                        Severity: Minor
                        Found in public_html/layouts/resources/Fields.js - About 2 hrs 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 createItem has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                                createItem(file) {
                                    const item = document.createElement('fieldset');
                                    item.setAttribute('class', 'c-multi-attachment--file bg-light js-handle');
                                    item.setAttribute('data-key', file.key);
                        
                        
                        Severity: Minor
                        Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                          Function autoCompleteEvent has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  autoCompleteEvent() {
                                      let autoCompleteElement = $('input.treeAutoComplete', this.container);
                                      if (autoCompleteElement.hasClass('ui-autocomplete-input')) {
                                          autoCompleteElement.autocomplete('destroy');
                                      }
                          Severity: Minor
                          Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                            Function saveData has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    saveData(container, data) {
                                        let form = container.find('form');
                                        container.on('click', '.js-modal__save', (e) => {
                                            if (form.validationEngine('validate')) {
                                                e.preventDefault();
                            Severity: Minor
                            Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                              Function showLazySelect has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      showLazySelect(selectElement, params) {
                                          $.fn.select2.amd.require(['select2/data/array', 'select2/utils'], (ArrayData, Utils) => {
                                              function CustomData($element, params) {
                                                  CustomData.__super__.constructor.call(this, $element, params);
                                              }
                              Severity: Minor
                              Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

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

                                        init() {
                                            $('.js-changesjson-edit', this.container)
                                                .off('click')
                                                .on('click', () => {
                                                    let field = this.getField();
                                Severity: Minor
                                Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                  Function register has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                          register(container) {
                                              if (typeof container === 'undefined' || typeof container.length === 'undefined' || !container.length) {
                                                  return app.errorLog('Dependend select field container is missing.');
                                              }
                                              container.each(function () {
                                  Severity: Minor
                                  Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                    Function validate has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                                validate(element) {
                                                    let status = true,
                                                        params;
                                                    const form = element.closest('form');
                                                    if (
                                    Severity: Minor
                                    Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                      Function formatToDisplay has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              formatToDisplay(value, fixed = true, numberOfDecimal = CONFIG.noOfCurrencyDecimals) {
                                                  if (!value) {
                                                      value = 0;
                                                  }
                                                  let strDecimal = value.toString().split('.')[1];
                                      Severity: Minor
                                      Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                        Function registerIconsEvents has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                                registerIconsEvents(selectElement) {
                                                    selectElement.on('select2:selecting', (event) => {
                                                        let currentTarget = $(event.params.args.originalEvent.target);
                                                        if (!currentTarget.hasClass('js-select-option-event') && !currentTarget.is('path')) {
                                                            return;
                                        Severity: Minor
                                        Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                          Function getDateInstance has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                                  getDateInstance: function (dateTime, dateFormat = CONFIG.dateFormat) {
                                                      let dateTimeComponents = dateTime.split(' '),
                                                          dateComponent = dateTimeComponents[0],
                                                          timeComponent = dateTimeComponents[1],
                                                          seconds = '00',
                                          Severity: Minor
                                          Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                            Function getDateInstance has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                                            Open

                                                    getDateInstance: function (dateTime, dateFormat = CONFIG.dateFormat) {
                                                        let dateTimeComponents = dateTime.split(' '),
                                                            dateComponent = dateTimeComponents[0],
                                                            timeComponent = dateTimeComponents[1],
                                                            seconds = '00',
                                            Severity: Minor
                                            Found in public_html/layouts/resources/Fields.js - 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 saveCurrencies has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                                    saveCurrencies(modalContainer) {
                                                        let enabledBaseCurrency = modalContainer.find('.js-enable-currency').filter(':checked');
                                                        if (enabledBaseCurrency.length < 1) {
                                                            Vtiger_Helper_Js.showMessage({
                                                                text: app.vtranslate('JS_PLEASE_SELECT_BASE_CURRENCY_FOR_PRODUCT'),
                                            Severity: Minor
                                            Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                              Function registerMentions has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                          registerMentions() {
                                                              let minSerchTextLength = app.getMainParams('gsMinLength');
                                                              return [
                                                                  {
                                                                      feed: this.getMentionUsersData.bind(this),
                                              Severity: Minor
                                              Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

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

                                                        init() {
                                                            let addButton = $('.js-meeting-add', this.container);
                                                            if (!addButton.length) {
                                                                return false;
                                                            }
                                                Severity: Minor
                                                Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                                  Function registerCopyClipboard has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                          registerCopyClipboard: function (container, key = '.clipboard') {
                                                              if (typeof container !== 'object' || $(container).length === 0) {
                                                                  return;
                                                              }
                                                              container = $(container).get(0);
                                                  Severity: Minor
                                                  Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                                    Function registerAutoComplete has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                            registerAutoComplete() {
                                                                App.Fields.Picklist.showSelect2ElementView(this.select, {
                                                                    ajax: {
                                                                        data: function (item) {
                                                                            return {
                                                    Severity: Minor
                                                    Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                                      Function autoCompleteEvent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                              autoCompleteEvent() {
                                                                  let autoCompleteElement = $('input.treeAutoComplete', this.container);
                                                                  if (autoCompleteElement.hasClass('ui-autocomplete-input')) {
                                                                      autoCompleteElement.autocomplete('destroy');
                                                                  }
                                                      Severity: Minor
                                                      Found in public_html/layouts/resources/Fields.js - 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 loadEditor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                                  loadEditor(element, customConfig) {
                                                                      this.setElement(element);
                                                                      const instance = this.getEditorInstanceFromName();
                                                                      let config = {
                                                                          language: CONFIG.langKey,
                                                      Severity: Minor
                                                      Found in public_html/layouts/resources/Fields.js - 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 registerCopyClipboard has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                                                      Open

                                                              registerCopyClipboard: function (container, key = '.clipboard') {
                                                                  if (typeof container !== 'object' || $(container).length === 0) {
                                                                      return;
                                                                  }
                                                                  container = $(container).get(0);
                                                      Severity: Minor
                                                      Found in public_html/layouts/resources/Fields.js - 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 initEditView has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                              initEditView() {
                                                                  this.fileInput.detach();
                                                                  this.container.on('mouseup', this.openBrowser.bind(this));
                                                                  this.fileInput.fileupload({
                                                                      dataType: 'json',
                                                      Severity: Minor
                                                      Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                                        Function registerMentionCollection has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                                    registerMentionCollection(symbol, searchModule = '-') {
                                                                        let self = this;
                                                                        return {
                                                                            trigger: symbol,
                                                                            selectTemplate: function (item) {
                                                        Severity: Minor
                                                        Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                                          Function getParams has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                                  getParams() {
                                                                      const referenceModule = $('.js-popup-reference-module', this.container).val(),
                                                                          sourceFieldName = this.select.attr('name').slice(0, -2),
                                                                          sourceRecordElement = $('input[name="record"]', this.form),
                                                                          listFilterFieldsJson = this.form.find('input[name="listFilterFields"]').val(),
                                                          Severity: Minor
                                                          Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

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

                                                                    init() {
                                                                        $('.js-multicurrency-event', this.container)
                                                                            .off('click')
                                                                            .on('click', () => {
                                                                                let modal = $('<form>').append(this.container.find('.js-currencies-container .js-currencies-modal').clone());
                                                            Severity: Minor
                                                            Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

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

                                                                      registerEnableCurrencyEvent(container) {
                                                                          container.on('change', '.js-enable-currency', (e) => {
                                                                              let element = $(e.currentTarget);
                                                                              let parentRow = element.closest('tr');
                                                                              if (element.is(':checked')) {
                                                              Severity: Minor
                                                              Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

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

                                                                        getMentionData(text, callback, searchModule = '-') {
                                                                            let basicSearch = new Vtiger_BasicSearch_Js();
                                                                            basicSearch.reduceNumberResults = app.getMainParams('gsAmountResponse');
                                                                            basicSearch.returnHtml = false;
                                                                            basicSearch.searchModule = searchModule;
                                                                Severity: Minor
                                                                Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

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

                                                                              constructor(inputDiv = $('.js-completions').eq(0), params = {}) {
                                                                                  if (typeof inputDiv === 'undefined' || inputDiv.length === 0) {
                                                                                      return;
                                                                                  } else if (inputDiv.length === undefined) {
                                                                                      inputDiv = $(inputDiv);
                                                                  Severity: Minor
                                                                  Found in public_html/layouts/resources/Fields.js - About 1 hr to fix

                                                                    Function register has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            register(parentElement, registerForAddon, customParams, className = 'dateField') {
                                                                                if (typeof parentElement === 'undefined') {
                                                                                    parentElement = $('body');
                                                                                } else {
                                                                                    parentElement = $(parentElement);
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - 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 prependDataTemplate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            prependDataTemplate(optionData) {
                                                                                const span = document.createElement('span');
                                                                                if (optionData.id !== undefined && optionData.id !== '') {
                                                                                    span.innerHTML = optionData.element.dataset.template;
                                                                                    if (optionData.element.dataset.state !== undefined) {
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 45 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 parseToJson has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            parseToJson(element, fields) {
                                                                                let arr = [];
                                                                                let allFields = $(element).find('.js-multi-field-row');
                                                                                let arrayLength = allFields.length;
                                                                                for (let i = 0; i < arrayLength; ++i) {
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 45 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 loadData has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            loadData(modalContainer) {
                                                                                let values = JSON.parse(this.getFieldToSave().val());
                                                                                let baseCurrencyId = values['currencyId'] || CONFIG.currencyId;
                                                                                if (values['currencies'] === undefined) {
                                                                                    values['currencies'] = [];
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 45 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 findOption has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            findOption(selectElement, searchValue, type = 'value') {
                                                                                let foundOption = false;
                                                                                const selectValues = this.getSelectOptions(selectElement);
                                                                                const getFieldValueFromText = () => Object.keys(selectValues).find((key) => selectValues[key] === searchValue);
                                                                                const valueExists = () => selectValues.hasOwnProperty(searchValue);
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 35 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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            init(customParams) {
                                                                                $('.input-group-text', this.container.closest('.dateTime')).on('click', function (e) {
                                                                                    $(e.currentTarget).closest('.dateTime').find('input.dateTimePickerField').get(0).focus();
                                                                                });
                                                                                let dateFormat = CONFIG.dateFormat.toUpperCase();
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 35 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 filterFiles has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            filterFiles(files) {
                                                                                let valid = [],
                                                                                    error = [];
                                                                                if (files.length + this.files.length > this.options.limit) {
                                                                                    error.push({ error: { text: `${app.vtranslate('JS_FILE_LIMIT')} [${this.options.limit}]` } });
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 35 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 strengthMeter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            strengthMeter(pwd) {
                                                                                let score = 0;
                                                                                if (pwd.length > 6) score++;
                                                                                if (pwd.match(/[a-z]/) && pwd.match(/[A-Z]/)) score++;
                                                                                if (pwd.match(/\d+/)) score++;
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 25 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 showSelect2ElementView has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            showSelect2ElementView(selectElement, params) {
                                                                                let self = this;
                                                                                selectElement = $(selectElement);
                                                                                if (typeof params === 'undefined') {
                                                                                    params = {};
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 25 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 registerRange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            registerRange(parentElement, customParams = {}) {
                                                                                if (typeof parentElement === 'undefined') {
                                                                                    parentElement = $('body');
                                                                                } else {
                                                                                    parentElement = $(parentElement);
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 25 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 formatToDisplay has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                                                    Open

                                                                            formatToDisplay(value) {
                                                                                if (!value) {
                                                                                    value = 0;
                                                                                }
                                                                                let groupSeparator = CONFIG.currencyGroupingSeparator;
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js - About 25 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

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

                                                                            getResponse(params) {
                                                                                const aDeferred = $.Deferred();
                                                                                let progressIndicatorElement = $.progressIndicator({ blockInfo: { enabled: true } });
                                                                                AppConnector.request(params)
                                                                                    .done((response) => {
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 day to fix
                                                                    public_html/layouts/resources/app.js on lines 912..933

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

                                                                    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

                                                                            filterFiles(files) {
                                                                                let valid = [],
                                                                                    error = [];
                                                                                if (files.length + this.files.length > this.options.limit) {
                                                                                    error.push({ error: { text: `${app.vtranslate('JS_FILE_LIMIT')} [${this.options.limit}]` } });
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 7 hrs to fix
                                                                    public_html/layouts/resources/app.js on lines 1042..1053

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

                                                                    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

                                                                            validateFileType(file) {
                                                                                let result =
                                                                                    !this.options.formats.length ||
                                                                                    this.options.formats.filter((format) => {
                                                                                        return file.type === format || (format.slice(-2) === '/*' && file.type.indexOf(format.slice(0, -1)) === 0);
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 6 hrs to fix
                                                                    public_html/layouts/resources/app.js on lines 1076..1087

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

                                                                    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

                                                                                this.fileInput.fileupload({
                                                                                    dataType: 'json',
                                                                                    replaceFileInput: false,
                                                                                    fileInput: this.fileInput,
                                                                                    autoUpload: false,
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 6 hrs to fix
                                                                    public_html/layouts/resources/fields/MultiImage.js on lines 42..55

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

                                                                    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

                                                                                        form.find('[id^="selectRow"]').each(function (_, checkbox) {
                                                                                            checkbox = $(checkbox);
                                                                                            if (!checkbox.prop('checked')) {
                                                                                                checkbox
                                                                                                    .closest('.js-form-row-container')
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 4 hrs to fix
                                                                    public_html/layouts/basic/modules/Vtiger/resources/List.js on lines 706..717

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

                                                                    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

                                                                            validateFileSize(file) {
                                                                                let result = typeof file.size === 'number' && file.size < this.options.maxFileSize;
                                                                                if (!result) {
                                                                                    file.error = {
                                                                                        title: `${app.vtranslate('JS_UPLOADED_FILE_SIZE_EXCEEDS')} <br> [${this.options.maxFileSizeDisplay}]`,
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 4 hrs to fix
                                                                    public_html/layouts/resources/app.js on lines 1060..1069

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

                                                                    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

                                                                                this.files = actualElements.map((element) => {
                                                                                    for (let i = 0, len = this.files.length; i < len; i++) {
                                                                                        const elementHash = $(element).data('key');
                                                                                        if (this.files[i].key === elementHash) {
                                                                                            return this.files[i];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 3 hrs to fix
                                                                    public_html/layouts/resources/fields/MultiImage.js on lines 660..667

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

                                                                    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

                                                                            static register(container) {
                                                                                if (container.hasClass('js-multicurrency-container')) {
                                                                                    return new MultiCurrency(container);
                                                                                }
                                                                                const instances = [];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 7 other locations - About 2 hrs to fix
                                                                    public_html/layouts/resources/Fields.js on lines 2290..2299
                                                                    public_html/layouts/resources/Fields.js on lines 2438..2447
                                                                    public_html/layouts/resources/Fields.js on lines 2755..2764
                                                                    public_html/layouts/resources/Fields.js on lines 2859..2868
                                                                    public_html/layouts/resources/Fields.js on lines 2989..2998
                                                                    public_html/layouts/resources/Fields.js on lines 3156..3165
                                                                    public_html/layouts/resources/Fields.js on lines 3787..3797

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

                                                                    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

                                                                            static register(container) {
                                                                                if (container.hasClass('js-meeting-container')) {
                                                                                    return new MeetingUrl(container);
                                                                                }
                                                                                const instances = [];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 7 other locations - About 2 hrs to fix
                                                                    public_html/layouts/resources/Fields.js on lines 2290..2299
                                                                    public_html/layouts/resources/Fields.js on lines 2438..2447
                                                                    public_html/layouts/resources/Fields.js on lines 2540..2549
                                                                    public_html/layouts/resources/Fields.js on lines 2859..2868
                                                                    public_html/layouts/resources/Fields.js on lines 2989..2998
                                                                    public_html/layouts/resources/Fields.js on lines 3156..3165
                                                                    public_html/layouts/resources/Fields.js on lines 3787..3797

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

                                                                    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

                                                                            static register(container) {
                                                                                if (container.hasClass('js-multiReference-container')) {
                                                                                    return new MultiReference(container);
                                                                                }
                                                                                const instances = [];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 7 other locations - About 2 hrs to fix
                                                                    public_html/layouts/resources/Fields.js on lines 2290..2299
                                                                    public_html/layouts/resources/Fields.js on lines 2438..2447
                                                                    public_html/layouts/resources/Fields.js on lines 2540..2549
                                                                    public_html/layouts/resources/Fields.js on lines 2755..2764
                                                                    public_html/layouts/resources/Fields.js on lines 2859..2868
                                                                    public_html/layouts/resources/Fields.js on lines 3156..3165
                                                                    public_html/layouts/resources/Fields.js on lines 3787..3797

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

                                                                    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

                                                                            static register(container) {
                                                                                if (container.hasClass('js-changesjson-container')) {
                                                                                    return new ChangesJson(container);
                                                                                }
                                                                                const instances = [];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 7 other locations - About 2 hrs to fix
                                                                    public_html/layouts/resources/Fields.js on lines 2290..2299
                                                                    public_html/layouts/resources/Fields.js on lines 2438..2447
                                                                    public_html/layouts/resources/Fields.js on lines 2540..2549
                                                                    public_html/layouts/resources/Fields.js on lines 2755..2764
                                                                    public_html/layouts/resources/Fields.js on lines 2989..2998
                                                                    public_html/layouts/resources/Fields.js on lines 3156..3165
                                                                    public_html/layouts/resources/Fields.js on lines 3787..3797

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

                                                                    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

                                                                            static register(container) {
                                                                                if (container.hasClass('js-icon-container')) {
                                                                                    return new Icon(container);
                                                                                }
                                                                                const instances = [];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 7 other locations - About 2 hrs to fix
                                                                    public_html/layouts/resources/Fields.js on lines 2290..2299
                                                                    public_html/layouts/resources/Fields.js on lines 2438..2447
                                                                    public_html/layouts/resources/Fields.js on lines 2540..2549
                                                                    public_html/layouts/resources/Fields.js on lines 2755..2764
                                                                    public_html/layouts/resources/Fields.js on lines 2859..2868
                                                                    public_html/layouts/resources/Fields.js on lines 2989..2998
                                                                    public_html/layouts/resources/Fields.js on lines 3156..3165

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

                                                                    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

                                                                            static register(container) {
                                                                                if (container.hasClass('c-time-period')) {
                                                                                    return new TimePeriod(container);
                                                                                }
                                                                                const instances = [];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 7 other locations - About 2 hrs to fix
                                                                    public_html/layouts/resources/Fields.js on lines 2290..2299
                                                                    public_html/layouts/resources/Fields.js on lines 2540..2549
                                                                    public_html/layouts/resources/Fields.js on lines 2755..2764
                                                                    public_html/layouts/resources/Fields.js on lines 2859..2868
                                                                    public_html/layouts/resources/Fields.js on lines 2989..2998
                                                                    public_html/layouts/resources/Fields.js on lines 3156..3165
                                                                    public_html/layouts/resources/Fields.js on lines 3787..3797

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

                                                                    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

                                                                            static register(container) {
                                                                                if (container.hasClass('js-pwd-container')) {
                                                                                    return new Password(container);
                                                                                }
                                                                                const instances = [];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 7 other locations - About 2 hrs to fix
                                                                    public_html/layouts/resources/Fields.js on lines 2290..2299
                                                                    public_html/layouts/resources/Fields.js on lines 2438..2447
                                                                    public_html/layouts/resources/Fields.js on lines 2540..2549
                                                                    public_html/layouts/resources/Fields.js on lines 2755..2764
                                                                    public_html/layouts/resources/Fields.js on lines 2859..2868
                                                                    public_html/layouts/resources/Fields.js on lines 2989..2998
                                                                    public_html/layouts/resources/Fields.js on lines 3787..3797

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

                                                                    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

                                                                            static register(container) {
                                                                                if (container.hasClass('js-tree-container')) {
                                                                                    return new Tree(container);
                                                                                }
                                                                                const instances = [];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 7 other locations - About 2 hrs to fix
                                                                    public_html/layouts/resources/Fields.js on lines 2438..2447
                                                                    public_html/layouts/resources/Fields.js on lines 2540..2549
                                                                    public_html/layouts/resources/Fields.js on lines 2755..2764
                                                                    public_html/layouts/resources/Fields.js on lines 2859..2868
                                                                    public_html/layouts/resources/Fields.js on lines 2989..2998
                                                                    public_html/layouts/resources/Fields.js on lines 3156..3165
                                                                    public_html/layouts/resources/Fields.js on lines 3787..3797

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

                                                                    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 (offset.left - $window.scrollLeft() + picker.container.outerWidth() > $window.width()) {
                                                                                    picker.opens = 'left';
                                                                                } else {
                                                                                    picker.opens = 'right';
                                                                                }
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 hr to fix
                                                                    public_html/layouts/resources/Fields.js on lines 3890..3894

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

                                                                    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 (offset.top - $window.scrollTop() + picker.container.outerHeight() > $window.height()) {
                                                                                    picker.drops = 'up';
                                                                                } else {
                                                                                    picker.drops = 'down';
                                                                                }
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 hr to fix
                                                                    public_html/layouts/resources/Fields.js on lines 3884..3888

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

                                                                    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

                                                                                for (let i = 0, len = this.files.length; i < len; i++) {
                                                                                    const file = this.files[i];
                                                                                    if (file.key === key) {
                                                                                        return file;
                                                                                    }
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 hr to fix
                                                                    public_html/layouts/resources/fields/MultiImage.js on lines 133..138

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

                                                                    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

                                                                                    $multiEmailField.on('click', '.js-multi-email-consenticon', (e) => {
                                                                                        App.Fields.MultiEmail.toggleConsent($(e.target));
                                                                                        App.Fields.MultiEmail.parseToJSON($multiEmailField);
                                                                                    });
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 hr to fix
                                                                    public_html/layouts/resources/Fields.js on lines 1957..1960

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

                                                                    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

                                                                                    $multiEmailField.on('click', '.js-multi-email-remove', (e) => {
                                                                                        App.Fields.MultiEmail.removeItem($(e.target));
                                                                                        App.Fields.MultiEmail.parseToJSON($multiEmailField);
                                                                                    });
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 hr to fix
                                                                    public_html/layouts/resources/Fields.js on lines 1950..1953

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

                                                                    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

                                                                            showError(error) {
                                                                                if (typeof error.type === 'undefined') {
                                                                                    error.type = 'error';
                                                                                }
                                                                                error.textTrusted = false;
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 hr to fix
                                                                    public_html/layouts/resources/app.js on lines 1099..1105

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

                                                                    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

                                                                                ranges[app.vtranslate('JS_LAST_6_MONTHS')] = [
                                                                                    moment().subtract(6, 'month').startOf('month'),
                                                                                    moment().subtract(1, 'month').endOf('month')
                                                                                ];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 4 other locations - About 1 hr to fix
                                                                    public_html/layouts/resources/Fields.js on lines 185..188
                                                                    public_html/layouts/resources/Fields.js on lines 189..192
                                                                    public_html/layouts/resources/Fields.js on lines 193..196
                                                                    public_html/layouts/resources/Fields.js on lines 197..200

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

                                                                    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

                                                                                ranges[app.vtranslate('JS_NEXT_MONTH')] = [
                                                                                    moment().add(1, 'month').startOf('month'),
                                                                                    moment().add(1, 'month').endOf('month')
                                                                                ];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 4 other locations - About 1 hr to fix
                                                                    public_html/layouts/resources/Fields.js on lines 189..192
                                                                    public_html/layouts/resources/Fields.js on lines 193..196
                                                                    public_html/layouts/resources/Fields.js on lines 197..200
                                                                    public_html/layouts/resources/Fields.js on lines 202..205

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

                                                                    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

                                                                                ranges[app.vtranslate('JS_NEXT_MONTH')] = [
                                                                                    moment().add(1, 'month').startOf('month'),
                                                                                    moment().add(1, 'month').endOf('month')
                                                                                ];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 4 other locations - About 1 hr to fix
                                                                    public_html/layouts/resources/Fields.js on lines 185..188
                                                                    public_html/layouts/resources/Fields.js on lines 189..192
                                                                    public_html/layouts/resources/Fields.js on lines 197..200
                                                                    public_html/layouts/resources/Fields.js on lines 202..205

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

                                                                    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

                                                                                ranges[app.vtranslate('JS_LAST_MONTH')] = [
                                                                                    moment().subtract(1, 'month').startOf('month'),
                                                                                    moment().subtract(1, 'month').endOf('month')
                                                                                ];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 4 other locations - About 1 hr to fix
                                                                    public_html/layouts/resources/Fields.js on lines 185..188
                                                                    public_html/layouts/resources/Fields.js on lines 193..196
                                                                    public_html/layouts/resources/Fields.js on lines 197..200
                                                                    public_html/layouts/resources/Fields.js on lines 202..205

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

                                                                    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

                                                                                ranges[app.vtranslate('JS_LAST_3_MONTHS')] = [
                                                                                    moment().subtract(3, 'month').startOf('month'),
                                                                                    moment().subtract(1, 'month').endOf('month')
                                                                                ];
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 4 other locations - About 1 hr to fix
                                                                    public_html/layouts/resources/Fields.js on lines 185..188
                                                                    public_html/layouts/resources/Fields.js on lines 189..192
                                                                    public_html/layouts/resources/Fields.js on lines 193..196
                                                                    public_html/layouts/resources/Fields.js on lines 202..205

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

                                                                    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

                                                                                if (typeof jqXHR.responseJSON === 'undefined' || jqXHR.responseJSON === null) {
                                                                                    return this.showError({
                                                                                        title: app.vtranslate('JS_FILE_UPLOAD_ERROR'),
                                                                                        type: 'error'
                                                                                    });
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 hr to fix
                                                                    public_html/layouts/resources/app.js on lines 1116..1121

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

                                                                    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

                                                                                files.forEach((file) => {
                                                                                    this.showError({
                                                                                        title: app.vtranslate('JS_FILE_UPLOAD_ERROR'),
                                                                                        text: file.name,
                                                                                        type: 'error'
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 hr to fix
                                                                    public_html/layouts/resources/app.js on lines 1122..1128

                                                                    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

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

                                                                                if (this.filesActive) {
                                                                                    e.preventDefault();
                                                                                    e.stopPropagation();
                                                                                    e.stopImmediatePropagation();
                                                                                    app.showAlert(app.vtranslate('JS_WAIT_FOR_FILE_UPLOAD'));
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 1 hr to fix
                                                                    public_html/layouts/resources/fields/MultiImage.js on lines 86..92

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

                                                                                        AppConnector.request({
                                                                                            module: value.module,
                                                                                            record: value.record,
                                                                                            changes: value.changes,
                                                                                            sourceModule: field.data('module'),
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 3 other locations - About 1 hr to fix
                                                                    public_html/layouts/basic/modules/Settings/AdminAccess/resources/Index.js on lines 66..76
                                                                    public_html/layouts/basic/modules/Users/resources/Groups.js on lines 42..50
                                                                    public_html/layouts/resources/Fields.js on lines 2777..2796

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

                                                                                    AppConnector.request(this.getUrl(e))
                                                                                        .done((data) => {
                                                                                            let result = data.result;
                                                                                            if (result && result.success && result.url) {
                                                                                                valElement.attr('readonly', true).val(result.url);
                                                                    Severity: Major
                                                                    Found in public_html/layouts/resources/Fields.js and 3 other locations - About 1 hr to fix
                                                                    public_html/layouts/basic/modules/Settings/AdminAccess/resources/Index.js on lines 66..76
                                                                    public_html/layouts/basic/modules/Users/resources/Groups.js on lines 42..50
                                                                    public_html/layouts/resources/Fields.js on lines 2888..2912

                                                                    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

                                                                                ranges[app.vtranslate('JS_NEXT_6_MONTHS')] = [moment().startOf('month'), moment().add(6, 'month').endOf('month')];
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 55 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 201..201

                                                                    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

                                                                                ranges[app.vtranslate('JS_NEXT_3_MONTHS')] = [moment().startOf('month'), moment().add(3, 'month').endOf('month')];
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 55 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 206..206

                                                                    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

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

                                                                                        if (!form.find('input[id^="selectRow"]:checked').length) {
                                                                                            app.showNotify({
                                                                                                text: app.vtranslate('JS_NONE_FIELD_MARKED_IN_MASS_EDIT'),
                                                                                                type: 'error'
                                                                                            });
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 50 mins to fix
                                                                    public_html/layouts/basic/modules/Vtiger/resources/List.js on lines 937..943

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

                                                                    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

                                                                                    completionsContainer.find('.js-completions__records').on('click', (e) => {
                                                                                        this.completionsCollection.showMenuForCollection(this.inputDiv[0], 0);
                                                                                    });
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 45 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 1275..1277

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

                                                                    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

                                                                                    completionsContainer.find('.js-completions__users').on('click', (e) => {
                                                                                        this.completionsCollection.showMenuForCollection(this.inputDiv[0], 1);
                                                                                    });
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 45 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 1278..1280

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

                                                                    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 (item.text === '') {
                                                                                            span.innerText = item.name;
                                                                                        } else {
                                                                                            span.innerText = item.text;
                                                                                        }
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 40 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 1641..1645

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

                                                                    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 (data.text === '') {
                                                                                        span.innerText = data.name;
                                                                                    } else {
                                                                                        span.innerText = data.text;
                                                                                    }
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 40 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 1550..1554

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

                                                                    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

                                                                                if (enabledBaseCurrency.length < 1) {
                                                                                    Vtiger_Helper_Js.showMessage({
                                                                                        text: app.vtranslate('JS_PLEASE_SELECT_BASE_CURRENCY_FOR_PRODUCT'),
                                                                                        type: 'error'
                                                                                    });
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 2 other locations - About 40 mins to fix
                                                                    public_html/layouts/basic/modules/Contacts/resources/Edit.js on lines 24..30
                                                                    public_html/layouts/resources/Fields.js on lines 2646..2652

                                                                    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

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

                                                                                if (selectedBaseCurrency.length < 1) {
                                                                                    Vtiger_Helper_Js.showMessage({
                                                                                        text: app.vtranslate('JS_PLEASE_ENABLE_BASE_CURRENCY_FOR_PRODUCT'),
                                                                                        type: 'error'
                                                                                    });
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 2 other locations - About 40 mins to fix
                                                                    public_html/layouts/basic/modules/Contacts/resources/Edit.js on lines 24..30
                                                                    public_html/layouts/resources/Fields.js on lines 2638..2644

                                                                    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

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

                                                                                    open: function (event, ui) {
                                                                                        //To Make the menu come up in the case of quick create
                                                                                        $(this).data('ui-autocomplete').menu.element.css('z-index', '100001');
                                                                                    }
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 35 mins to fix
                                                                    public_html/layouts/basic/modules/Vtiger/resources/Edit.js on lines 514..517

                                                                    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

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

                                                                            showErrors(errors = []) {
                                                                                for (let info of errors) {
                                                                                    this.showError(info.error);
                                                                                }
                                                                            }
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 35 mins to fix
                                                                    public_html/layouts/resources/app.js on lines 1091..1095

                                                                    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

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

                                                                                        if (item.element && item.element.className) {
                                                                                            $(container).addClass(item.element.className);
                                                                                        }
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 35 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 1525..1527

                                                                    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

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

                                                                                ranges[app.vtranslate('JS_YESTERDAY')] = [moment().subtract(1, 'days'), moment().subtract(1, 'days')];
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 35 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 180..180

                                                                    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

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

                                                                                ranges[app.vtranslate('JS_TOMORROW')] = [moment().add(1, 'days'), moment().add(1, 'days')];
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 35 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 181..181

                                                                    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

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

                                                                                        if (data.element && data.element.className) {
                                                                                            $(container).addClass(data.element.className);
                                                                                        }
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 35 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 1546..1548

                                                                    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

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

                                                                                    el.daterangepicker(currentParams)
                                                                                        .on('apply.daterangepicker', function (_ev, picker) {
                                                                                            $(this).val(
                                                                                                picker.startDate.format(currentParams.locale.format) +
                                                                                                    ',' +
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 30 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 479..491

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

                                                                    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

                                                                                this.container
                                                                                    .daterangepicker(params)
                                                                                    .on('apply.daterangepicker', function applyDateRangePickerHandler(_ev, picker) {
                                                                                        if (isDateRangePicker) {
                                                                                            $(this).val(picker.startDate.format(format));
                                                                    Severity: Minor
                                                                    Found in public_html/layouts/resources/Fields.js and 1 other location - About 30 mins to fix
                                                                    public_html/layouts/resources/Fields.js on lines 230..245

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

                                                                    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