wikimedia/mediawiki-core

View on GitHub
maintenance/storage/recompressTracked.php

Summary

Maintainability
F
4 days
Test Coverage

File recompressTracked.php has 600 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Moves blobs indexed by trackBlobs.php to a specified list of destination
 * clusters, and recompresses them in the process.
 *
Severity: Major
Found in maintenance/storage/recompressTracked.php - About 1 day to fix

    Function doPage has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        private function doPage( $pageId ) {
            $title = Title::newFromID( $pageId );
            if ( $title ) {
                $titleText = $title->getPrefixedText();
            } else {
    Severity: Minor
    Found in maintenance/storage/recompressTracked.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

    RecompressTracked has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RecompressTracked {
        public $destClusters;
        public $batchSize = 1000;
        public $orphanBatchSize = 1000;
        public $reportingInterval = 10;
    Severity: Minor
    Found in maintenance/storage/recompressTracked.php - About 2 hrs to fix

      Method commit has 58 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function commit() {
              $originalCount = count( $this->texts );
              if ( !$originalCount ) {
                  return;
              }
      Severity: Major
      Found in maintenance/storage/recompressTracked.php - About 2 hrs to fix

        Method doAllOrphans has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function doAllOrphans() {
                $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
                $startId = 0;
                $i = 0;
                if ( $this->noCount ) {
        Severity: Major
        Found in maintenance/storage/recompressTracked.php - About 2 hrs to fix

          Method doPage has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function doPage( $pageId ) {
                  $title = Title::newFromID( $pageId );
                  if ( $title ) {
                      $titleText = $title->getPrefixedText();
                  } else {
          Severity: Major
          Found in maintenance/storage/recompressTracked.php - About 2 hrs to fix

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

                private function doAllOrphans() {
                    $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
                    $startId = 0;
                    $i = 0;
                    if ( $this->noCount ) {
            Severity: Minor
            Found in maintenance/storage/recompressTracked.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

            Function commit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

                public function commit() {
                    $originalCount = count( $this->texts );
                    if ( !$originalCount ) {
                        return;
                    }
            Severity: Minor
            Found in maintenance/storage/recompressTracked.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 doAllPages has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function doAllPages() {
                    $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
                    $i = 0;
                    $startId = 0;
                    if ( $this->noCount ) {
            Severity: Minor
            Found in maintenance/storage/recompressTracked.php - About 1 hr to fix

              Function doAllPages has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function doAllPages() {
                      $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
                      $i = 0;
                      $startId = 0;
                      if ( $this->noCount ) {
              Severity: Minor
              Found in maintenance/storage/recompressTracked.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 startChildProcs has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function startChildProcs() {
                      $wiki = WikiMap::getCurrentWikiId();
              
                      $cmd = 'php ' . Shell::escape( __FILE__ );
                      foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) {
              Severity: Minor
              Found in maintenance/storage/recompressTracked.php - About 1 hr to fix

                Function startChildProcs has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function startChildProcs() {
                        $wiki = WikiMap::getCurrentWikiId();
                
                        $cmd = 'php ' . Shell::escape( __FILE__ );
                        foreach ( self::$cmdLineOptionMap as $cmdOption => $classOption ) {
                Severity: Minor
                Found in maintenance/storage/recompressTracked.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 doOrphanList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private function doOrphanList( $textIds ) {
                        // Finish incomplete moves
                        if ( !$this->copyOnly ) {
                            $this->finishIncompleteMoves( [ 'bt_text_id' => $textIds ] );
                            $this->syncDBs();
                Severity: Minor
                Found in maintenance/storage/recompressTracked.php - About 1 hr to fix

                  Method finishIncompleteMoves has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function finishIncompleteMoves( $conds ) {
                          $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
                          $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
                  
                          $startId = 0;
                  Severity: Minor
                  Found in maintenance/storage/recompressTracked.php - About 1 hr to fix

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

                        private function finishIncompleteMoves( $conds ) {
                            $dbr = MediaWikiServices::getInstance()->getConnectionProvider()->getReplicaDatabase();
                            $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
                    
                            $startId = 0;
                    Severity: Minor
                    Found in maintenance/storage/recompressTracked.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 doOrphanList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        private function doOrphanList( $textIds ) {
                            // Finish incomplete moves
                            if ( !$this->copyOnly ) {
                                $this->finishIncompleteMoves( [ 'bt_text_id' => $textIds ] );
                                $this->syncDBs();
                    Severity: Minor
                    Found in maintenance/storage/recompressTracked.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 executeChild has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function executeChild() {
                            $this->debug( 'starting' );
                            $this->syncDBs();
                    
                            while ( !feof( STDIN ) ) {
                    Severity: Minor
                    Found in maintenance/storage/recompressTracked.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