wikimedia/mediawiki-core

View on GitHub
maintenance/rebuildrecentchanges.php

Summary

Maintainability
D
2 days
Test Coverage

File rebuildrecentchanges.php has 397 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Rebuild recent changes from scratch.  This takes several hours,
 * depending on the database size and server configuration.
 *
Severity: Minor
Found in maintenance/rebuildrecentchanges.php - About 5 hrs to fix

    Method rebuildRecentChangesTablePass1 has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function rebuildRecentChangesTablePass1() {
            $dbw = $this->getPrimaryDB();
            $commentStore = $this->getServiceContainer()->getCommentStore();
    
            if ( $this->hasOption( 'from' ) && $this->hasOption( 'to' ) ) {
    Severity: Major
    Found in maintenance/rebuildrecentchanges.php - About 3 hrs to fix

      Method rebuildRecentChangesTablePass3 has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function rebuildRecentChangesTablePass3() {
              global $wgLogRestrictions, $wgFilterLogTypes;
      
              $dbw = $this->getDB( DB_PRIMARY );
              $commentStore = $this->getServiceContainer()->getCommentStore();
      Severity: Major
      Found in maintenance/rebuildrecentchanges.php - About 3 hrs to fix

        Method rebuildRecentChangesTablePass2 has 69 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function rebuildRecentChangesTablePass2() {
                $dbw = $this->getPrimaryDB();
        
                $this->output( "Updating links and size differences...\n" );
        
        
        Severity: Major
        Found in maintenance/rebuildrecentchanges.php - About 2 hrs to fix

          Function rebuildRecentChangesTablePass4 has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

              private function rebuildRecentChangesTablePass4() {
                  global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol, $wgMiserMode;
          
                  $dbw = $this->getPrimaryDB();
          
          
          Severity: Minor
          Found in maintenance/rebuildrecentchanges.php - About 2 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 rebuildRecentChangesTablePass4 has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function rebuildRecentChangesTablePass4() {
                  global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol, $wgMiserMode;
          
                  $dbw = $this->getPrimaryDB();
          
          
          Severity: Minor
          Found in maintenance/rebuildrecentchanges.php - About 1 hr to fix

            Function rebuildRecentChangesTablePass2 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                private function rebuildRecentChangesTablePass2() {
                    $dbw = $this->getPrimaryDB();
            
                    $this->output( "Updating links and size differences...\n" );
            
            
            Severity: Minor
            Found in maintenance/rebuildrecentchanges.php - About 1 hr 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 rebuildRecentChangesTablePass5 has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function rebuildRecentChangesTablePass5() {
                    $dbw = $this->getPrimaryDB();
            
                    $this->output( "Removing duplicate revision and logging entries...\n" );
            
            
            Severity: Minor
            Found in maintenance/rebuildrecentchanges.php - About 1 hr to fix

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

                  private function rebuildRecentChangesTablePass1() {
                      $dbw = $this->getPrimaryDB();
                      $commentStore = $this->getServiceContainer()->getCommentStore();
              
                      if ( $this->hasOption( 'from' ) && $this->hasOption( 'to' ) ) {
              Severity: Minor
              Found in maintenance/rebuildrecentchanges.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->hasOption( 'from' ) && !$this->hasOption( 'to' ) ) ||
                          ( !$this->hasOption( 'from' ) && $this->hasOption( 'to' ) )
                      ) {
              Severity: Minor
              Found in maintenance/rebuildrecentchanges.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