wikimedia/mediawiki-extensions-Translate

View on GitHub
src/PageTranslation/TranslatableBundleMover.php

Summary

Maintainability
D
2 days
Test Coverage

Function getPageMoveCollection has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    public function getPageMoveCollection(
        Title $source,
        ?Title $target,
        User $user,
        string $reason,
Severity: Minor
Found in src/PageTranslation/TranslatableBundleMover.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

File TranslatableBundleMover.php has 321 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/TranslatableBundleMover.php - About 3 hrs to fix

    Method getPageMoveCollection has 71 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getPageMoveCollection(
            Title $source,
            ?Title $target,
            User $user,
            string $reason,
    Severity: Major
    Found in src/PageTranslation/TranslatableBundleMover.php - About 2 hrs to fix

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

          private function getPagesToMove(
              Title $source,
              Title $target,
              bool $moveSubPages,
              bool $fetchTranslatableSubpages,
      Severity: Minor
      Found in src/PageTranslation/TranslatableBundleMover.php - About 1 hr to fix

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

            private function move(
                TranslatableBundle $sourceBundle,
                User $performer,
                array $pagesToMove,
                array $pagesToRedirect,
        Severity: Minor
        Found in src/PageTranslation/TranslatableBundleMover.php - About 1 hr to fix

          Function getPagesToMove has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              private function getPagesToMove(
                  Title $source,
                  Title $target,
                  bool $moveSubPages,
                  bool $fetchTranslatableSubpages,
          Severity: Minor
          Found in src/PageTranslation/TranslatableBundleMover.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 __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                  MovePageFactory $movePageFactory,
                  JobQueueGroup $jobQueue,
                  LinkBatchFactory $linkBatchFactory,
                  TranslatableBundleFactory $bundleFactory,
                  SubpageListBuilder $subpageBuilder,
          Severity: Major
          Found in src/PageTranslation/TranslatableBundleMover.php - About 1 hr to fix

            Method moveAsynchronously has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                    Title $source,
                    Title $target,
                    bool $moveSubPages,
                    User $user,
                    string $moveReason,
            Severity: Major
            Found in src/PageTranslation/TranslatableBundleMover.php - About 50 mins to fix

              Method moveSynchronously has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      Title $source,
                      Title $target,
                      array $pagesToMove,
                      array $pagesToRedirect,
                      User $performer,
              Severity: Major
              Found in src/PageTranslation/TranslatableBundleMover.php - About 50 mins to fix

                Method getPageMoveCollection has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                        Title $source,
                        ?Title $target,
                        User $user,
                        string $reason,
                        bool $moveSubPages,
                Severity: Major
                Found in src/PageTranslation/TranslatableBundleMover.php - About 50 mins to fix

                  Method getPagesToMove has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          Title $source,
                          Title $target,
                          bool $moveSubPages,
                          bool $fetchTranslatableSubpages,
                          bool $moveTalkPages,
                  Severity: Minor
                  Found in src/PageTranslation/TranslatableBundleMover.php - About 45 mins to fix

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

                        private function move(
                            TranslatableBundle $sourceBundle,
                            User $performer,
                            array $pagesToMove,
                            array $pagesToRedirect,
                    Severity: Minor
                    Found in src/PageTranslation/TranslatableBundleMover.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 move has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                            TranslatableBundle $sourceBundle,
                            User $performer,
                            array $pagesToMove,
                            array $pagesToRedirect,
                            string $reason,
                    Severity: Minor
                    Found in src/PageTranslation/TranslatableBundleMover.php - About 45 mins to fix

                      There are no issues that match your filters.

                      Category
                      Status