wikimedia/mediawiki-core

View on GitHub
maintenance/importDump.php

Summary

Maintainability
C
7 hrs
Test Coverage

File importDump.php has 261 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Import XML dump files into the current wiki.
 *
 * Copyright © 2005 Brooke Vibber <bvibber@wikimedia.org>
Severity: Minor
Found in maintenance/importDump.php - About 2 hrs to fix

    Method importFromHandle has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function importFromHandle( $handle ) {
            $this->startTime = microtime( true );
    
            $user = User::newSystemUser( User::MAINTENANCE_SCRIPT_USER, [ 'steal' => true ] );
    
    
    Severity: Minor
    Found in maintenance/importDump.php - About 1 hr to fix

      Method __construct has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function __construct() {
              parent::__construct();
              $gz = in_array( 'compress.zlib', stream_get_wrappers() )
                  ? 'ok'
                  : '(disabled; requires PHP zlib module)';
      Severity: Minor
      Found in maintenance/importDump.php - About 1 hr to fix

        Function importFromHandle has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            private function importFromHandle( $handle ) {
                $this->startTime = microtime( true );
        
                $user = User::newSystemUser( User::MAINTENANCE_SCRIPT_USER, [ 'steal' => true ] );
        
        
        Severity: Minor
        Found in maintenance/importDump.php - About 55 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

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

            private function showReport() {
                if ( !$this->mQuiet ) {
                    $delta = microtime( true ) - $this->startTime;
                    if ( $delta ) {
                        $rate = sprintf( "%.2f", $this->pageCount / $delta );
        Severity: Minor
        Found in maintenance/importDump.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

        Function execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            public function execute() {
                if ( $this->getServiceContainer()->getReadOnlyMode()->isReadOnly() ) {
                    $this->fatalError( "Wiki is in read-only mode; you'll need to disable it for import to work." );
                }
        
        
        Severity: Minor
        Found in maintenance/importDump.php - About 25 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