wikimedia/mediawiki-extensions-Translate

View on GitHub
src/Synchronization/ManageGroupsSpecialPage.php

Summary

Maintainability
F
1 wk
Test Coverage

File ManageGroupsSpecialPage.php has 906 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
declare( strict_types = 1 );

namespace MediaWiki\Extension\Translate\Synchronization;

Severity: Major
Found in src/Synchronization/ManageGroupsSpecialPage.php - About 2 days to fix

    Function showChanges has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function showChanges( int $limit ): void {
            $diff = new DifferenceEngine( $this->getContext() );
            $diff->showDiffStyle();
            $diff->setReducedLineNumbers();
            $this->diff = $diff;
    Severity: Minor
    Found in src/Synchronization/ManageGroupsSpecialPage.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 formatChange has 104 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function formatChange(
            MessageGroup $group,
            MessageSourceChange $changes,
            string $language,
            string $type,
    Severity: Major
    Found in src/Synchronization/ManageGroupsSpecialPage.php - About 4 hrs to fix

      Function formatChange has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function formatChange(
              MessageGroup $group,
              MessageSourceChange $changes,
              string $language,
              string $type,
      Severity: Minor
      Found in src/Synchronization/ManageGroupsSpecialPage.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 processSubmit has 89 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function processSubmit(): void {
              $req = $this->getRequest();
              $out = $this->getOutput();
              $errorGroups = [];
      
      
      Severity: Major
      Found in src/Synchronization/ManageGroupsSpecialPage.php - About 3 hrs to fix

        Method showChanges has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function showChanges( int $limit ): void {
                $diff = new DifferenceEngine( $this->getContext() );
                $diff->showDiffStyle();
                $diff->setReducedLineNumbers();
                $this->diff = $diff;
        Severity: Major
        Found in src/Synchronization/ManageGroupsSpecialPage.php - About 3 hrs to fix

          Function processSubmit has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function processSubmit(): void {
                  $req = $this->getRequest();
                  $out = $this->getOutput();
                  $errorGroups = [];
          
          
          Severity: Minor
          Found in src/Synchronization/ManageGroupsSpecialPage.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

          ManageGroupsSpecialPage has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ManageGroupsSpecialPage extends SpecialPage {
              private const GROUP_SYNC_INFO_WRAPPER_CLASS = 'smg-group-sync-cache-info';
              private const RIGHT = 'translate-manage';
              protected DifferenceEngine $diff;
              /** Name of the import. */
          Severity: Minor
          Found in src/Synchronization/ManageGroupsSpecialPage.php - About 3 hrs to fix

            Function handleRenameSubmit has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

                private function handleRenameSubmit(
                    MessageGroup $group,
                    MessageSourceChange $sourceChanges,
                    WebRequest $req,
                    string $language,
            Severity: Minor
            Found in src/Synchronization/ManageGroupsSpecialPage.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 handleModificationsSubmit has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                private function handleModificationsSubmit(
                    MessageGroup $group,
                    MessageSourceChange $sourceChanges,
                    WebRequest $req,
                    string $language,
            Severity: Minor
            Found in src/Synchronization/ManageGroupsSpecialPage.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 handleRenameSubmit has 59 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                private function handleRenameSubmit(
                    MessageGroup $group,
                    MessageSourceChange $sourceChanges,
                    WebRequest $req,
                    string $language,
            Severity: Major
            Found in src/Synchronization/ManageGroupsSpecialPage.php - About 2 hrs to fix

              Method formatRename has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private function formatRename(
                      MessageGroup $group,
                      array $addedMsg,
                      array $deletedMsg,
                      string $language,
              Severity: Major
              Found in src/Synchronization/ManageGroupsSpecialPage.php - About 2 hrs to fix

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

                    private function showRenames(
                        MessageGroup $group,
                        MessageSourceChange $sourceChanges,
                        OutputPage $out,
                        string $language,
                Severity: Minor
                Found in src/Synchronization/ManageGroupsSpecialPage.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 execute has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function execute( $par ) {
                        $this->setHeaders();
                
                        $out = $this->getOutput();
                        $out->addModuleStyles( 'ext.translate.specialpages.styles' );
                Severity: Minor
                Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

                  Method startSync has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private function startSync( array $modificationJobs, array $renameJobs ): void {
                          // We are adding an empty array for groups that have no jobs. This is mainly done to
                          // avoid adding unnecessary checks. Remove those using array_filter
                          $modificationGroupIds = array_keys( array_filter( $modificationJobs ) );
                          $renameGroupIds = array_keys( array_filter( $renameJobs ) );
                  Severity: Minor
                  Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

                    Method showRenames has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function showRenames(
                            MessageGroup $group,
                            MessageSourceChange $sourceChanges,
                            OutputPage $out,
                            string $language,
                    Severity: Minor
                    Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

                      Method getRenameJobParams has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private function getRenameJobParams(
                              array $currentMsg,
                              MessageSourceChange $sourceChanges,
                              string $languageCode,
                              int $groupNamespace,
                      Severity: Minor
                      Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

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

                            public static function tabify( Skin $skin, array &$tabs ): void {
                                $title = $skin->getTitle();
                                if ( !$title->isSpecialPage() ) {
                                    return;
                                }
                        Severity: Minor
                        Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

                          Method handleModificationsSubmit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private function handleModificationsSubmit(
                                  MessageGroup $group,
                                  MessageSourceChange $sourceChanges,
                                  WebRequest $req,
                                  string $language,
                          Severity: Minor
                          Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

                            Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    Language $contLang,
                                    NamespaceInfo $nsInfo,
                                    RevisionLookup $revLookup,
                                    GroupSynchronizationCache $synchronizationCache,
                                    JobQueueGroup $jobQueueGroup,
                            Severity: Major
                            Found in src/Synchronization/ManageGroupsSpecialPage.php - About 1 hr to fix

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

                                  public function execute( $par ) {
                                      $this->setHeaders();
                              
                                      $out = $this->getOutput();
                                      $out->addModuleStyles( 'ext.translate.specialpages.styles' );
                              Severity: Minor
                              Found in src/Synchronization/ManageGroupsSpecialPage.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

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

                                      WebRequest $req,
                                      MessageSourceChange $sourceChanges,
                                      string $id,
                                      string $key,
                                      string $language,
                              Severity: Major
                              Found in src/Synchronization/ManageGroupsSpecialPage.php - About 50 mins to fix

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

                                        MessageGroup $group,
                                        MessageSourceChange $sourceChanges,
                                        WebRequest $req,
                                        string $language,
                                        array &$postponed,
                                Severity: Major
                                Found in src/Synchronization/ManageGroupsSpecialPage.php - About 50 mins to fix

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

                                          MessageGroup $group,
                                          MessageSourceChange $sourceChanges,
                                          WebRequest $req,
                                          string $language,
                                          array &$postponed,
                                  Severity: Minor
                                  Found in src/Synchronization/ManageGroupsSpecialPage.php - About 45 mins to fix

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

                                            MessageGroup $group,
                                            MessageSourceChange $changes,
                                            string $language,
                                            string $type,
                                            array $params,
                                    Severity: Minor
                                    Found in src/Synchronization/ManageGroupsSpecialPage.php - About 45 mins to fix

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

                                              MessageGroup $group,
                                              array $addedMsg,
                                              array $deletedMsg,
                                              string $language,
                                              bool $isEqual,
                                      Severity: Minor
                                      Found in src/Synchronization/ManageGroupsSpecialPage.php - About 45 mins to fix

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

                                                array $currentMsg,
                                                MessageSourceChange $sourceChanges,
                                                string $languageCode,
                                                int $groupNamespace,
                                                string $selectedVal,
                                        Severity: Minor
                                        Found in src/Synchronization/ManageGroupsSpecialPage.php - About 45 mins to fix

                                          Consider simplifying this complex logical expression.
                                          Open

                                                  if ( $title && $type === 'addition' && $title->exists() ) {
                                                      // The message has for some reason dropped out from cache
                                                      // or, perhaps it is being reused. In any case treat it
                                                      // as a change for display, so the admin can see if
                                                      // action is needed and let the message be processed.
                                          Severity: Major
                                          Found in src/Synchronization/ManageGroupsSpecialPage.php - About 40 mins to fix

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

                                                    MessageGroup $group,
                                                    MessageSourceChange $sourceChanges,
                                                    OutputPage $out,
                                                    string $language,
                                                    int &$limit
                                            Severity: Minor
                                            Found in src/Synchronization/ManageGroupsSpecialPage.php - About 35 mins to fix

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

                                                  private function formatRename(
                                                      MessageGroup $group,
                                                      array $addedMsg,
                                                      array $deletedMsg,
                                                      string $language,
                                              Severity: Minor
                                              Found in src/Synchronization/ManageGroupsSpecialPage.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 startSync has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  private function startSync( array $modificationJobs, array $renameJobs ): void {
                                                      // We are adding an empty array for groups that have no jobs. This is mainly done to
                                                      // avoid adding unnecessary checks. Remove those using array_filter
                                                      $modificationGroupIds = array_keys( array_filter( $modificationJobs ) );
                                                      $renameGroupIds = array_keys( array_filter( $renameJobs ) );
                                              Severity: Minor
                                              Found in src/Synchronization/ManageGroupsSpecialPage.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 tabify has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  public static function tabify( Skin $skin, array &$tabs ): void {
                                                      $title = $skin->getTitle();
                                                      if ( !$title->isSpecialPage() ) {
                                                          return;
                                                      }
                                              Severity: Minor
                                              Found in src/Synchronization/ManageGroupsSpecialPage.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