wikimedia/mediawiki-core

View on GitHub
includes/specials/SpecialRenameUser.php

Summary

Maintainability
F
3 days
Test Coverage

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

    public function execute( $par ) {
        $this->setHeaders();
        $this->addHelpLink( 'Help:Renameuser' );

        $this->checkPermissions();
Severity: Major
Found in includes/specials/SpecialRenameUser.php - About 6 hrs to fix

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

        public function execute( $par ) {
            $this->setHeaders();
            $this->addHelpLink( 'Help:Renameuser' );
    
            $this->checkPermissions();
    Severity: Minor
    Found in includes/specials/SpecialRenameUser.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

    File SpecialRenameUser.php has 365 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace MediaWiki\Specials;
    
    use Language;
    Severity: Minor
    Found in includes/specials/SpecialRenameUser.php - About 4 hrs to fix

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

          private function showForm( $oldName, $newName, $warnings, $reason, $moveChecked, $suppressChecked ) {
              $performer = $this->getUser();
      
              $formDescriptor = [
                  'oldusername' => [
      Severity: Major
      Found in includes/specials/SpecialRenameUser.php - About 2 hrs to fix

        Method getMoveStatusHtml has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function getMoveStatusHtml( Status $status, Title $oldTitle, Title $newTitle ) {
                $linkRenderer = $this->getLinkRenderer();
                if ( $status->hasMessage( 'articleexists' ) || $status->hasMessage( 'redirectexists' ) ) {
                    $link = $linkRenderer->makeKnownLink( $newTitle );
                    return Html::rawElement(
        Severity: Minor
        Found in includes/specials/SpecialRenameUser.php - About 1 hr to fix

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

                  IConnectionProvider $dbConns,
                  Language $contentLanguage,
                  MovePageFactory $movePageFactory,
                  PermissionManager $permissionManager,
                  TitleFactory $titleFactory,
          Severity: Major
          Found in includes/specials/SpecialRenameUser.php - About 1 hr to fix

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

                private function showForm( $oldName, $newName, $warnings, $reason, $moveChecked, $suppressChecked ) {
            Severity: Minor
            Found in includes/specials/SpecialRenameUser.php - About 45 mins to fix

              Avoid too many return statements within this method.
              Open

                          return;
              Severity: Major
              Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                            return;
                Severity: Major
                Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                              return;
                  Severity: Major
                  Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                                return;
                    Severity: Major
                    Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                  return;
                      Severity: Major
                      Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return;
                        Severity: Major
                        Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                          Avoid too many return statements within this method.
                          Open

                                      return;
                          Severity: Major
                          Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                            Avoid too many return statements within this method.
                            Open

                                        return;
                            Severity: Major
                            Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                              Avoid too many return statements within this method.
                              Open

                                          return;
                              Severity: Major
                              Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                                Avoid too many return statements within this method.
                                Open

                                                        return;
                                Severity: Major
                                Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                                  Avoid too many return statements within this method.
                                  Open

                                              return;
                                  Severity: Major
                                  Found in includes/specials/SpecialRenameUser.php - About 30 mins to fix

                                    Function getMoveStatusHtml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                        private function getMoveStatusHtml( Status $status, Title $oldTitle, Title $newTitle ) {
                                            $linkRenderer = $this->getLinkRenderer();
                                            if ( $status->hasMessage( 'articleexists' ) || $status->hasMessage( 'redirectexists' ) ) {
                                                $link = $linkRenderer->makeKnownLink( $newTitle );
                                                return Html::rawElement(
                                    Severity: Minor
                                    Found in includes/specials/SpecialRenameUser.php - About 25 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