phpmyadmin/phpmyadmin

View on GitHub
resources/js/src/table/structure.ts

Summary

Maintainability
C
1 day
Test Coverage

File structure.ts has 348 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import $ from 'jquery';
import { AJAX } from '../modules/ajax.ts';
import { Functions } from '../modules/functions.ts';
import { Navigation } from '../modules/navigation.ts';
import { CommonParams } from '../modules/common.ts';
Severity: Minor
Found in resources/js/src/table/structure.ts - About 4 hrs to fix

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

            function submitForm () {
                var $msg = ajaxShowMessage(window.Messages.strProcessingRequest);
                $.post($form.attr('action'), $form.serialize() + CommonParams.get('arg_separator') + 'do_save_data=1', function (data) {
                    if ($('.sqlqueryresults').length !== 0) {
                        $('.sqlqueryresults').remove();
    Severity: Minor
    Found in resources/js/src/table/structure.ts - About 1 hr to fix

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

                  $.post({
                      url: formUrl,
                      data: formData,
                      success: response => {
                          if (! response.success) {
      Severity: Major
      Found in resources/js/src/table/structure.ts and 1 other location - About 5 hrs to fix
      resources/js/src/modules/functions.ts on lines 2804..2820

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

      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

              designerModalPreviewModal.addEventListener('hidden.bs.modal', () => {
                  designerModalPreviewModal.querySelector('.modal-body').innerHTML = '<div class="spinner-border" role="status">' +
                      '<span class="visually-hidden">' + window.Messages.strLoading + '</span></div>';
              });
      Severity: Major
      Found in resources/js/src/table/structure.ts and 1 other location - About 1 hr to fix
      resources/js/src/modules/functions.ts on lines 2823..2826

      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

              if ($link.is('#partition_action_DROP')) {
                  $link.confirm(window.Messages.strDropPartitionWarning, $link.attr('href'), function (url) {
                      submitPartitionAction(url);
                  });
              } else if ($link.is('#partition_action_TRUNCATE')) {
      Severity: Minor
      Found in resources/js/src/table/structure.ts and 1 other location - About 35 mins to fix
      resources/js/src/table/structure.ts on lines 464..470

      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

              } else if ($link.is('#partition_action_TRUNCATE')) {
                  $link.confirm(window.Messages.strTruncatePartitionWarning, $link.attr('href'), function (url) {
                      submitPartitionAction(url);
                  });
              } else {
      Severity: Minor
      Found in resources/js/src/table/structure.ts and 1 other location - About 35 mins to fix
      resources/js/src/table/structure.ts on lines 460..470

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 46.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status