wikimedia/mediawiki-extensions-Translate

View on GitHub
src/PageTranslation/MoveTranslatableBundleMaintenanceScript.php

Summary

Maintainability
D
1 day
Test Coverage

Function displayPagesToMove has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private function displayPagesToMove( PageMoveCollection $pageCollection, bool $leaveRedirect ): void {
        $infoMessage = "\nThe following pages will be moved:\n";
        $count = 0;
        $subpagesCount = 0;
        $talkpagesCount = 0;
Severity: Minor
Found in src/PageTranslation/MoveTranslatableBundleMaintenanceScript.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 displayPagesToMove has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function displayPagesToMove( PageMoveCollection $pageCollection, bool $leaveRedirect ): void {
        $infoMessage = "\nThe following pages will be moved:\n";
        $count = 0;
        $subpagesCount = 0;
        $talkpagesCount = 0;
Severity: Major
Found in src/PageTranslation/MoveTranslatableBundleMaintenanceScript.php - About 3 hrs to fix

    Method execute has 72 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function execute() {
            $this->bundleMover = Services::getInstance()->getTranslatableBundleMover();
    
            $mwService = MediaWikiServices::getInstance();
            $this->titleParser = $mwService->getTitleParser();
    Severity: Major
    Found in src/PageTranslation/MoveTranslatableBundleMaintenanceScript.php - About 2 hrs to fix

      File MoveTranslatableBundleMaintenanceScript.php has 265 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      declare( strict_types = 1 );
      
      namespace MediaWiki\Extension\Translate\PageTranslation;
      
      
      Severity: Minor
      Found in src/PageTranslation/MoveTranslatableBundleMaintenanceScript.php - About 2 hrs to fix

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

            public function __construct() {
                parent::__construct();
                $this->addDescription( 'Review and move translatable bundles including their subpages' );
        
                $this->addArg(
        Severity: Minor
        Found in src/PageTranslation/MoveTranslatableBundleMaintenanceScript.php - About 1 hr to fix

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

              public function execute() {
                  $this->bundleMover = Services::getInstance()->getTranslatableBundleMover();
          
                  $mwService = MediaWikiServices::getInstance();
                  $this->titleParser = $mwService->getTitleParser();
          Severity: Minor
          Found in src/PageTranslation/MoveTranslatableBundleMaintenanceScript.php - About 45 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

          Method progressCallback has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              private function progressCallback( Title $previous, Title $new, Status $status, int $total, int $processed ): void {
          Severity: Minor
          Found in src/PageTranslation/MoveTranslatableBundleMaintenanceScript.php - About 35 mins to fix

            There are no issues that match your filters.

            Category
            Status