phpmyadmin/phpmyadmin

View on GitHub
resources/js/src/triggers.ts

Summary

Maintainability
F
2 wks
Test Coverage

Function editorDialog has 131 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    editorDialog: function (isNew, $this) {
        var that = this;
        /**
         * @var $edit_row jQuery object containing the reference to
         *                the row of the the item being edited
Severity: Major
Found in resources/js/src/triggers.ts - About 5 hrs to fix

    File triggers.ts has 352 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 { ajaxRemoveMessage, ajaxShowMessage } from './modules/ajax-message.ts';
    Severity: Minor
    Found in resources/js/src/triggers.ts - About 4 hrs to fix

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

                  buttonOptions[window.Messages.strGo].click = function () {
                      // Move the data from the codemirror editor back to the
                      // textarea, where it can be used in the form submission.
                      if (typeof window.CodeMirror !== 'undefined') {
                          that.syntaxHiglighter.save();
      Severity: Major
      Found in resources/js/src/triggers.ts - About 2 hrs to fix

        Function exportDialog has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            exportDialog: function ($this) {
                var $msg = ajaxShowMessage();
                if ($this.attr('id') === 'bulkActionExportButton') {
                    var combined = {
                        success: true,
        Severity: Major
        Found in resources/js/src/triggers.ts - About 2 hrs to fix

          Function dropMultipleDialog has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              dropMultipleDialog: function ($this) {
                  // We ask for confirmation here
                  $this.confirm(window.Messages.strDropRTEitems, '', function () {
                      /**
                       * @var msg jQuery object containing the reference to
          Severity: Minor
          Found in resources/js/src/triggers.ts - About 1 hr to fix

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

                dropDialog: function ($this) {
                    /**
                     * @var $curr_row Object containing reference to the current row
                     */
                    var $currRow = $this.parents('tr');
            Severity: Minor
            Found in resources/js/src/triggers.ts - About 1 hr to fix

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

                              $.post(url, data, function (data) {
                                  if (data.success !== true) {
                                      ajaxShowMessage(data.error, false);
              
                                      return;
              Severity: Major
              Found in resources/js/src/triggers.ts and 1 other location - About 3 days to fix
              resources/js/src/database/events.ts on lines 214..320

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

              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

                  dropMultipleDialog: function ($this) {
                      // We ask for confirmation here
                      $this.confirm(window.Messages.strDropRTEitems, '', function () {
                          /**
                           * @var msg jQuery object containing the reference to
              Severity: Major
              Found in resources/js/src/triggers.ts and 1 other location - About 3 days to fix
              resources/js/src/database/events.ts on lines 466..552

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

              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

                  dropDialog: function ($this) {
                      /**
                       * @var $curr_row Object containing reference to the current row
                       */
                      var $currRow = $this.parents('tr');
              Severity: Major
              Found in resources/js/src/triggers.ts and 1 other location - About 2 days to fix
              resources/js/src/database/events.ts on lines 391..464

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

              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.attr('id') === 'bulkActionExportButton') {
                          var combined = {
                              success: true,
                              title: window.Messages.strExport,
                              message: '',
              Severity: Major
              Found in resources/js/src/triggers.ts and 1 other location - About 1 day to fix
              resources/js/src/database/events.ts on lines 68..103

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

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

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

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

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

              Refactorings

              Further Reading

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

                  validate: function () {
                      /**
                       * @var $elm a jQuery object containing the reference
                       *           to an element that is being validated
                       */
              Severity: Major
              Found in resources/js/src/triggers.ts and 2 other locations - About 1 day to fix
              resources/js/src/database/events.ts on lines 32..64
              resources/js/src/database/routines.ts on lines 42..74

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

              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

                  $(document).on('click', 'a.ajax.add_anchor, a.ajax.edit_anchor', function (event) {
                      event.preventDefault();
              
                      if ($(this).hasClass('add_anchor')) {
                          // @ts-ignore
              Severity: Major
              Found in resources/js/src/triggers.ts and 1 other location - About 3 hrs to fix
              resources/js/src/database/events.ts on lines 592..601

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

              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

              AJAX.registerTeardown('triggers.js', function () {
                  $(document).off('click', 'a.ajax.add_anchor, a.ajax.edit_anchor');
                  $(document).off('click', 'a.ajax.export_anchor');
                  $(document).off('click', '#bulkActionExportButton');
                  $(document).off('click', 'a.ajax.drop_anchor');
              Severity: Major
              Found in resources/js/src/triggers.ts and 1 other location - About 2 hrs to fix
              resources/js/src/modules/functions.ts on lines 2250..2256

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

              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

                          var buttonOptions = {
                              [window.Messages.strGo]: {
                                  text: window.Messages.strGo,
                                  class: 'btn btn-primary',
                              },
              Severity: Major
              Found in resources/js/src/triggers.ts and 4 other locations - About 1 hr to fix
              resources/js/src/database/routines.ts on lines 193..202
              resources/js/src/server/status/monitor.ts on lines 697..706
              resources/js/src/server/status/monitor.ts on lines 1487..1496
              resources/js/src/server/status/monitor.ts on lines 2223..2232

              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

                  $(document).on('click', 'a.ajax.export_anchor', function (event) {
                      event.preventDefault();
                      DatabaseTriggers.exportDialog($(this));
                  });
              Severity: Minor
              Found in resources/js/src/triggers.ts and 1 other location - About 45 mins to fix
              resources/js/src/triggers.ts on lines 594..597

              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

                  $(document).on('click', 'a.ajax.drop_anchor', function (event) {
                      event.preventDefault();
                      DatabaseTriggers.dropDialog($(this));
                  });
              Severity: Minor
              Found in resources/js/src/triggers.ts and 1 other location - About 45 mins to fix
              resources/js/src/triggers.ts on lines 581..584

              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

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

                          buttonOptions[window.Messages.strClose].click = function () {
                              $(this).dialog('close');
                          };
              Severity: Minor
              Found in resources/js/src/triggers.ts and 2 other locations - About 40 mins to fix
              resources/js/src/database/events.ts on lines 325..327
              resources/js/src/database/routines.ts on lines 341..343

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

                  $(document).on('click', '#bulkActionDropButton', function (event) {
                      event.preventDefault();
                      DatabaseTriggers.dropMultipleDialog($(this));
                  });
              Severity: Major
              Found in resources/js/src/triggers.ts and 5 other locations - About 40 mins to fix
              resources/js/src/database/routines.ts on lines 967..970
              resources/js/src/database/routines.ts on lines 972..975
              resources/js/src/database/routines.ts on lines 977..980
              resources/js/src/database/routines.ts on lines 982..985
              resources/js/src/database/routines.ts on lines 987..990

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 48.

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

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

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

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

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status