phpmyadmin/phpmyadmin

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

Summary

Maintainability
F
2 wks
Test Coverage

File zoom_plot_jqplot.ts has 508 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 { CommonParams } from '../modules/common.ts';
import highlightSql from '../modules/sql-highlight.ts';
Severity: Major
Found in resources/js/src/table/zoom_plot_jqplot.ts - About 1 day to fix

    Function dataPointSave has 114 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var dataPointSave = function () {
            // Find changed values by comparing form values with selectedRow Object
            var newValues = {};// Stores the values changed from original
            var sqlTypes = {};
            var it = 0;
    Severity: Major
    Found in resources/js/src/table/zoom_plot_jqplot.ts - About 4 hrs to fix

      Function onClick has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      onClick (e: Event) {
                          // @ts-ignore
                          const activeElements = e.chart.getActiveElements();
                          if (activeElements.length === 0) {
                              return;
      Severity: Minor
      Found in resources/js/src/table/zoom_plot_jqplot.ts - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                if (! isNumeric(value)) {
                                    sqlQuery += '\'' + value + '\', ';
                                } else {
                                    sqlQuery += value + ', ';
                                }
        Severity: Major
        Found in resources/js/src/table/zoom_plot_jqplot.ts - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if (sqlTypes[key] === 'bit') {
                                      sqlQuery += 'b\'' + value + '\', ';
                                  }
          Severity: Major
          Found in resources/js/src/table/zoom_plot_jqplot.ts - About 45 mins to fix

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

                $('#tableid_1').on('change', function () {
                    // AJAX request for field type, collation, operators, and value field
                    $.post('index.php?route=/table/zoom-search', {
                        'ajax_request': true,
                        'change_tbl_info': true,
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 2 days to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 157..179

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

            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

                $('#tableid_0').on('change', function () {
                    // AJAX request for field type, collation, operators, and value field
                    $.post('index.php?route=/table/zoom-search', {
                        'ajax_request': true,
                        'change_tbl_info': true,
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 2 days to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 182..204

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

            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

                $('#tableid_3').on('change', function () {
                    // AJAX request for field type, collation, operators, and value field
                    $.post('index.php?route=/table/zoom-search', {
                        'ajax_request': true,
                        'change_tbl_info': true,
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 2 days to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 206..226

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

            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

                $('#tableid_2').on('change', function () {
                    // AJAX request for field type, collation, operators, and value field
                    $.post('index.php?route=/table/zoom-search', {
                        'ajax_request': true,
                        'change_tbl_info': true,
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 2 days to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 228..248

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

            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 (yChange) {
                            yCord[searchedDataKey] = selectedRow[yLabel];
                            // [searchedDataKey][1] contains the y value
                            if (yType === 'numeric') {
                                series[0][searchedDataKey][1] = selectedRow[yLabel];
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 1 day to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 334..356

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

            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 (xChange) {
                            xCord[searchedDataKey] = selectedRow[xLabel];
                            // [searchedDataKey][0] contains the x value
                            if (xType === 'numeric') {
                                series[0][searchedDataKey][0] = selectedRow[xLabel];
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 1 day to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 358..380

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

            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

                $('#togglesearchformlink')
                    .html(window.Messages.strShowSearchCriteria)
                    .on('click', function () {
                        var $link = $(this);
                        $('#zoom_search_form').slideToggle();
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 5 hrs to fix
            resources/js/src/table/select.ts on lines 68..81

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

            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

                                x: {
                                    display: true,
                                    title: { display: options.axes.xaxis.label !== '', text: options.axes.xaxis.label },
                                    ticks: { callback: value => xType === 'time' ? (new Date(value)).toLocaleString(lang) : value },
                                },
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 2 hrs to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 627..631

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

            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

                                y: {
                                    display: true,
                                    title: { display: options.axes.yaxis.label !== '', text: options.axes.yaxis.label },
                                    ticks: { callback: value => yType === 'time' ? (new Date(value)).toLocaleString(lang) : value },
                                }
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 2 hrs to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 622..626

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

            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

                    $.each(tableRows, function (index, item) {
                        $(item).on('change', function () {
                            window.changeValueFieldType(this, index);
                            window.verifyAfterSearchFieldChange(index, '#zoom_search_form');
                        });
            Severity: Major
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 1 hr to fix
            resources/js/src/table/select.ts on lines 84..89

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

                if (type.toString().search(/datetime/i) !== -1 ||
                    type.toString().search(/timestamp/i) !== -1
                ) {
                    // @ts-ignore
                    return $.datepicker.parseDateTime('yy-mm-dd', 'HH:mm:ss', val);
            Severity: Minor
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 40 mins to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 100..106

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

                } else if (field.toString().search(/time/i) !== -1 ||
                    field.toString().search(/date/i) !== -1
                ) {
                    return 'time';
                } else {
            Severity: Minor
            Found in resources/js/src/table/zoom_plot_jqplot.ts and 1 other location - About 40 mins to fix
            resources/js/src/table/zoom_plot_jqplot.ts on lines 76..86

            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