YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Settings/Vtiger/resources/Tax.js

Summary

Maintainability
D
2 days
Test Coverage

Function editTax has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        editTax: function (url, currentTrElement) {
            var aDeferred = jQuery.Deferred();
            var thisInstance = this;

            var progressIndicatorElement = jQuery.progressIndicator({
Severity: Minor
Found in public_html/layouts/basic/modules/Settings/Vtiger/resources/Tax.js - About 1 hr to fix

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

            addTaxDetails: function (details) {
                let container = jQuery('#TaxCalculationsContainer'),
                    taxTable;
    
                //Based on tax type, we will add the tax details row
    Severity: Minor
    Found in public_html/layouts/basic/modules/Settings/Vtiger/resources/Tax.js - About 1 hr to fix

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

              saveTaxDetails: function (form, currentTrElement) {
                  var thisInstance = this;
                  var params = form.serializeFormData();
      
                  if (typeof params === 'undefined') {
      Severity: Minor
      Found in public_html/layouts/basic/modules/Settings/Vtiger/resources/Tax.js - About 1 hr to fix

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

                updateTaxStatus: function (currentTarget) {
                    var aDeferred = jQuery.Deferred();
        
                    var currentTrElement = currentTarget.closest('tr');
                    var taxId = currentTrElement.data('taxid');
        Severity: Minor
        Found in public_html/layouts/basic/modules/Settings/Vtiger/resources/Tax.js - About 1 hr to fix

          Function validateTaxName has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  validateTaxName: function (data) {
                      var thisInstance = this;
                      var aDeferred = jQuery.Deferred();
          
                      var taxName = data.taxlabel;
          Severity: Minor
          Found in public_html/layouts/basic/modules/Settings/Vtiger/resources/Tax.js - About 1 hr to fix

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

                    checkDuplicateName: function (details) {
                        var aDeferred = jQuery.Deferred();
                        var taxName = details.taxlabel;
                        var taxId = details.taxid;
                        var moduleName = app.getModuleName();
            Severity: Minor
            Found in public_html/layouts/basic/modules/Settings/Vtiger/resources/Tax.js - About 1 hr to fix

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

                          AppConnector.request(params)
                              .done(function (data) {
                                  var response = data['result'];
                                  var result = response['success'];
                                  if (result == true) {
              public_html/layouts/basic/modules/Settings/Profiles/resources/Profiles.js on lines 337..349
              public_html/layouts/basic/modules/Settings/Roles/resources/Roles.js on lines 228..240

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

              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

                          AppConnector.request(params)
                              .done(function (data) {
                                  progressIndicatorElement.progressIndicator({ mode: 'hide' });
                                  aDeferred.resolve(data);
                              })
              public_html/layouts/basic/modules/Settings/Inventory/resources/Index.js on lines 267..275
              public_html/layouts/basic/modules/Settings/SharingAccess/resources/SharingAccess.js on lines 92..100

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

              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 (!(taxName in thisInstance.duplicateCheckCache)) {
                              thisInstance
                                  .checkDuplicateName(data)
                                  .done(function (data) {
                                      thisInstance.duplicateCheckCache[taxName] = data['success'];
              public_html/layouts/basic/modules/Settings/Inventory/resources/Index.js on lines 178..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 77.

              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

                          container.on('click', '.editTax', function (e) {
                              var editTaxButton = jQuery(e.currentTarget);
                              var currentTrElement = editTaxButton.closest('tr');
                              thisInstance.editTax(editTaxButton.data('url'), currentTrElement);
                          });
              public_html/layouts/basic/modules/Settings/Inventory/resources/Index.js on lines 306..310

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

              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 (form.find('.addTaxView').val() == 'true') {
                                      thisInstance.addTaxDetails(data['result']);
                                  } else {
                                      thisInstance.updateTaxDetails(data['result'], currentTrElement);
                                  }
              public_html/layouts/basic/modules/Settings/Inventory/resources/Index.js on lines 93..97

              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

                                  if (currentTarget.is(':checked')) {
                                      params.text = app.vtranslate('JS_TAX_ENABLED');
                                  } else {
                                      params.text = app.vtranslate('JS_TAX_DISABLED');
                                  }
              public_html/layouts/basic/modules/Vtiger/resources/RelatedList.js on lines 1031..1035

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

              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

                                  app.showModalWindow(
                                      data,
                                      function (data) {
                                          if (typeof callBackFunction == 'function') {
                                              callBackFunction(data);
              public_html/layouts/basic/modules/Settings/Currency/resources/Currency.js on lines 82..90
              public_html/layouts/basic/modules/Settings/Currency/resources/Currency.js on lines 152..160
              public_html/layouts/basic/modules/Settings/Dav/resources/Dav.js on lines 40..48
              public_html/layouts/basic/modules/Settings/LayoutEditor/resources/LayoutEditor.js on lines 1148..1156

              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