wikimedia/mediawiki-core

View on GitHub
maintenance/namespaceDupes.php

Summary

Maintainability
F
4 days
Test Coverage

File namespaceDupes.php has 503 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * Check for articles to fix after adding/deleting namespaces
 *
 * Copyright © 2005-2007 Brooke Vibber <bvibber@wikimedia.org>
Severity: Major
Found in maintenance/namespaceDupes.php - About 1 day to fix

    Function checkNamespace has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkNamespace( $ns, $name, $options ) {
            $targets = $this->getTargetList( $ns, $name, $options );
            $count = $targets->numRows();
            $this->totalPages += $count;
            if ( $count == 0 ) {
    Severity: Minor
    Found in maintenance/namespaceDupes.php - About 5 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 checkLinkTable has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

        private function checkLinkTable( $table, $fieldPrefix, $ns, $name, $options,
            $extraConds = []
        ) {
            $dbw = $this->getPrimaryDB();
    
    
    Severity: Minor
    Found in maintenance/namespaceDupes.php - About 5 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 checkLinkTable has 124 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function checkLinkTable( $table, $fieldPrefix, $ns, $name, $options,
            $extraConds = []
        ) {
            $dbw = $this->getPrimaryDB();
    
    
    Severity: Major
    Found in maintenance/namespaceDupes.php - About 4 hrs to fix

      Function checkAll has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          private function checkAll( $options ) {
              $contLang = $this->getServiceContainer()->getContentLanguage();
              $spaces = [];
      
              // List interwikis first, so they'll be overridden
      Severity: Minor
      Found in maintenance/namespaceDupes.php - About 3 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 checkNamespace has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function checkNamespace( $ns, $name, $options ) {
              $targets = $this->getTargetList( $ns, $name, $options );
              $count = $targets->numRows();
              $this->totalPages += $count;
              if ( $count == 0 ) {
      Severity: Major
      Found in maintenance/namespaceDupes.php - About 3 hrs to fix

        Method checkAll has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function checkAll( $options ) {
                $contLang = $this->getServiceContainer()->getContentLanguage();
                $spaces = [];
        
                // List interwikis first, so they'll be overridden
        Severity: Major
        Found in maintenance/namespaceDupes.php - About 2 hrs to fix

          Method movePage has 49 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function movePage( $id, LinkTarget $newLinkTarget ) {
                  $dbw = $this->getPrimaryDB();
          
                  $dbw->newUpdateQueryBuilder()
                      ->update( 'page' )
          Severity: Minor
          Found in maintenance/namespaceDupes.php - About 1 hr to fix

            Method mergePage has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function mergePage( $row, Title $newTitle ) {
                    $dbw = $this->getPrimaryDB();
                    $updateRowsPerQuery = $this->getConfig()->get( MainConfigNames::UpdateRowsPerQuery );
            
                    $id = $row->page_id;
            Severity: Minor
            Found in maintenance/namespaceDupes.php - About 1 hr to fix

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

                  private function movePage( $id, LinkTarget $newLinkTarget ) {
                      $dbw = $this->getPrimaryDB();
              
                      $dbw->newUpdateQueryBuilder()
                          ->update( 'page' )
              Severity: Minor
              Found in maintenance/namespaceDupes.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 checkLinkTable has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private function checkLinkTable( $table, $fieldPrefix, $ns, $name, $options,
                      $extraConds = []
              Severity: Minor
              Found in maintenance/namespaceDupes.php - About 45 mins to fix

                There are no issues that match your filters.

                Category
                Status