phpmyadmin/phpmyadmin

View on GitHub

Showing 2,003 of 2,003 total issues

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

        $(this).confirm(question, $(this).attr('href'), function (url) {
            var $msgbox = ajaxShowMessage(window.Messages.strProcessingRequest);
            var params = getJsConfirmCommonParam(this, $link.getPostData());
            $.post(url, params, function (data) {
                if (typeof data !== 'undefined' && data.success === true) {
Severity: Major
Found in resources/js/src/table/operations.ts and 1 other location - About 7 hrs to fix
resources/js/src/table/operations.ts on lines 294..313

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

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

        foreach ($alltables as $oneTable) {
            $existRel = $this->relation->getForeigners($this->db->getName(), $oneTable);
            if ($existRel === []) {
                continue;
            }
Severity: Major
Found in src/Plugins/Schema/Eps/EpsRelationSchema.php and 1 other location - About 7 hrs to fix
src/Plugins/Schema/Svg/SvgRelationSchema.php on lines 115..162

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

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

        foreach ($alltables as $oneTable) {
            $existRel = $this->relation->getForeigners($this->db->getName(), $oneTable);
            if ($existRel === []) {
                continue;
            }
Severity: Major
Found in src/Plugins/Schema/Svg/SvgRelationSchema.php and 1 other location - About 7 hrs to fix
src/Plugins/Schema/Eps/EpsRelationSchema.php on lines 100..147

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

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

Function outputHandler has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    public function outputHandler(string $line): bool
    {
        $GLOBALS['time_start'] ??= null;
        $GLOBALS['save_filename'] ??= null;

Severity: Minor
Found in src/Export/Export.php - About 7 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

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

            window.u2f.register(request.appId, [request], JSON.parse($inputReg.attr('data-signatures')), function (data) {
                // Handle returning error data
                if (data.errorCode && data.errorCode !== 0) {
                    switch (data.errorCode) {
                    case 5:
Severity: Major
Found in resources/js/src/u2f.ts and 1 other location - About 7 hrs to fix
resources/js/src/u2f.ts on lines 52..79

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

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

            window.u2f.sign(request[0].appId, request[0].challenge, request, function (data) {
                // Handle returning error data
                if (data.errorCode && data.errorCode !== 0) {
                    switch (data.errorCode) {
                    case 5:
Severity: Major
Found in resources/js/src/u2f.ts and 1 other location - About 7 hrs to fix
resources/js/src/u2f.ts on lines 13..40

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

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

Method getMessage has 183 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function getMessage(
        Message|string $message,
        string|null $sqlQuery = null,
        MessageType $type = MessageType::Notice,
    ): string {
Severity: Major
Found in src/Html/Generator.php - About 7 hrs to fix

    File InternalRelations.php has 471 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * Internal relations for information schema and mysql databases.
     */
    
    
    Severity: Minor
    Found in src/InternalRelations.php - About 7 hrs to fix

      Function on has 182 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function on () {
          return function () {
              Indexes.resetColumnLists();
      
              // for table creation form
      Severity: Major
      Found in resources/js/src/modules/indexes.ts - About 7 hrs to fix

        Function sqlPrettyPrint has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
        Open

        function sqlPrettyPrint (string) {
            if (typeof window.CodeMirror === 'undefined') {
                return string;
            }
        
        
        Severity: Minor
        Found in resources/js/src/modules/functions.ts - About 7 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

        Method exportDatabase has 179 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function exportDatabase(
                DatabaseName $db,
                array $tables,
                string $whatStrucOrData,
                array $tableStructure,
        Severity: Major
        Found in src/Export/Export.php - About 7 hrs to fix

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

              public function generateWkt(array $gisData, int $index, string $empty = ''): string
              {
                  $dataRow = $gisData[$index]['POLYGON'] ?? null;
                  $noOfLines = max(1, $dataRow['data_length'] ?? 0);
          
          
          Severity: Major
          Found in src/Gis/GisPolygon.php and 1 other location - About 7 hrs to fix
          src/Gis/GisMultiLineString.php on lines 262..281

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

          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

              public function generateWkt(array $gisData, int $index, string $empty = ''): string
              {
                  $dataRow = $gisData[$index]['MULTILINESTRING'] ?? null;
                  $noOfLines = max(1, $dataRow['data_length'] ?? 0);
          
          
          Severity: Major
          Found in src/Gis/GisMultiLineString.php and 1 other location - About 7 hrs to fix
          src/Gis/GisPolygon.php on lines 259..278

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

          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

          File Core.php has 463 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          declare(strict_types=1);
          
          namespace PhpMyAdmin;
          Severity: Minor
          Found in src/Core.php - About 7 hrs to fix

            Function unPackGz has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
            Open

                private function unPackGz(string $gitFolder, string $hash): array|false|null
                {
                    $commit = false;
            
                    $gitFileName = $gitFolder . '/objects/'
            Severity: Minor
            Found in src/Git.php - About 7 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 SortableTableInstance has 177 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function SortableTableInstance (table, options: {ignoreRect?: any, events?: any} = {}) {
                        var down = false;
                        var $draggedEl;
                        var oldCell;
                        var previewMove;
            Severity: Major
            Found in resources/js/src/jquery.sortable-table.ts - About 7 hrs to fix

              File zoom_plot_jqplot.ts has 461 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: Minor
              Found in resources/js/src/table/zoom_plot_jqplot.ts - About 7 hrs to fix

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

                function createPageSettingsModal (): void {
                    if ($('#pageSettingsModal').length > 0) {
                        return;
                    }
                
                
                Severity: Major
                Found in resources/js/src/modules/page_settings.ts and 2 other locations - About 7 hrs to fix
                resources/js/src/modules/functions.ts on lines 1766..1787
                resources/js/src/modules/indexes.ts on lines 550..571

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

                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

                function createAddIndexModal (): void {
                    if ($('#addIndexModal').length > 0) {
                        return;
                    }
                
                
                Severity: Major
                Found in resources/js/src/modules/indexes.ts and 2 other locations - About 7 hrs to fix
                resources/js/src/modules/functions.ts on lines 1766..1787
                resources/js/src/modules/page_settings.ts on lines 3..24

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

                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

                function createFunctionConfirmModal (): void {
                    if ($('#functionConfirmModal').length > 0) {
                        return;
                    }
                
                
                Severity: Major
                Found in resources/js/src/modules/functions.ts and 2 other locations - About 7 hrs to fix
                resources/js/src/modules/indexes.ts on lines 550..571
                resources/js/src/modules/page_settings.ts on lines 3..24

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

                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

                Severity
                Category
                Status
                Source
                Language