phpmyadmin/phpmyadmin

View on GitHub
src/Plugins/Import/ImportMediawiki.php

Summary

Maintainability
F
3 days
Test Coverage

Function doImport has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
Open

    public function doImport(File|null $importHandle = null): array
    {
        $GLOBALS['error'] ??= null;

        $sqlStatements = [];
Severity: Minor
Found in src/Plugins/Import/ImportMediawiki.php - About 1 day 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 doImport has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function doImport(File|null $importHandle = null): array
    {
        $GLOBALS['error'] ??= null;

        $sqlStatements = [];
Severity: Major
Found in src/Plugins/Import/ImportMediawiki.php - About 4 hrs to fix

    Function delimiterReplace has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        private function delimiterReplace(string $replace, string $subject): string
        {
            // String that will be returned
            $cleaned = '';
            // Possible states of current character
    Severity: Minor
    Found in src/Plugins/Import/ImportMediawiki.php - About 4 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

    File ImportMediawiki.php has 270 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    /**
     * MediaWiki import plugin for phpMyAdmin
     */
    
    
    Severity: Minor
    Found in src/Plugins/Import/ImportMediawiki.php - About 2 hrs to fix

      Method delimiterReplace has 40 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function delimiterReplace(string $replace, string $subject): string
          {
              // String that will be returned
              $cleaned = '';
              // Possible states of current character
      Severity: Minor
      Found in src/Plugins/Import/ImportMediawiki.php - About 1 hr to fix

        Function importDataOneTable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            private function importDataOneTable(ImportTable $table, array &$sqlStatements): void
            {
                if ($this->analyze) {
                    // Set the table name
                    if ($table->tableName === '') {
        Severity: Minor
        Found in src/Plugins/Import/ImportMediawiki.php - About 35 mins 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

        There are no issues that match your filters.

        Category
        Status